Class: Pod::Generator::CopyResourcesScript
- Inherits:
-
Object
- Object
- Pod::Generator::CopyResourcesScript
- Defined in:
- lib/pod_builder/swizzles.rb
Instance Method Summary collapse
-
#initialize(resources_by_config, platform) ⇒ CopyResourcesScript
constructor
A new instance of CopyResourcesScript.
- #swz_initialize ⇒ Object
Constructor Details
#initialize(resources_by_config, platform) ⇒ CopyResourcesScript
Returns a new instance of CopyResourcesScript.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/pod_builder/swizzles.rb', line 155 def initialize(resources_by_config, platform) resources_by_config.keys.each do |key| items = resources_by_config[key] items.uniq! colliding_resources = items.group_by { |t| File.basename(t) }.values.select { |t| t.count > 1 } unless colliding_resources.empty? = "" colliding_resources.each do |resources| resources.map! { |t| File.(t.gsub("${PODS_ROOT}", "#{Dir.pwd}/Pods")) } # check that files are identical. # For files with paths that are resolved (e.g containing ${PODS_ROOT}) we use the file hash # we fallback to the filename for the others hashes = resources.map { |t| (File.exists?(t) && File.file?(t)) ? Digest::MD5.hexdigest(File.read(t)) : File.basename(t) } if hashes.uniq.count > 1 += resources.join("\n") + "\n" end end unless .empty? = "\n\nThe following resources have the same name and will collide once copied into application bundle:\n" + raise end end resources_by_config[key] = items end swz_initialize(resources_by_config, platform) end |
Instance Method Details
#swz_initialize ⇒ Object
153 |
# File 'lib/pod_builder/swizzles.rb', line 153 alias_method :swz_initialize, :initialize |