Commit 70350dc5 authored by Samuel Giddins's avatar Samuel Giddins

[Repo::Add] Enforce using `pod setup` to add the master repo

parent 5927576b
...@@ -34,6 +34,10 @@ module Pod ...@@ -34,6 +34,10 @@ module Pod
unless @name && @url unless @name && @url
help! 'Adding a repo needs a `NAME` and a `URL`.' help! 'Adding a repo needs a `NAME` and a `URL`.'
end end
if @name == 'master' || @url =~ %r{github.com[:/]+cocoapods/specs}i
raise Informative,
'To setup the master specs repo, please run `pod setup`.'
end
end end
def run def run
......
...@@ -47,5 +47,15 @@ module Pod ...@@ -47,5 +47,15 @@ module Pod
e = lambda { run_command('repo', 'add', 'private', test_repo_path) }.should.raise Informative e = lambda { run_command('repo', 'add', 'private', test_repo_path) }.should.raise Informative
e.message.should.match /Could not create '#{tmp_repos_path}', the CocoaPods repo cache directory./ e.message.should.match /Could not create '#{tmp_repos_path}', the CocoaPods repo cache directory./
end end
it 'raises an informative error when attempting to add the master repo' do
master = command('repo', 'add', 'master', 'https://github.com/foo/bar.git')
should.raise(Informative) { master.validate! }.message.should.
include('To setup the master specs repo, please run `pod setup`')
master = command('repo', 'add', 'foo-bar', 'https://github.com/CocoaPods/Specs.git')
should.raise(Informative) { master.validate! }.message.should.
include('To setup the master specs repo, please run `pod setup`')
end
end end
end end
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