Commit 1b24ef0c authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Style] Don't use reduce to determine if there are changes

Use a var instead, as per @alloy
parent 7522194f
...@@ -65,11 +65,14 @@ module Pod ...@@ -65,11 +65,14 @@ module Pod
script_path = target.copy_resources_script_relative_path script_path = target.copy_resources_script_relative_path
shell_script = %("#{script_path}"\n) shell_script = %("#{script_path}"\n)
phases.reduce(false) do |changes, phase| changes = false
phases.each do |phase|
unless phase.shell_script == shell_script unless phase.shell_script == shell_script
phase.shell_script = shell_script phase.shell_script = shell_script
end || changes changes = true
end
end end
changes
end end
# Adds spec libraries to the frameworks build phase of the # Adds spec libraries to the frameworks build phase of the
......
...@@ -18,13 +18,14 @@ module Pod ...@@ -18,13 +18,14 @@ module Pod
# @return [Bool] whether any changes to the project were made. # @return [Bool] whether any changes to the project were made.
# #
def self.integrate(pod_bundle, targets) def self.integrate(pod_bundle, targets)
targets.reduce(false) do |changes, target| changes = false
target.build_configurations.reduce(false) do |c, config| targets.each do |target|
change = update_to_cocoapods_0_34(pod_bundle, targets) target.build_configurations.each do |config|
change = set_target_xcconfig(pod_bundle, target, config) || change changes = true if update_to_cocoapods_0_34(pod_bundle, targets)
change || c changes = true if set_target_xcconfig(pod_bundle, target, config)
end || changes end
end end
changes
end end
private private
...@@ -47,7 +48,8 @@ module Pod ...@@ -47,7 +48,8 @@ module Pod
# #
def self.update_to_cocoapods_0_34(pod_bundle, targets) def self.update_to_cocoapods_0_34(pod_bundle, targets)
sandbox = pod_bundle.sandbox sandbox = pod_bundle.sandbox
targets.map(&:project).uniq.reduce(false) do |changes, project| changes = false
targets.map(&:project).uniq.each do |project|
file_refs = project.files.select do |file_ref| file_refs = project.files.select do |file_ref|
path = file_ref.path.to_s path = file_ref.path.to_s
if File.extname(path) == '.xcconfig' if File.extname(path) == '.xcconfig'
...@@ -63,8 +65,9 @@ module Pod ...@@ -63,8 +65,9 @@ module Pod
end end
end end
changes || !file_refs.empty? changes = true unless file_refs.empty?
end end
changes
end end
# Creates a file reference to the xcconfig generated by # Creates a file reference to the xcconfig generated by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment