Commit bbbce5aa authored by Eloy Duran's avatar Eloy Duran

Copy complete template dir and overwrite pbxproj file.

parent cca8cdfb
...@@ -133,7 +133,7 @@ module Pod ...@@ -133,7 +133,7 @@ module Pod
project.add_source_file(file) project.add_source_file(file)
end end
#project.pretty_print #project.pretty_print
project.create_at(config.project_pods_root + 'Pods.xcodeproj') project.create_in(config.project_pods_root)
end end
include Config::Mixin include Config::Mixin
......
...@@ -6,12 +6,18 @@ module Pod ...@@ -6,12 +6,18 @@ module Pod
# TODO see if we really need different templates for iOS and OS X # TODO see if we really need different templates for iOS and OS X
def self.static_library def self.static_library
new TEMPLATES_DIR + 'cocoa-touch-static-library/Pods.xcodeproj/project.pbxproj' new TEMPLATES_DIR + 'cocoa-touch-static-library'
end end
def initialize(template) def initialize(template_dir)
@template = NSMutableDictionary.dictionaryWithContentsOfFile(template.to_s) @template_dir = template_dir
#pretty_print file = template_dir + template_file
@template = NSMutableDictionary.dictionaryWithContentsOfFile(file.to_s)
pretty_print
end
def template_file
'Pods.xcodeproj/project.pbxproj'
end end
def add_source_file(file) def add_source_file(file)
...@@ -50,9 +56,12 @@ module Pod ...@@ -50,9 +56,12 @@ module Pod
@template @template
end end
def create_at(xcodeproj) def create_in(pods_root)
xcodeproj.mkpath @template_dir.children.each do |child|
pbxproj = xcodeproj + 'project.pbxproj' 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) @template.writeToFile(pbxproj.to_s, atomically:true)
end end
...@@ -67,7 +76,7 @@ module Pod ...@@ -67,7 +76,7 @@ module Pod
def add_file_to_files_group(file_ref_uuid) def add_file_to_files_group(file_ref_uuid)
object_uuid, object = objects.find do |_, object| object_uuid, object = objects.find do |_, object|
object['isa'] == 'PBXGroup' && object['name'] == 'Files' object['isa'] == 'PBXGroup' && object['name'] == 'Pods'
end end
#object['children'] ||= [] #object['children'] ||= []
object['children'] << file_ref_uuid object['children'] << file_ref_uuid
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
515B0FB5141D52E0001DC3E6 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 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; }; 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>"; }; 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; path = Pods.h; sourceTree = "<group>"; }; 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; path = Pods.m; sourceTree = "<group>"; }; 515B0FBE141D52E0001DC3E6 /* Pods.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Pods.m; path = Pods/Pods.m; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
515B0FAA141D52E0001DC3E6 = { 515B0FAA141D52E0001DC3E6 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515B0FBA141D52E0001DC3E6 /* Pods */, 515B0FC9141D5FBE001DC3E6 /* Pods */,
515B0FB7141D52E0001DC3E6 /* Frameworks */, 515B0FB7141D52E0001DC3E6 /* Frameworks */,
515B0FB6141D52E0001DC3E6 /* Products */, 515B0FB6141D52E0001DC3E6 /* Products */,
); );
...@@ -56,22 +56,23 @@ ...@@ -56,22 +56,23 @@
name = Frameworks; name = Frameworks;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
515B0FBA141D52E0001DC3E6 /* Pods */ = { 515B0FBB141D52E0001DC3E6 /* Supporting Files */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515B0FBD141D52E0001DC3E6 /* Pods.h */, 515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */,
515B0FBE141D52E0001DC3E6 /* Pods.m */,
515B0FBB141D52E0001DC3E6 /* Supporting Files */,
); );
name = "Supporting Files";
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
515B0FBB141D52E0001DC3E6 /* Supporting Files */ = { 515B0FC9141D5FBE001DC3E6 /* Pods */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
515B0FBC141D52E0001DC3E6 /* Pods-Prefix.pch */, 515B0FBD141D52E0001DC3E6 /* Pods.h */,
515B0FBE141D52E0001DC3E6 /* Pods.m */,
515B0FBB141D52E0001DC3E6 /* Supporting Files */,
); );
name = "Supporting Files"; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
/* End PBXGroup section */ /* End PBXGroup section */
...@@ -221,6 +222,7 @@ ...@@ -221,6 +222,7 @@
515B0FC4141D52E0001DC3E6 /* Release */, 515B0FC4141D52E0001DC3E6 /* Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
}; };
......
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