Commit b364b059 authored by Eloy Durán's avatar Eloy Durán

[pod init] Set `source` directive to use `master` repo URL.

parent d90c9545
...@@ -59,7 +59,7 @@ module Pod ...@@ -59,7 +59,7 @@ module Pod
# Uncomment this line to define a global platform for your project # Uncomment this line to define a global platform for your project
# platform :ios, "6.0" # platform :ios, "6.0"
source 'master' source '#{Command::Setup.read_only_url}'
PLATFORM PLATFORM
project.targets.each do |target| project.targets.each do |target|
......
...@@ -116,18 +116,18 @@ module Pod ...@@ -116,18 +116,18 @@ module Pod
# be enabled. # be enabled.
# #
def url def url
push? ? read_write_url : read_only_url push? ? self.class.read_write_url : self.class.read_only_url
end end
# @return [String] the read only url of the master repo. # @return [String] the read only url of the master repo.
# #
def read_only_url def self.read_only_url
'https://github.com/CocoaPods/Specs.git' 'https://github.com/CocoaPods/Specs.git'
end end
# @return [String] the read-write url of the master repo. # @return [String] the read-write url of the master repo.
# #
def read_write_url def self.read_write_url
'git@github.com:CocoaPods/Specs.git' 'git@github.com:CocoaPods/Specs.git'
end end
...@@ -146,7 +146,7 @@ module Pod ...@@ -146,7 +146,7 @@ module Pod
return false unless master_repo_dir.exist? return false unless master_repo_dir.exist?
Dir.chdir(master_repo_dir) do Dir.chdir(master_repo_dir) do
url = git('config --get remote.origin.url') url = git('config --get remote.origin.url')
url.chomp == read_write_url url.chomp == self.class.read_write_url
end end
end end
......
...@@ -23,7 +23,7 @@ module Pod ...@@ -23,7 +23,7 @@ module Pod
before do before do
set_up_test_repo set_up_test_repo
Command::Setup.any_instance.stubs(:read_only_url).returns(test_repo_path.to_s) Command::Setup.stubs(:read_only_url).returns(test_repo_path.to_s)
config.repos_dir = SpecHelper.temporary_directory config.repos_dir = SpecHelper.temporary_directory
end end
...@@ -44,7 +44,7 @@ module Pod ...@@ -44,7 +44,7 @@ module Pod
`echo 'touch' > touch && git add touch && git commit -m 'updated'` `echo 'touch' > touch && git add touch && git commit -m 'updated'`
end end
# Need to use file:// to test local use of --depth=1 # Need to use file:// to test local use of --depth=1
Command::Setup.any_instance.stubs(:read_only_url).returns("file://#{test_repo_path}") Command::Setup.stubs(:read_only_url).returns("file://#{test_repo_path}")
run_command('setup') run_command('setup')
Dir.chdir(config.repos_dir + 'master') do Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should == 1 `git log --pretty=oneline`.strip.split("\n").size.should == 1
...@@ -66,7 +66,7 @@ module Pod ...@@ -66,7 +66,7 @@ module Pod
`echo 'touch' > touch && git add touch && git commit -m 'updated'` `echo 'touch' > touch && git add touch && git commit -m 'updated'`
end end
# Need to use file:// to test local use of --depth=1 # Need to use file:// to test local use of --depth=1
Command::Setup.any_instance.stubs(:read_write_url).returns("file://#{test_repo_path}") Command::Setup.stubs(:read_write_url).returns("file://#{test_repo_path}")
cmd = run_command('setup', '--push') cmd = run_command('setup', '--push')
Dir.chdir(config.repos_dir + 'master') do Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should > 1 `git log --pretty=oneline`.strip.split("\n").size.should > 1
......
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