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
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
......
......@@ -6,12 +6,18 @@ module Pod
# 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 @@ module Pod
@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 @@ module Pod
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
......
......@@ -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 */
};
......
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