Commit eef9d519 authored by Eloy Durán's avatar Eloy Durán

Add static libraries to root of project if no Frameworks group exists. #431

Better to allow the user to choose how to organize her project.
parent 854cc1af
......@@ -142,10 +142,8 @@ module Pod
end
def add_pods_library
framework_group = user_project.group("Frameworks")
raise Informative, "Cannot add pod library to project. Please check if the project have a 'Frameworks' group in the root of the project." unless framework_group
pods_library = framework_group.files.new_static_library(@target_definition.label)
group = user_project.group("Frameworks") || user_project.main_group
pods_library = group.files.new_static_library(@target_definition.label)
targets.each do |target|
target.frameworks_build_phases.each { |build_phase| build_phase << pods_library }
end
......
......@@ -3,6 +3,12 @@ require File.expand_path('../../spec_helper', __FILE__)
describe Pod::Installer::UserProjectIntegrator do
extend SpecHelper::TemporaryDirectory
def integrate!
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path)
end
before do
config.silent = true
@sample_project_path = SpecHelper.create_sample_app_copy_from_fixture('SampleProject')
......@@ -23,12 +29,26 @@ describe Pod::Installer::UserProjectIntegrator do
end
end
@integrator = Pod::Installer::UserProjectIntegrator.new(@podfile)
@integrator.integrate!
@sample_project = Xcodeproj::Project.new(@sample_project_path)
end
it 'adds references to the Pods static libraries to the root of the project if the Frameworks group does not exist' do
@sample_project.group('Frameworks').destroy
@sample_project.save_as(@sample_project_path)
integrate!
@sample_project.main_group.files.where(:name => "libPods.a").should.not == nil
@sample_project.main_group.files.where(:name => "libPods-test_runner.a").should.not == nil
end
before do
integrate!
end
it 'adds references to the Pods static libraries to the Frameworks group' do
@sample_project.group('Frameworks').files.where(:name => "libPods.a").should.not == nil
@sample_project.group('Frameworks').files.where(:name => "libPods-test_runner.a").should.not == nil
end
it 'creates a workspace with a name matching the project' do
workspace_path = @sample_project_path.dirname + "SampleProject.xcworkspace"
workspace_path.should.exist
......@@ -54,11 +74,6 @@ describe Pod::Installer::UserProjectIntegrator do
end
end
it 'adds references to the Pods static libraries' do
@sample_project.files.where(:name => "libPods.a").should.not == nil
@sample_project.files.where(:name => "libPods-test_runner.a").should.not == nil
end
it 'adds the libPods static library to the "Link binary with libraries" build phase of each target' do
@podfile.target_definitions.each do |_, definition|
target = @sample_project.targets.where(:name => definition.link_with.first)
......
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