Class: Maven::Ruby::Maven
- Inherits:
-
Object
- Object
- Maven::Ruby::Maven
show all
- Defined in:
- lib/maven/ruby/maven.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(project = nil, temp_pom = nil) ⇒ Maven
Returns a new instance of Maven.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# 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' ) )
v.accept_project( project )
options[ '-f' ] = f
@embedded = true
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
121
122
123
124
|
# File 'lib/maven/ruby/maven.rb', line 121
def method_missing( method, *args )
method = method.to_s.gsub( /_/, '-' ).to_sym
exec( *([ method ] + args) )
end
|
Instance Attribute Details
#embedded ⇒ Object
Returns the value of attribute embedded.
28
29
30
|
# File 'lib/maven/ruby/maven.rb', line 28
def embedded
@embedded
end
|
Instance Method Details
#<<(v) ⇒ Object
75
76
77
|
# File 'lib/maven/ruby/maven.rb', line 75
def <<( v )
options[ v ] = nil
end
|
#exec(*args) ⇒ Object
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# 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
raise "error in executing maven #{result}"
else
result
end
end
|
#inherit_jruby_version(version = nil) ⇒ Object
96
97
98
99
100
101
102
103
104
|
# 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
|
#options ⇒ Object
71
72
73
|
# File 'lib/maven/ruby/maven.rb', line 71
def options
@options ||= {}
end
|
#property(key, value = nil) ⇒ Object
Also known as:
[]=
83
84
85
|
# File 'lib/maven/ruby/maven.rb', line 83
def property(key, value = nil)
options["-D#{key}"] = value
end
|
#verbose ⇒ Object
88
89
90
91
92
93
94
|
# 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) ⇒ Object
79
80
81
|
# File 'lib/maven/ruby/maven.rb', line 79
def verbose= v
@verbose = v
end
|