Skip to content
Browse files

fixed spec or code to keep spec

  • Loading branch information...
1 parent c737360 commit bea7a179a37849e4ef09382c9c5a045296bfe65b @mkristian committed
Showing with 25 additions and 14 deletions.
  1. +13 −5 lib/ruby/maven/ruby/pom_magic.rb
  2. +4 −1 lib/ruby/maven/ruby/version.rb
  3. +8 −8 spec/pom_magic_spec.rb
View
18 lib/ruby/maven/ruby/pom_magic.rb
@@ -25,6 +25,10 @@
module Maven
module Ruby
class PomMagic
+
+ def initialize( default_pom = '.pom.xml' )
+ @default_pom = default_pom
+ end
def dump_pom( dir = '.', force = false, file = 'pom.xml' )
if force || !File.exists?( file )
@@ -96,15 +100,19 @@ def file( name, dir = '.' )
File.expand_path( File.join( dir, name ) )
end
- def pom_xml( dir = '.', proj, args )
- index = args.index( '-f' ) || args.index( '--file' )
- index ||= args.index( '--pom' )
+ def pom_xml( dir, proj, args )
+ dir ||= '.'
+ #index = args.index( '-f' ) || args.index( '--file' )
+ index = args.index( '--pom' )
name = args[ index + 1 ] if index
- pom = File.join( dir, name || '.pom.xml' )
+ pom = File.join( dir, name || @default_pom )
File.open(pom, 'w') do |f|
f.puts proj.to_xml
end
- if index
+ f_index = args.index( '-f' ) || args.index( '--file' )
+ if f_index
+ args[ f_index + 1 ] = pom
+ elsif index
args[ index ] = '-f'
else
args += ['-f', pom]
View
5 lib/ruby/maven/ruby/version.rb
@@ -20,10 +20,13 @@
#
module Maven
module Ruby
+
VERSION = '3.0.4.1.4'
+
# allow to overwrite the default from maven-tools
# since jruby-maven-plugins depend on maven-tools and
# default version in maven-tools is often behind
- JRUBY_MAVEN_PLUGINS_VERSION = '0.29.3'
+ JRUBY_MAVEN_PLUGINS_VERSION = '0.29.4'
+
end
end
View
16 spec/pom_magic_spec.rb
@@ -9,8 +9,8 @@
it 'should generate project specific pom.xml with given name' do
pom = File.expand_path( 'it/project/_pom.xml' )
- subject.generate_pom(File.join('it', 'project')).must_equal pom
- File.read(pom).must_match /<name><..CDATA.project - gem..><.name>/
+ subject.generate_pom(File.join('it', 'project')).must_equal [ '-f', pom ]
+ File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
end
@@ -28,21 +28,21 @@
it 'should generate rails specific pom.xml' do
pom = File.expand_path( 'it/rails/.pom.xml' )
- subject.generate_pom(File.join('it', 'rails')).must_equal pom
+ subject.generate_pom(File.join('it', 'rails')).must_equal ['-f', pom]
File.read(pom).must_match /<name><..CDATA.rails - rails application..><.name>/
end
it 'should generate project specific pom.xml' do
pom = File.expand_path( 'it/project/.pom.xml' )
- subject.generate_pom(File.join('it', 'project')).must_equal pom
- File.read(pom).must_match /<name><..CDATA.project - gem..><.name>/
+ subject.generate_pom(File.join('it', 'project')).must_equal ['-f', pom]
+ File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
it 'should generate project specific pom.xml using gemspec' do
pom = File.expand_path( 'it/project/.pom.xml' )
subject.generate_pom(File.join('it', 'project'),
'-f',
- 'minimal.gemspec').must_equal pom
+ 'minimal.gemspec').must_equal [ '-f', pom ]
File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
@@ -50,12 +50,12 @@
pom = File.expand_path( 'it/project/.pom.xml' )
subject.generate_pom(File.join('it', 'project'),
'-f',
- 'Gemfile2').must_equal pom
+ 'Gemfile2').must_equal [ '-f', pom ]
File.read(pom).must_match /<name><..CDATA.minimal - gem..><.name>/
end
it 'should generate project specific pom.xml without Gemfile' do
- subject.generate_pom(File.join('it', 'project_no_gemfile')).must_equal File.expand_path( 'it/project_no_gemfile/.pom.xml' )
+ subject.generate_pom(File.join('it', 'project_no_gemfile')).must_equal [ '-f', File.expand_path( 'it/project_no_gemfile/.pom.xml' ) ]
end
end

0 comments on commit bea7a17

Please sign in to comment.
Something went wrong with that request. Please try again.