Commit 3253d72c authored by Kyle Fuller's avatar Kyle Fuller

[pod spec create] Handle repos without commits

Fixes #2803
parent 46049417
......@@ -12,6 +12,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
pre-release version that now leads to a version conflict.
[Samuel Giddins](https://github.com/segiddins)
* Provides a user friendly message when using `pod spec create` with a
repository that doesn't yet have any commits.
[Kyle Fuller](https://github.com/kylef)
[#2803](https://github.com/CocoaPods/CocoaPods/issues/2803)
## 0.35.0.rc2
......
......@@ -458,6 +458,7 @@ module Pod
branches = GitHub.branches(repo['html_url'])
master_name = repo['master_branch'] || 'master'
master = branches.find { |branch| branch['name'] == master_name }
raise Informative, "Unable to find any commits on the master branch for the repository `#{repo['html_url']}`" unless master
data[:ref_type] = ':commit'
data[:ref] = master['commit']['sha']
else
......
......@@ -118,6 +118,25 @@ module Pod
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' }
end
it "raises an informative message when the GitHub repository doesn't have any commits" do
repo = {
'name' => 'QueryKit',
'owner' => { 'login' => 'QueryKit' },
'html_url' => 'https://github.com/QueryKit/QueryKit',
'description' => 'A simple CoreData query language for Swift and Objective-C.',
'clone_url' => 'https://github.com/QueryKit/QueryKit.git',
}
GitHub.expects(:repo).with('QueryKit/QueryKit').returns(repo)
GitHub.expects(:tags).with('https://github.com/QueryKit/QueryKit').returns([])
GitHub.expects(:branches).with('https://github.com/QueryKit/QueryKit').returns([])
GitHub.expects(:user).with('QueryKit').returns('name' => 'QueryKit', 'email' => 'support@querykit.org')
e = lambda do
run_command('spec', 'create', 'https://github.com/QueryKit/QueryKit.git')
end.should.raise Pod::Informative
e.message.should.match(/Unable to find.*commits.*master branch/)
end
it "provides a markdown template if a github repo doesn't have semantic version tags" do
repo = {
'name' => 'libPusher',
......
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