rmaven 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rmaven +3 -0
- data/lib/maven.rb +418 -0
- data/lib/rmaven.rb +3 -0
- data/lib/tasks/mvn.rb +160 -0
- metadata +56 -0
data/bin/rmaven
ADDED
data/lib/maven.rb
ADDED
@@ -0,0 +1,418 @@
|
|
1
|
+
require "enumerator"
|
2
|
+
require "rexml/document"
|
3
|
+
|
4
|
+
class String
|
5
|
+
def java_style
|
6
|
+
str = split('_').map{|s| s[0..0].upcase + s[1..-1].downcase }.join
|
7
|
+
str[0..0].downcase + str[1..-1]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module Maven
|
12
|
+
module IgnoreNilElement
|
13
|
+
def text_value(*tags)
|
14
|
+
text_node = nil
|
15
|
+
tags.each do |tag|
|
16
|
+
text_node = get_text(tag)
|
17
|
+
break if text_node
|
18
|
+
end
|
19
|
+
text_node ? text_node.value : nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
DEFAULT_PROJECT_SETTINGS = "mvn_projects.yml"
|
25
|
+
|
26
|
+
def self.create_project(filename, settings = nil)
|
27
|
+
if filename.is_a?(Hash)
|
28
|
+
Project.new("unnamed", filename)
|
29
|
+
elsif /\.xml\Z/i =~ filename
|
30
|
+
raise ArgumentError, "#{filename} not found" unless File.exist?(filename)
|
31
|
+
open(filename) do |f|
|
32
|
+
pom = REXML::Document.new(f)
|
33
|
+
pom.elements.each("project") do |proj|
|
34
|
+
proj.extend(IgnoreNilElement)
|
35
|
+
settings = {
|
36
|
+
'rake_prefix' => 'mvn',
|
37
|
+
'pom_dir' => File.dirname(filename).gsub(/[\\\/]/, '_')
|
38
|
+
}.update(settings || {})
|
39
|
+
settings.update({
|
40
|
+
'group_id' => proj.text_value('groupId'),
|
41
|
+
'artifact_id' => proj.text_value('artifactId')
|
42
|
+
})
|
43
|
+
return Project.new(proj.text_value('name', 'artifactId'), settings)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
else
|
47
|
+
raise ArgumentError, "unsupported file: #{filename}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.create_projects(settings)
|
52
|
+
settings.map do |name, setting|
|
53
|
+
Project.new(name, setting)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# maven2 plugins
|
58
|
+
# see http://maven.apache.org/plugins/index.html
|
59
|
+
PLUGINS =
|
60
|
+
# core plugins
|
61
|
+
%w(clean compiler deploy install resources site surefire verifier) +
|
62
|
+
# packaging types / tools
|
63
|
+
%w(ear ejb jar rar war shade) +
|
64
|
+
# reporting
|
65
|
+
%w(changelog changes checkstyle clover doap docck javadoc jxr pmd project-info-reports surefire-report) +
|
66
|
+
# tools
|
67
|
+
%w(ant antrun archetype assembly dependency enforcer gpg help invoker one patch plugin release remote-resources repository scm source stage) +
|
68
|
+
# IDEs
|
69
|
+
%w(eclipse idea) +
|
70
|
+
# Outside The Maven Land
|
71
|
+
%w(build-helper castor javacc jdepend native sql taglist) +
|
72
|
+
# A number of other projects provide their own Maven plugins. This includes
|
73
|
+
%w(cargo jaxme jetty jalopy)
|
74
|
+
|
75
|
+
# http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
|
76
|
+
LIFECYCLES =
|
77
|
+
[
|
78
|
+
# Clean Lifecycle
|
79
|
+
{ :name => "pre-clean", :desc => "executes processes needed prior to the actual project cleaning"},
|
80
|
+
{ :name => "clean", :desc => "remove all files generated by the previous build"},
|
81
|
+
{ :name => "post-clean", :desc => "executes processes needed to finalize the project cleaning"},
|
82
|
+
# Default Lifecycle
|
83
|
+
{ :name => "validate", :desc => "validate the project is correct and all necessary information is available."},
|
84
|
+
{ :name => "generate-sources", :desc => "generate any source code for inclusion in compilation."},
|
85
|
+
{ :name => "process-sources", :hidden => true, :desc => "process the source code, for example to filter any values."},
|
86
|
+
{ :name => "generate-resources", :desc => "generate resources for inclusion in the package."},
|
87
|
+
{ :name => "process-resources", :hidden => true, :desc => "copy and process the resources into the destination directory, ready for packaging."},
|
88
|
+
{ :name => "compile", :desc => "compile the source code of the project."},
|
89
|
+
{ :name => "process-classes", :hidden => true, :desc => "post-process the generated files from compilation, for example to do bytecode enhancement on Java classes."},
|
90
|
+
{ :name => "generate-test-sources", :desc => "generate any test source code for inclusion in compilation."},
|
91
|
+
{ :name => "process-test-sources", :hidden => true, :desc => "process the test source code, for example to filter any values."},
|
92
|
+
{ :name => "generate-test-resources", :desc => "create resources for testing."},
|
93
|
+
{ :name => "process-test-resources", :hidden => true, :desc => "copy and process the resources into the test destination directory."},
|
94
|
+
{ :name => "test-compile", :desc => "compile the test source code into the test destination directory"},
|
95
|
+
{ :name => "process-test-classes", :hidden => true, :desc => "post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes. For Maven 2.0.5 and above."},
|
96
|
+
{ :name => "test", :desc => "run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed."},
|
97
|
+
{ :name => "prepare-package", :hidden => true, :desc => "perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above)"},
|
98
|
+
{ :name => "package", :desc => "take the compiled code and package it in its distributable format, such as a JAR."},
|
99
|
+
{ :name => "pre-integration-test", :hidden => true, :desc => "perform actions required before integration tests are executed. This may involve things such as setting up the required environment."},
|
100
|
+
{ :name => "integration-test", :desc => "process and deploy the package if necessary into an environment where integration tests can be run."},
|
101
|
+
{ :name => "post-integration-test", :hidden => true, :desc => "perform actions required after integration tests have been executed. This may including cleaning up the environment."},
|
102
|
+
{ :name => "verify", :desc => "run any checks to verify the package is valid and meets quality criteria."},
|
103
|
+
{ :name => "install", :desc => "install the package into the local repository, for use as a dependency in other projects locally."},
|
104
|
+
{ :name => "deploy", :desc => "done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects."},
|
105
|
+
# Site Lifecycle
|
106
|
+
{ :name => "pre-site", :hidden => true, :desc => "executes processes needed prior to the actual project site generation"},
|
107
|
+
{ :name => "site", :desc => "generates the project's site documentation"},
|
108
|
+
{ :name => "post-site", :hidden => true, :desc => "executes processes needed to finalize the site generation, and to prepare for site deployment"},
|
109
|
+
{ :name => "site-deploy", :desc => "deploys the generated site documentation to the specified web server"}
|
110
|
+
]
|
111
|
+
|
112
|
+
LIFECYCLE_BIDINGS = {
|
113
|
+
# Clean Lifecycle Bindings
|
114
|
+
"clean" => "clean:clean",
|
115
|
+
# Default Lifecycle Bindings - Packaging ejb / ejb3 / jar / par / rar / war
|
116
|
+
"process-resources" => "resources:resources",
|
117
|
+
"compile" => "compiler:compile",
|
118
|
+
"process-test-resources" => "resources:testResource",
|
119
|
+
"test-compile" => "compiler:testCompile",
|
120
|
+
"test" => "surefire:test",
|
121
|
+
"package" => "ejb:ejb or ejb3:ejb3 or jar:jar or par:par or rar:rar or war:war",
|
122
|
+
"install" => "install:install",
|
123
|
+
"deploy" => "deploy:deploy",
|
124
|
+
# Default Lifecycle Bindings - Packaging ear
|
125
|
+
"generate-resources" => "ear:generateApplicationXml",
|
126
|
+
"process-resources" => "resources:resources",
|
127
|
+
"package" => "ear:ear",
|
128
|
+
"install" => "install:install",
|
129
|
+
"deploy" => "deploy:deploy",
|
130
|
+
# Default Lifecycle Bindings - Packaging maven-plugin
|
131
|
+
"generate-resources" => "plugin:descriptor",
|
132
|
+
"process-resources" => "resources:resources",
|
133
|
+
"compile" => "compiler:compile",
|
134
|
+
"process-test-resources" => "resources:testResource",
|
135
|
+
"test-compile" => "compiler:testCompile",
|
136
|
+
"test" => "surefire:test",
|
137
|
+
"package" => "jar:jar and plugin:addPluginArtifactMetadata",
|
138
|
+
"install" => "install:install and plugin:updateRegistry",
|
139
|
+
"deploy" => "deploy:deploy",
|
140
|
+
# Default Lifecycle Bindings - Packaging pom
|
141
|
+
"package" => "site:attach-descriptor",
|
142
|
+
"install" => "install:install",
|
143
|
+
"deploy" => "deploy:deploy",
|
144
|
+
# Site Lifecycle Bindings",
|
145
|
+
"site" => "site:site",
|
146
|
+
"site-deploy" => "site:deploy"
|
147
|
+
}
|
148
|
+
|
149
|
+
LIFECYCLES.each do |lifecycle|
|
150
|
+
if binding = LIFECYCLE_BIDINGS[lifecycle[:name]]
|
151
|
+
lifecycle[:binding] = binding
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
DEFAULT_MVN_PLUGINS_SETTING = "mvn_plugins.yml"
|
157
|
+
|
158
|
+
class Project
|
159
|
+
attr_accessor :group_id
|
160
|
+
attr_accessor :artifact_id
|
161
|
+
|
162
|
+
attr_accessor :name
|
163
|
+
attr_accessor :pom_dir
|
164
|
+
attr_accessor :rake_prefix
|
165
|
+
attr_accessor :plugin_settings
|
166
|
+
attr_accessor :verbose
|
167
|
+
|
168
|
+
def initialize(name, settings)
|
169
|
+
self.name = name
|
170
|
+
self.verbose = false
|
171
|
+
settings.each do |key, value|
|
172
|
+
send("#{key}=", value)
|
173
|
+
end
|
174
|
+
@pom_dir||= name.dup
|
175
|
+
@rake_prefix ||= "java"
|
176
|
+
@plugin_settings ||= DEFAULT_MVN_PLUGINS_SETTING
|
177
|
+
end
|
178
|
+
|
179
|
+
def plugin_setting_path
|
180
|
+
File.join(pom_dir, plugin_settings)
|
181
|
+
end
|
182
|
+
|
183
|
+
def archetype_create_args
|
184
|
+
%w(group_id artifact_id).map do |key|
|
185
|
+
"#{key}=#{send(key)}"
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def select_plugins(*args)
|
190
|
+
plugins = YAML.load_file(plugin_setting_path).sort
|
191
|
+
args.each do |arg|
|
192
|
+
regexp = Regexp.new(arg)
|
193
|
+
plugins = plugins.select{|plugin| plugin =~ regexp}
|
194
|
+
end
|
195
|
+
plugins
|
196
|
+
end
|
197
|
+
|
198
|
+
def execute_without_cd(goal, mvn_args = nil, &block)
|
199
|
+
unless mvn_args
|
200
|
+
mvn_args = ARGV.dup
|
201
|
+
mvn_args.shift
|
202
|
+
end
|
203
|
+
command = "mvn #{goal} " + mvn_args.map do |arg|
|
204
|
+
key, value = *arg.split('=', 2)
|
205
|
+
"-D#{key.java_style}=#{value}"
|
206
|
+
end.join(" ")
|
207
|
+
block ||= lambda{|f| puts f.read }
|
208
|
+
puts(command) if verbose
|
209
|
+
open("|#{command}", "r", &block)
|
210
|
+
end
|
211
|
+
|
212
|
+
def execute_with_cd(goal, mvn_args = nil, &block)
|
213
|
+
FileUtils.cd(pom_dir, :verbose => verbose) do
|
214
|
+
unless File.exist?("pom.xml")
|
215
|
+
raise "You must execute 'rake mvn:create' before #{ARGV.join(' ')}"
|
216
|
+
end
|
217
|
+
execute_without_cd(goal, mvn_args, &block)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def execute(goal, mvn_args = nil, &block)
|
222
|
+
execute_with_cd(goal, mvn_args, &block)
|
223
|
+
end
|
224
|
+
|
225
|
+
def plugin(plugin_name)
|
226
|
+
lines = nil
|
227
|
+
execute("help:describe", ["plugin=#{plugin_name}", "full=true"]) do |f|
|
228
|
+
lines = f.readlines
|
229
|
+
end
|
230
|
+
lines.each{|line| line.chomp!}
|
231
|
+
if lines.any?{|line| /^\ERROR\]/ =~ line}
|
232
|
+
raise lines.join
|
233
|
+
return nil
|
234
|
+
end
|
235
|
+
plugin = Plugin.new(plugin_name)
|
236
|
+
lines.inject(plugin) do |current, line|
|
237
|
+
current.process(line)
|
238
|
+
end
|
239
|
+
plugin.prepare
|
240
|
+
plugin
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
class Skipper
|
245
|
+
def initialize(pattern, source)
|
246
|
+
@pattern = pattern
|
247
|
+
@source = source
|
248
|
+
end
|
249
|
+
|
250
|
+
def process(line)
|
251
|
+
@pattern =~ line ? @source : self
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class Base
|
256
|
+
attr_accessor :parent
|
257
|
+
|
258
|
+
def skip_to(pattern, status)
|
259
|
+
@status = status
|
260
|
+
Skipper.new(pattern, self)
|
261
|
+
end
|
262
|
+
|
263
|
+
def until(line, pattern, next_status, result = nil, &block)
|
264
|
+
if pattern =~ line
|
265
|
+
@status = next_status
|
266
|
+
else
|
267
|
+
yield
|
268
|
+
end
|
269
|
+
result || self
|
270
|
+
end
|
271
|
+
|
272
|
+
def prepare
|
273
|
+
remove_instance_variable(:@status) unless @status.nil?
|
274
|
+
@description = (@description || []).select{|line| !line.nil? and line != ""}
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
class Plugin < Base
|
279
|
+
attr_accessor :name, :description
|
280
|
+
attr_accessor :group_id, :artifact_id, :version, :goal_prefix
|
281
|
+
attr_accessor :goals
|
282
|
+
|
283
|
+
def initialize(name)
|
284
|
+
@name = name
|
285
|
+
end
|
286
|
+
|
287
|
+
def prepare
|
288
|
+
super
|
289
|
+
goals.each{|goal| goal.prepare}
|
290
|
+
end
|
291
|
+
|
292
|
+
def process(line)
|
293
|
+
case @status || :none
|
294
|
+
when :none
|
295
|
+
skip_to(/^#{'-' * 40}/, :header)
|
296
|
+
when :header
|
297
|
+
self.until(line, /^Description\:/, :description) do
|
298
|
+
key, value = *line.split(':', 2)
|
299
|
+
words = *key.split(' ')
|
300
|
+
send("#{words.map{|s|s.downcase}.join('_')}=", value.strip)
|
301
|
+
end
|
302
|
+
when :description
|
303
|
+
self.until(line, /^Mojos\:/, :to_mojos) do
|
304
|
+
self.description ||= []
|
305
|
+
self.description << line.strip
|
306
|
+
end
|
307
|
+
when :to_mojos
|
308
|
+
skip_to(/^#{'=' * 40}/, :goals)
|
309
|
+
when :goals
|
310
|
+
if /^Goal\: \'(.*)\'/ =~ line
|
311
|
+
goal = Goal.new(self, $1)
|
312
|
+
self.goals ||= []
|
313
|
+
self.goals << goal
|
314
|
+
goal
|
315
|
+
else
|
316
|
+
self
|
317
|
+
end
|
318
|
+
else
|
319
|
+
raise "unimplemented"
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
class Goal < Base
|
325
|
+
attr_accessor :name, :description
|
326
|
+
attr_accessor :implementation, :language
|
327
|
+
attr_accessor :parameters
|
328
|
+
|
329
|
+
def initialize(parent, name)
|
330
|
+
@parent = parent
|
331
|
+
@name = name.strip
|
332
|
+
end
|
333
|
+
|
334
|
+
def prepare
|
335
|
+
super
|
336
|
+
parameters.each{|parameter| parameter.prepare}
|
337
|
+
end
|
338
|
+
|
339
|
+
def process(line)
|
340
|
+
case @status || :none
|
341
|
+
when :none
|
342
|
+
skip_to(/^Description\:/, :description)
|
343
|
+
when :description
|
344
|
+
if /^Implementation\: (.*?)$/ =~ line
|
345
|
+
self.implementation = $1.strip
|
346
|
+
@status = :language
|
347
|
+
else
|
348
|
+
self.description ||= []
|
349
|
+
self.description << line.strip
|
350
|
+
end
|
351
|
+
self
|
352
|
+
when :language
|
353
|
+
key, value = *line.split(": ", 2)
|
354
|
+
self.language = value.strip
|
355
|
+
@status = :parameters
|
356
|
+
skip_to(/^Parameters\:/, :parameters)
|
357
|
+
when :parameters
|
358
|
+
if line.strip == ""
|
359
|
+
self
|
360
|
+
elsif /^#{'=' * 40}/ =~ line
|
361
|
+
parent
|
362
|
+
else
|
363
|
+
new_parameter
|
364
|
+
end
|
365
|
+
else
|
366
|
+
raise "unimplemented"
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
def new_parameter
|
371
|
+
parameter = Parameter.new(self)
|
372
|
+
self.parameters ||= []
|
373
|
+
self.parameters << parameter
|
374
|
+
parameter
|
375
|
+
end
|
376
|
+
end
|
377
|
+
|
378
|
+
class Parameter < Base
|
379
|
+
attr_accessor :name, :description
|
380
|
+
attr_accessor :index, :type, :required, :directly_editable
|
381
|
+
|
382
|
+
def initialize(parent)
|
383
|
+
@parent = parent
|
384
|
+
end
|
385
|
+
|
386
|
+
def process(line)
|
387
|
+
return parent if /^#{'=' * 40}/ =~ line
|
388
|
+
case @status || :none
|
389
|
+
when :none
|
390
|
+
if /\[(\d+?)\] Name: (.*)/ =~ line
|
391
|
+
@index = $1.to_i
|
392
|
+
@name = $2.strip
|
393
|
+
@status = :attributes
|
394
|
+
end
|
395
|
+
self
|
396
|
+
when :attributes
|
397
|
+
self.until(line, /^Description\:/, :description) do
|
398
|
+
key, value = *line.split(':', 2)
|
399
|
+
words = *key.split(' ')
|
400
|
+
send("#{words.map{|s|s.downcase}.join('_')}=", value.strip)
|
401
|
+
end
|
402
|
+
self
|
403
|
+
when :description
|
404
|
+
if /^#{'-' * 40}/ =~ line
|
405
|
+
parent.new_parameter
|
406
|
+
else
|
407
|
+
self.description ||= []
|
408
|
+
self.description << line.strip
|
409
|
+
self
|
410
|
+
end
|
411
|
+
else
|
412
|
+
raise "unimplemented"
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
end
|
417
|
+
|
418
|
+
end
|
data/lib/rmaven.rb
ADDED
data/lib/tasks/mvn.rb
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require "fileutils"
|
3
|
+
require "yaml"
|
4
|
+
require File.join(File.dirname(__FILE__), "..", "maven")
|
5
|
+
|
6
|
+
def build_args_hash
|
7
|
+
args = ARGV.dup
|
8
|
+
args.shift
|
9
|
+
args.inject({}) do |dest, arg|
|
10
|
+
key, value = *arg.split("=", 2)
|
11
|
+
dest[key] = value
|
12
|
+
dest
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def show_file(*paths)
|
17
|
+
open(File.join(File.dirname(__FILE__), '..', *paths)) do |f|
|
18
|
+
puts f.read
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
ARGV_HASH = build_args_hash
|
24
|
+
ARGV_KEY_IGNORED = ARGV_HASH.map{|key, value| value || key}
|
25
|
+
|
26
|
+
RMAVEN_SETTING_YAML = 'rmaven.yml'
|
27
|
+
|
28
|
+
desc "show help about mvn task"
|
29
|
+
task :mvn do
|
30
|
+
show_file('USAGE.txt')
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :mvn do
|
34
|
+
desc "show usage"
|
35
|
+
task :usage do
|
36
|
+
show_file('USAGE.txt')
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "generate example setting yaml for rmaven"
|
40
|
+
task :generate_yaml do
|
41
|
+
File.open(RMAVEN_SETTING_YAML, 'w') do |f|
|
42
|
+
YAML.dump(
|
43
|
+
{'sub_project_name' =>
|
44
|
+
{
|
45
|
+
'pom_dir' => 'proj1',
|
46
|
+
'rake_prefix' => 'proj1',
|
47
|
+
'group_id' => 'your.organization.id',
|
48
|
+
'artifact_id' => 'proj1'
|
49
|
+
}
|
50
|
+
}, f)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
poms = nil
|
57
|
+
if File.exist?('rmaven.yml')
|
58
|
+
open('rmaven.yml') do |f|
|
59
|
+
poms = YAML.load(f)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if File.exist?('pom.xml')
|
64
|
+
poms['java'] = {'pom' => 'pom.xml'}
|
65
|
+
end
|
66
|
+
|
67
|
+
(poms || {}).each do |project_name, settings|
|
68
|
+
filename = settings['pom']
|
69
|
+
filename ||= File.join(*(project_name.split('/') + ['pom.xml']))
|
70
|
+
unless File.exist?(filename)
|
71
|
+
project = Maven::Project.new(project_name, settings)
|
72
|
+
namespace project.rake_prefix do
|
73
|
+
desc "create mavenized java project in directory '#{project.pom_dir}'"
|
74
|
+
task :create do
|
75
|
+
project.execute_without_cd("archetype:create", project.archetype_create_args)
|
76
|
+
FileUtils.mv(project.artifact_id, project.pom_dir, :verbose => project.verbose)
|
77
|
+
open(project.plugin_setting_path, "w") do |f|
|
78
|
+
YAML.dump(Maven::PLUGINS, f)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
next
|
83
|
+
end
|
84
|
+
|
85
|
+
project = Maven.create_project(filename, settings)
|
86
|
+
|
87
|
+
namespace project.rake_prefix do
|
88
|
+
Maven::LIFECYCLES.each do |lifecycle|
|
89
|
+
binding = lifecycle[:binding]
|
90
|
+
binding = ". [binding] #{binding}" if binding
|
91
|
+
desc "#{lifecycle[:desc]}#{binding}" unless lifecycle[:hidden]
|
92
|
+
task lifecycle[:name].to_sym do
|
93
|
+
project.execute(lifecycle[:name])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "list mvn plugins. USAGE: rake mvn:plugins [any_key=<plugin_name>]"
|
98
|
+
task :plugin do
|
99
|
+
plugins = project.select_plugins(*ARGV_KEY_IGNORED)
|
100
|
+
if plugins.empty?
|
101
|
+
puts "No mvn plugin matched. "
|
102
|
+
elsif plugins.length == 1
|
103
|
+
plugin = plugins.first
|
104
|
+
project.execute("help:describe", ["plugin=#{plugin}"])
|
105
|
+
puts "you can get details more:"
|
106
|
+
puts " rake mvn:plugin:goal plugin=#{plugin}"
|
107
|
+
puts "or"
|
108
|
+
puts " rake mvn:plugin:params plugin=#{plugin}"
|
109
|
+
else
|
110
|
+
puts "#{ARGV_KEY_IGNORED.empty? ? 'known' : 'matched'} plugins are:"
|
111
|
+
puts plugins.join(" ")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
namespace :plugin do
|
116
|
+
desc "execute mvn plugin. USAGE: rake mvn:plugins:execute plugin=<plugin_name> goal=<goal_name>"
|
117
|
+
task :execute do
|
118
|
+
hash = ARGV_HASH
|
119
|
+
plugin = hash.delete("plugin")
|
120
|
+
goal = hash.delete("goal")
|
121
|
+
project.execute("#{plugin}:#{goal}", hash.map{|key, value| "#{key}=#{value}"})
|
122
|
+
end
|
123
|
+
|
124
|
+
desc "search remote plugin and show the help . USAGE: rake mvn:plugins:detect plugin=<plugin_name> [goal=<goal_name>]"
|
125
|
+
task :detect do
|
126
|
+
project.execute("help:describe", ARGV_HASH.map{|key, value| "#{key}=#{value}"})
|
127
|
+
end
|
128
|
+
|
129
|
+
desc "show mvn plugins medium help. USAGE: rake mvn:plugins:goals plugin=<plugin_name>"
|
130
|
+
task :goals do
|
131
|
+
plugins = project.select_plugins(*ARGV_KEY_IGNORED)
|
132
|
+
if plugins.empty?
|
133
|
+
puts "No mvn plugin found. if you know the exact name, rake mvn:plugins:detect plugin=<plugin_name>. or check your #{project.plugin_setting_path}"
|
134
|
+
else
|
135
|
+
plugins.each do |plugin|
|
136
|
+
project.execute("help:describe", ["plugin=#{plugin}", "medium=true"])
|
137
|
+
puts "- " * 20
|
138
|
+
end
|
139
|
+
puts "you can get details more:"
|
140
|
+
puts " rake mvn:plugin:params plugin=<plugin_name> goal=<goal_name>"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "show mvn plugins full help. USAGE: rake mvn:plugins:goals plugin=<plugin_name>"
|
145
|
+
task :params do
|
146
|
+
plugins = project.select_plugins(*ARGV_KEY_IGNORED)
|
147
|
+
if plugins.empty?
|
148
|
+
puts "No mvn plugin found. if you know the exact name, rake mvn:plugins:detect plugin=<plugin_name>. or check your #{project.plugin_setting_path}"
|
149
|
+
else
|
150
|
+
plugins.each do |plugin|
|
151
|
+
project.execute("help:describe", ["plugin=#{plugin}", "full=true"])
|
152
|
+
puts "- " * 20
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rmaven
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takeshi Akima
|
8
|
+
autorequire: rmaven
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-06 00:00:00 +09:00
|
13
|
+
default_executable: rmaven
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: rubeus@googlegroups.com
|
18
|
+
executables:
|
19
|
+
- rmaven
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- bin/rmaven
|
26
|
+
- lib/maven.rb
|
27
|
+
- lib/rmaven.rb
|
28
|
+
- lib/tasks/mvn.rb
|
29
|
+
has_rdoc: false
|
30
|
+
homepage: http://code.google.com/p/rubeus/
|
31
|
+
post_install_message:
|
32
|
+
rdoc_options: []
|
33
|
+
|
34
|
+
require_paths:
|
35
|
+
- lib
|
36
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: "0"
|
41
|
+
version:
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
requirements:
|
49
|
+
- none
|
50
|
+
rubyforge_project: rubybizcommons
|
51
|
+
rubygems_version: 1.1.1
|
52
|
+
signing_key:
|
53
|
+
specification_version: 2
|
54
|
+
summary: RMaven enables using maven through rake
|
55
|
+
test_files: []
|
56
|
+
|