Permalink
Browse files

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.
  • Loading branch information...
1 parent 854cc1a commit eef9d519c53d5c856afd7a8965712b9395548759 @alloy alloy committed Aug 10, 2012
@@ -142,10 +142,8 @@ def add_xcconfig_base_configuration
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 @@
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 @@
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 @@
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)

0 comments on commit eef9d51

Please sign in to comment.