Skip to content

Commit

Permalink
this catches the case where someone sets the git tag directly from th…
Browse files Browse the repository at this point in the history
…e version, causing an exception. CocoaPods/CocoaPods#1721
  • Loading branch information
joelparsons committed Mar 29, 2014
1 parent 76c726c commit 6983c88
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,9 @@ def _validate_source(s)
if commit && commit.downcase =~ /head/
error 'The commit of a Git source cannot be `HEAD`.'
end
if tag && !tag.include?(version)
if tag && !tag.to_s.include?(version)
warning 'The version should be included in the Git tag.'
end

if version == '0.0.1'
if commit.nil? && tag.nil?
error 'Git sources should specify either a commit or a tag.'
Expand Down
8 changes: 7 additions & 1 deletion spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,17 @@ def message_should_include(*values)
message_should_include('source', 'HEAD')
end

it "checks that the version is included in the git tag" do
it "checks that the version is included in the git tag when the version is a string" do
@spec.stubs(:version).returns(Version.new '1.0.1')
@spec.stubs(:source).returns({ :git => 'http://repo.git', :tag => '1.0' })
message_should_include('git', 'version', 'tag')
end

it "checks that the version is included in the git tag when the version is a Version" do
@spec.stubs(:version).returns(Version.new '1.0.1')
@spec.stubs(:source).returns({ :git => 'http://repo.git', :tag => (Version.new '1.0') })
message_should_include('git', 'version', 'tag')
end

it "checks that Github repositories use the `https` form (for compatibility)" do
@spec.stubs(:source).returns({ :git => 'http://github.com/repo.git', :tag => '1.0' })
Expand Down

0 comments on commit 6983c88

Please sign in to comment.