diff --git a/lib/cocoapods-core/specification/linter.rb b/lib/cocoapods-core/specification/linter.rb index b0f448b93..698481142 100644 --- a/lib/cocoapods-core/specification/linter.rb +++ b/lib/cocoapods-core/specification/linter.rb @@ -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.' diff --git a/spec/specification/linter_spec.rb b/spec/specification/linter_spec.rb index 876d3db3d..d957bb178 100644 --- a/spec/specification/linter_spec.rb +++ b/spec/specification/linter_spec.rb @@ -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' })