Class: Pod::Generator::CopyResourcesScript
- Inherits:
-
Object
- Object
- Pod::Generator::CopyResourcesScript
- Defined in:
- lib/pod_builder/podfile/pre_actions_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.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/pod_builder/podfile/pre_actions_swizzles.rb', line 53 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) ? 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
51 |
# File 'lib/pod_builder/podfile/pre_actions_swizzles.rb', line 51 alias_method :swz_initialize, :initialize |