Commit e8e7e603 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4564 from Ashton-W/aw-spec-create-tag

`pod spec create` to use `s.version.to_s` as the git tag when possible
parents 6c64eeb6 ccc848ba
......@@ -60,7 +60,7 @@ module Pod
data[:author_email] = `git config --get user.email`.strip
data[:source_url] = "http://EXAMPLE/#{name}.git"
data[:ref_type] = ':tag'
data[:ref] = '0.0.1'
data[:ref] = '#{s.version}'
data
end
......@@ -100,6 +100,8 @@ module Pod
else
data[:ref_type] = ':tag'
data[:ref] = versions_tags[version]
data[:ref] = '#{s.version}' if "#{version}" == versions_tags[version]
data[:ref] = 'v#{s.version}' if "v#{version}" == versions_tags[version]
end
data
end
......
......@@ -116,6 +116,44 @@ module Pod
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :commit => '5f482b0693ac2ac1ad85d1aabc27ec7547cc0bc7' }
end
it 'correctly reuses version variable in source if matching tag is found on github' do
repo = {
'name' => 'libPusher',
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => '1.4.0' }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path)
spec.version.should == Version.new('1.4.0')
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => '1.4.0' }
File.open(path, 'r') { |f| f.read.should.include ':tag => "#{s.version}"' }
end
it 'correctly reuses version variable in source if matching tag with prefix is found on github' do
repo = {
'name' => 'libPusher',
'owner' => { 'login' => 'lukeredpath' },
'html_url' => 'https://github.com/lukeredpath/libPusher',
'description' => 'An Objective-C interface to Pusher (pusherapp.com)',
'clone_url' => 'https://github.com/lukeredpath/libPusher.git',
}
GitHub.expects(:repo).with('lukeredpath/libPusher').returns(repo)
GitHub.expects(:tags).with('https://github.com/lukeredpath/libPusher').returns([{ 'name' => 'v1.4.0' }])
GitHub.expects(:user).with('lukeredpath').returns('name' => 'Luke Redpath', 'email' => 'luke@lukeredpath.co.uk')
run_command('spec', 'create', 'https://github.com/lukeredpath/libPusher.git')
path = temporary_directory + 'libPusher.podspec'
spec = Specification.from_file(path)
spec.version.should == Version.new('1.4.0')
spec.source.should == { :git => 'https://github.com/lukeredpath/libPusher.git', :tag => 'v1.4.0' }
File.open(path, 'r') { |f| f.read.should.include ':tag => "v#{s.version}"' }
end
it "raises an informative message when the GitHub repository doesn't have any commits" do
repo = {
'name' => 'QueryKit',
......
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