Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes exception when git tag is a Version #72

Merged
merged 1 commit into from
Mar 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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