Commit 12a91103 authored by Eloy Duran's avatar Eloy Duran

more stashing

parent 5df26a6f
...@@ -33,14 +33,18 @@ module Pod ...@@ -33,14 +33,18 @@ module Pod
end end
def target_integrators def target_integrators
@podfile.target_definitions.values.map do |definition| @target_integrators ||= @podfile.target_definitions.values.map do |definition|
TargetIntegrator.new(definition) TargetIntegrator.new(definition) unless definition.empty?
end.compact
end end
def user_projects
@podfile.target_definitions.values.map(&:xcodeproj)
end end
def create_workspace! def create_workspace!
workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path) workspace = Xcodeproj::Workspace.new_from_xcworkspace(workspace_path)
[user_project_path, pods_project_path].each do |project_path| [pods_project_path, *user_projects].each do |project_path|
project_path = project_path.relative_path_from(config.project_root).to_s project_path = project_path.relative_path_from(config.project_root).to_s
workspace << project_path unless workspace.include?(project_path) workspace << project_path unless workspace.include?(project_path)
end end
...@@ -54,6 +58,10 @@ module Pod ...@@ -54,6 +58,10 @@ module Pod
@target_definition = target_definition @target_definition = target_definition
end end
def inspect
"#<#{self.class} for target `#{@target_definition.label}'>"
end
def integrate! def integrate!
return if targets.empty? return if targets.empty?
add_xcconfig_base_configuration add_xcconfig_base_configuration
......
...@@ -83,19 +83,22 @@ describe Pod::Installer::UserProjectIntegrator do ...@@ -83,19 +83,22 @@ describe Pod::Installer::UserProjectIntegrator do
end end
it "only tries to integrate Pods libraries into user targets that haven't been integrated yet" do it "only tries to integrate Pods libraries into user targets that haven't been integrated yet" do
app, test_runner = @integrator.user_project.targets.to_a app, test_runner = @integrator.target_integrators.first.user_project.targets.to_a
p app.frameworks_build_phases.first.files
test_runner.frameworks_build_phases.first.build_files.last.destroy test_runner.frameworks_build_phases.first.build_files.last.destroy
#p app, test_runner
targets = @integrator.targets.sort_by { |target| target.target_definition.label } target_integrators = @integrator.target_integrators.sort_by { |target| target.target_definition.label }
@integrator.stubs(:targets).returns(targets) @integrator.stubs(:target_integrators).returns(target_integrators)
#p target_integrators
targets.first.expects(:add_pods_library).never target_integrators.first.expects(:add_pods_library).never
targets.last.expects(:add_pods_library) target_integrators.last.expects(:add_pods_library)
@integrator.integrate! @integrator.integrate!
end end
it "does not even try to save the project if none of the target integrators had any work to do" do xit "does not even try to save the project if none of the target integrators had any work to do" do
@integrator.user_project.expects(:save_as).never @integrator.target_integrators.first.user_project.expects(:save_as).never
@integrator.integrate! @integrator.integrate!
end end
end end
......
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