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,12 +65,15 @@ module Pod
script_path = target.copy_resources_script_relative_path
shell_script = %("#{script_path}"\n)
phases.reduce(false) do |changes, phase|
changes = false
phases.each do |phase|
unless phase.shell_script == shell_script
phase.shell_script = shell_script
end || changes
changes = true
end
end
changes
end
# Adds spec libraries to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to
......
......@@ -18,14 +18,15 @@ module Pod
# @return [Bool] whether any changes to the project were made.
#
def self.integrate(pod_bundle, targets)
targets.reduce(false) do |changes, target|
target.build_configurations.reduce(false) do |c, config|
change = update_to_cocoapods_0_34(pod_bundle, targets)
change = set_target_xcconfig(pod_bundle, target, config) || change
change || c
end || changes
changes = false
targets.each do |target|
target.build_configurations.each do |config|
changes = true if update_to_cocoapods_0_34(pod_bundle, targets)
changes = true if set_target_xcconfig(pod_bundle, target, config)
end
end
changes
end
private
......@@ -47,7 +48,8 @@ module Pod
#
def self.update_to_cocoapods_0_34(pod_bundle, targets)
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|
path = file_ref.path.to_s
if File.extname(path) == '.xcconfig'
......@@ -63,8 +65,9 @@ module Pod
end
end
changes || !file_refs.empty?
changes = true unless file_refs.empty?
end
changes
end
# 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