class Maven::Ruby::Maven
Attributes
embedded[RW]
Public Class Methods
new( project = nil, temp_pom = nil )
click to toggle source
Calls superclass method
# File lib/maven/ruby/maven.rb, line 49 def initialize( project = nil, temp_pom = nil ) super() if project warn 'deprecated: End Of Life - just tell maven where your (ruby) pom is' begin require 'maven/tools/model' require 'maven/tools/visitor' rescue LoadError => e warn 'maven-tools gem is not a direct dependency anymore' raise e end f = File.expand_path( temp_pom || '.pom.xml' ) v = ::Maven::Tools::Visitor.new( File.open( f, 'w' ) ) # parse project and write out to temp_pom file v.accept_project( project ) # tell maven to use the generated file options[ '-f' ] = f @embedded = true end end
Public Instance Methods
<<( v )
click to toggle source
# File lib/maven/ruby/maven.rb, line 75 def <<( v ) options[ v ] = nil end
exec(*args)
click to toggle source
# File lib/maven/ruby/maven.rb, line 106 def exec(*args) mvn_args = (args + options_array) if verbose puts "mvn #{mvn_args.join(' ')}" end result = RubyMaven.exec( *mvn_args ) if @embedded and not result # TODO remove this when the embedded case is gone raise "error in executing maven #{result}" else result end end
inherit_jruby_version( version = nil )
click to toggle source
# File lib/maven/ruby/maven.rb, line 96 def inherit_jruby_version( version = nil ) if version == nil if defined? JRUBY_VERSION self['jruby.version'] = JRUBY_VERSION end elsif version self['jruby.version'] = version end end
method_missing( method, *args )
click to toggle source
# File lib/maven/ruby/maven.rb, line 121 def method_missing( method, *args ) method = method.to_s.gsub( /_/, '-' ).to_sym exec( *([ method ] + args) ) end
options()
click to toggle source
# File lib/maven/ruby/maven.rb, line 71 def options @options ||= {} end
property(key, value = nil)
click to toggle source
# File lib/maven/ruby/maven.rb, line 83 def property(key, value = nil) options["-D#{key}"] = value end
Also aliased as: []=
verbose()
click to toggle source
# File lib/maven/ruby/maven.rb, line 88 def verbose if @verbose.nil? @verbose = options.delete('-Dverbose').to_s == 'true' else @verbose end end
verbose=(v)
click to toggle source
# File lib/maven/ruby/maven.rb, line 79 def verbose= v @verbose = v end
Private Instance Methods
options_array()
click to toggle source
# File lib/maven/ruby/maven.rb, line 32 def options_array options.collect do |k,v| if k =~ /^-D/ v = "=#{v}" unless v.nil? "#{k}#{v}" else if v.nil? "#{k}" else ["#{k}", "#{v}"] end end end.flatten end