Commit 2e7b9245 authored by Ian Ynda-Hummel's avatar Ian Ynda-Hummel

Move templates into a separate templates directory.

parent 01015ec8
...@@ -147,6 +147,12 @@ module Pod ...@@ -147,6 +147,12 @@ module Pod
attr_writer :repos_dir attr_writer :repos_dir
# @return [Pathname] the directory where the CocoaPods templates are stored.
#
def templates_dir
@templates_dir ||= Pathname.new(ENV['CP_TEMPLATES_DIR'] || "~/.cocoapods/templates").expand_path
end
# @return [Pathname] the root of the CocoaPods installation where the # @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located. # Podfile is located.
# #
...@@ -230,7 +236,7 @@ module Pod ...@@ -230,7 +236,7 @@ module Pod
# @return [Pathname] # @return [Pathname]
# #
def default_podfile_path def default_podfile_path
@default_podfile_path ||= repos_dir + "default.podfile" @default_podfile_path ||= templates_dir + "default.podfile"
end end
# Returns the path of the default Podfile test pods. # Returns the path of the default Podfile test pods.
...@@ -240,7 +246,7 @@ module Pod ...@@ -240,7 +246,7 @@ module Pod
# @return [Pathname] # @return [Pathname]
# #
def default_test_podfile_path def default_test_podfile_path
@default_test_podfile_path ||= repos_dir + "test.podfile" @default_test_podfile_path ||= templates_dir + "test.podfile"
end end
# @return [Pathname] The file to use a cache of the statistics provider. # @return [Pathname] The file to use a cache of the statistics provider.
......
...@@ -67,9 +67,9 @@ module Pod ...@@ -67,9 +67,9 @@ module Pod
it "includes default pods in a Podfile" do it "includes default pods in a Podfile" do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
tmp_repos_dir = Pathname.pwd + 'repos_dir' tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_repos_dir.mkpath tmp_templates_dir.mkpath
config.repos_dir = tmp_repos_dir config.stubs(:templates_dir).returns(tmp_templates_dir)
open(config.default_podfile_path, 'w') { |f| f << "pod 'AFNetworking'" } open(config.default_podfile_path, 'w') { |f| f << "pod 'AFNetworking'" }
...@@ -85,9 +85,9 @@ module Pod ...@@ -85,9 +85,9 @@ module Pod
it "includes default test pods in test targets in a Podfile" do it "includes default test pods in test targets in a Podfile" do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
tmp_repos_dir = Pathname.pwd + 'repo_dir' tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_repos_dir.mkpath tmp_templates_dir.mkpath
config.repos_dir = tmp_repos_dir config.stubs(:templates_dir).returns(tmp_templates_dir)
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" } open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
...@@ -105,9 +105,9 @@ module Pod ...@@ -105,9 +105,9 @@ module Pod
it "does not include default test pods if there are no test targets" do it "does not include default test pods if there are no test targets" do
Dir.chdir(temporary_directory) do Dir.chdir(temporary_directory) do
tmp_repos_dir = Pathname.pwd + 'repo_dir' tmp_templates_dir = Pathname.pwd + 'templates_dir'
tmp_repos_dir.mkpath tmp_templates_dir.mkpath
config.repos_dir = tmp_repos_dir config.stubs(:templates_dir).returns(tmp_templates_dir)
open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" } open(config.default_test_podfile_path, 'w') { |f| f << "pod 'Kiwi'" }
......
...@@ -21,9 +21,15 @@ module Pod ...@@ -21,9 +21,15 @@ module Pod
it "returns the path to the spec-repos dir" do it "returns the path to the spec-repos dir" do
@sut.repos_dir.should == Pathname.new("~/.cocoapods/repos").expand_path @sut.repos_dir.should == Pathname.new("~/.cocoapods/repos").expand_path
end
it "returns the path to the templates dir" do
@sut.templates_dir.should == Pathname.new("~/.cocoapods/templates").expand_path
end
it "returns the path of the default podfiles" do it "returns the path of the default podfiles" do
config.default_podfile_path.should == Pathname.new("~/.cocoapods/default.podfile").expand_path @sut.default_podfile_path.should == Pathname.new("~/.cocoapods/templates/default.podfile").expand_path
config.default_test_podfile_path.should == Pathname.new("~/.cocoapods/test.podfile").expand_path @sut.default_test_podfile_path.should == Pathname.new("~/.cocoapods/templates/test.podfile").expand_path
end end
it "allows to specify whether the aggressive cache should be used with an environment variable" do it "allows to specify whether the aggressive cache should be used with an environment variable" do
......
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