Skip to content

Commit

Permalink
it gets the version from the parent if it doesnt exit
Browse files Browse the repository at this point in the history
  • Loading branch information
calavera committed Mar 24, 2010
1 parent ee7bb76 commit f5ee4a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 52 deletions.
2 changes: 1 addition & 1 deletion lib/maven_gem/pom_spec.rb
Expand Up @@ -65,7 +65,7 @@ def self.parse_pom(pom_doc, options = {})

pom.group = xpath_group(document)
pom.artifact = xpath_text(document, '/project/artifactId')
pom.maven_version = xpath_text(document, '/project/version')
pom.maven_version = xpath_text(document, '/project/version') || xpath_text(document, '/project/parent/version')
pom.version = maven_to_gem_version(pom.maven_version)
pom.description = xpath_text(document, '/project/description')
pom.url = xpath_text(document, '/project/url')
Expand Down
51 changes: 0 additions & 51 deletions maven_gem.gemspec

This file was deleted.

8 changes: 8 additions & 0 deletions spec/maven_gem/pom_spec_spec.rb
Expand Up @@ -111,6 +111,14 @@
pom.jar_file.should == 'ant-1.6.6-SNAPSHOT.jar'
pom.gem_file.should == 'ant.ant-1.6.6-java.gem'
end

it "uses the version from the parent when its version doesn't exit" do
pom = MavenGem::PomFetcher.fetch(File.join(FIXTURES, 'hudson-rake.pom'))
pom_without_version = pom.gsub(/<version>1.7-SNAPSHOT<\/version>/, '')

pom_spec = MavenGem::PomSpec.parse_pom(pom_without_version)
pom_spec.version.should == '1.319'
end
end

describe "generate_spec" do
Expand Down

0 comments on commit f5ee4a1

Please sign in to comment.