Commit f19d8483 authored by Kyle Fuller's avatar Kyle Fuller

[pod setup] Remove write access option

This is no longer relevant with trunk

Closes #2519
parent 45a06bc1
......@@ -17,7 +17,6 @@ module Pod
def self.options
[
['--no-shallow', 'Clone full history so push will work'],
['--push', 'Use this option to enable push access once granted'],
].concat(super)
end
......@@ -25,8 +24,7 @@ module Pod
executable :git
def initialize(argv)
@push_option = argv.flag?('push')
@shallow = argv.flag?('shallow', !@push_option)
@shallow = argv.flag?('shallow', true)
super
end
......@@ -43,8 +41,7 @@ module Pod
end
end
access_type = push? ? 'push' : 'read-only'
UI.puts "Setup completed (#{access_type} access)".green
UI.puts "Setup completed".green
end
#--------------------------------------#
......@@ -116,7 +113,7 @@ module Pod
# be enabled.
#
def url
push? ? self.class.read_write_url : self.class.read_only_url
self.class.read_only_url
end
# @return [String] the read only url of the master repo.
......@@ -125,31 +122,6 @@ module Pod
'https://github.com/CocoaPods/Specs.git'
end
# @return [String] the read-write url of the master repo.
#
def self.read_write_url
'git@github.com:CocoaPods/Specs.git'
end
# Checks if the user asked to setup the master repo in push mode or if
# the repo was already in push mode.
#
# @return [String] whether the master repo should be set up in push mode.
#
def push?
@push ||= (@push_option || master_repo_is_push?)
end
# @return [Bool] if the master repo is already configured in push mode.
#
def master_repo_is_push?
return false unless master_repo_dir.exist?
Dir.chdir(master_repo_dir) do
url = git('config --get remote.origin.url')
url.chomp == self.class.read_write_url
end
end
# @return [Pathname] the directory of the master repo.
#
def master_repo_dir
......
......@@ -15,12 +15,6 @@ module Pod
cmd.url.should == 'https://github.com/CocoaPods/Specs.git'
end
it 'returns the push URL of the `master` spec-repo' do
config.silent = true
cmd = Command::Setup.new(argv('--push'))
cmd.url.should == 'git@github.com:CocoaPods/Specs.git'
end
before do
set_up_test_repo
Command::Setup.stubs(:read_only_url).returns(test_repo_path.to_s)
......@@ -34,7 +28,6 @@ module Pod
it 'creates the local spec-repos directory and creates a clone of the `master` repo' do
output = run_command('setup')
output.should.include 'Setup completed'
output.should.not.include 'push'
url = Dir.chdir(config.repos_dir + 'master') { `git config --get remote.origin.url`.chomp }
url.should == test_repo_path.to_s
end
......@@ -61,25 +54,6 @@ module Pod
end
end
it 'creates a full clone of the `master` repo when push access is requested' do
Dir.chdir(test_repo_path) do
`echo 'touch' > touch && git add touch && git commit -m 'updated'`
end
# Need to use file:// to test local use of --depth=1
Command::Setup.stubs(:read_write_url).returns("file://#{test_repo_path}")
cmd = run_command('setup', '--push')
Dir.chdir(config.repos_dir + 'master') do
`git log --pretty=oneline`.strip.split("\n").size.should > 1
end
end
it 'preserves push access for the `master` repo' do
output = run_command('setup')
output.should.not.include 'push'
Dir.chdir(config.repos_dir + 'master') { `git remote set-url origin git@github.com:CocoaPods/Specs.git` }
command('setup').url.should == 'git@github.com:CocoaPods/Specs.git'
end
before do
FileUtils.rm_rf(test_repo_path)
set_up_old_test_repo
......
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