Skip to content
Browse files

Copy complete template dir and overwrite pbxproj file.

  • Loading branch information...
1 parent cca8cdf commit bbbce5aad04e2e7bb2020578df8c2be3b74f2e23 @alloy alloy committed Sep 11, 2011
View
2 lib/cocoa_pods/specification.rb
@@ -133,7 +133,7 @@ def create_static_library!
project.add_source_file(file)
end
#project.pretty_print
- project.create_at(config.project_pods_root + 'Pods.xcodeproj')
+ project.create_in(config.project_pods_root)
end
include Config::Mixin
View
25 lib/cocoa_pods/xcode_project.rb
@@ -6,12 +6,18 @@ class XcodeProject
# TODO see if we really need different templates for iOS and OS X
def self.static_library
- new TEMPLATES_DIR + 'cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj'
+ new TEMPLATES_DIR + 'cocoa-touch-static-library'
end
- def initialize(template)
- @template = NSMutableDictionary.dictionaryWithContentsOfFile(template.to_s)
- #pretty_print
+ def initialize(template_dir)
+ @template_dir = template_dir
+ file = template_dir + template_file
+ @template = NSMutableDictionary.dictionaryWithContentsOfFile(file.to_s)
+ pretty_print
+ end
+
+ def template_file
+ 'Pods.xcodeproj/project.pbxproj'
end
def add_source_file(file)
@@ -50,9 +56,12 @@ def to_hash
@template
end
- def create_at(xcodeproj)
- xcodeproj.mkpath
- pbxproj = xcodeproj + 'project.pbxproj'
+ def create_in(pods_root)
+ @template_dir.children.each do |child|
+ puts "Copy #{child} to #{pods_root + child.relative_path_from(@template_dir)}"
+ FileUtils.cp_r(child, pods_root + child.relative_path_from(@template_dir))
+ end
+ pbxproj = pods_root + template_file
@template.writeToFile(pbxproj.to_s, atomically:true)
end
@@ -67,7 +76,7 @@ def add_file_to_list(isa, build_file_uuid)
def add_file_to_files_group(file_ref_uuid)
object_uuid, object = objects.find do |_, object|
- object['isa'] == 'PBXGroup' && object['name'] == 'Files'
+ object['isa'] == 'PBXGroup' && object['name'] == 'Pods'
end
#object['children'] ||= []
object['children'] << file_ref_uuid
View
24 xcode-project-templates/cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj
@@ -14,9 +14,9 @@
/* Begin PBXFileReference section */
515B0FB5141D52E0001DC3E6 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
515B0FB8141D52E0001DC3E6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
- 515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Pods-Prefix.pch"; sourceTree = "<group>"; };
- 515B0FBD141D52E0001DC3E6 /* Pods.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Pods.h; sourceTree = "<group>"; };
- 515B0FBE141D52E0001DC3E6 /* Pods.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Pods.m; sourceTree = "<group>"; };
+ 515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "Pods-Prefix.pch"; path = "Pods/Pods-Prefix.pch"; sourceTree = SOURCE_ROOT; };
+ 515B0FBD141D52E0001DC3E6 /* Pods.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Pods.h; path = Pods/Pods.h; sourceTree = SOURCE_ROOT; };
+ 515B0FBE141D52E0001DC3E6 /* Pods.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Pods.m; path = Pods/Pods.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -34,7 +34,7 @@
515B0FAA141D52E0001DC3E6 = {
isa = PBXGroup;
children = (
- 515B0FBA141D52E0001DC3E6 /* Pods */,
+ 515B0FC9141D5FBE001DC3E6 /* Pods */,
515B0FB7141D52E0001DC3E6 /* Frameworks */,
515B0FB6141D52E0001DC3E6 /* Products */,
);
@@ -56,22 +56,23 @@
name = Frameworks;
sourceTree = "<group>";
};
- 515B0FBA141D52E0001DC3E6 /* Pods */ = {
+ 515B0FBB141D52E0001DC3E6 /* Supporting Files */ = {
isa = PBXGroup;
children = (
- 515B0FBD141D52E0001DC3E6 /* Pods.h */,
- 515B0FBE141D52E0001DC3E6 /* Pods.m */,
- 515B0FBB141D52E0001DC3E6 /* Supporting Files */,
+ 515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */,
);
+ name = "Supporting Files";
path = Pods;
sourceTree = "<group>";
};
- 515B0FBB141D52E0001DC3E6 /* Supporting Files */ = {
+ 515B0FC9141D5FBE001DC3E6 /* Pods */ = {
isa = PBXGroup;
children = (
- 515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */,
+ 515B0FBD141D52E0001DC3E6 /* Pods.h */,
+ 515B0FBE141D52E0001DC3E6 /* Pods.m */,
+ 515B0FBB141D52E0001DC3E6 /* Supporting Files */,
);
- name = "Supporting Files";
+ name = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
@@ -221,6 +222,7 @@
515B0FC4141D52E0001DC3E6 /* Release */,
);
defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

0 comments on commit bbbce5a

Please sign in to comment.
Something went wrong with that request. Please try again.