Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move PBX object definitions out of template

  • Loading branch information...
commit fcbef0fcecc4fd81b5f3a32c8f0fa43c1d41f4d7 1 parent 47c2270
@nolanw nolanw authored
Showing with 24 additions and 21 deletions.
  1. +4 −21 lib/cocoapods/project_template.rb
  2. +20 −0 lib/cocoapods/xcode/project.rb
View
25 lib/cocoapods/project_template.rb
@@ -4,28 +4,11 @@ module Pod
module ProjectTemplate
def self.for_platform(platform)
project = Xcode::Project.new
- root = project.objects.add(Xcode::Project::PBXProject, {
- 'attributes' => { 'LastUpgradeCheck' => '0420' },
- 'compatibilityVersion' => 'Xcode 3.2',
- 'developmentRegion' => 'English',
- 'hasScannedForEncodings' => '0',
- 'knownRegions' => ['en'],
- 'mainGroup' => project.groups.new.uuid,
- 'projectDirPath' => '',
- 'projectRoot' => '',
- 'targets' => []
- })
- project.root_object = root
- project.main_group << project.groups.new('name' => 'Pods')
- framework = project.files.new({
- 'lastKnownFileType' => 'wrapper.framework',
- 'name' => platform == :ios ? 'Foundation.framework' : 'Cocoa.framework',
- 'path' => "System/Library/Frameworks/#{platform == :ios ? 'Framework' : 'Cocoa'}.framework",
- 'sourceTree' => 'SDKROOT'
- })
- framework.group = project.groups.new('name' => 'Frameworks')
+ project.main_group << project.groups.new({ 'name' => 'Pods' })
+ framework = project.add_system_framework(platform == :ios ? 'Foundation' : 'Cocoa')
+ framework.group = project.groups.new({ 'name' => 'Frameworks' })
project.main_group << framework.group
- products = project.groups.new('name' => 'Products')
+ products = project.groups.new({ 'name' => 'Products' })
project.main_group << products
project.root_object.products = products
View
20 lib/cocoapods/xcode/project.rb
@@ -562,6 +562,17 @@ def initialize(xcodeproj = nil)
'objectVersion' => '46',
'objects' => {}
}
+ self.root_object = objects.add(Xcode::Project::PBXProject, {
+ 'attributes' => { 'LastUpgradeCheck' => '0420' },
+ 'compatibilityVersion' => 'Xcode 3.2',
+ 'developmentRegion' => 'English',
+ 'hasScannedForEncodings' => '0',
+ 'knownRegions' => ['en'],
+ 'mainGroup' => groups.new.uuid,
+ 'projectDirPath' => '',
+ 'projectRoot' => '',
+ 'targets' => []
+ })
end
end
@@ -607,6 +618,15 @@ def files
objects.select_by_class(PBXFileReference)
end
+ def add_system_framework(name)
+ files.new({
+ 'lastKnownFileType' => 'wrapper.framework',
+ 'name' => "#{name}.framework",
+ 'path' => "System/Library/Frameworks/#{name}.framework",
+ 'sourceTree' => 'SDKROOT'
+ })
+ end
+
def build_files
objects.select_by_class(PBXBuildFile)
end
Please sign in to comment.
Something went wrong with that request. Please try again.