ruby-maven 3.0.4.1.4 → 3.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/m2.conf +11 -7
- data/bin/rmvn +2 -2
- data/ext/ruby/maven-tools-0.33.0.jar +0 -0
- data/ext/ruby/tesla-polyglot-ruby-0.0.1-SNAPSHOT.jar +0 -0
- data/lib/tesla-polyglot-cli-0.0.1-SNAPSHOT.jar +0 -0
- data/lib/tesla-polyglot-common-0.0.1-SNAPSHOT.jar +0 -0
- data/{lib/ruby → ruby}/maven/ruby.rb +0 -0
- data/ruby/maven/ruby/maven.rb +199 -0
- data/ruby/maven/ruby/tasks.rb +75 -0
- data/ruby/maven/ruby/version.rb +6 -0
- data/{lib/ruby → ruby}/ruby-maven.rb +0 -0
- data/{lib/ruby → ruby}/ruby_maven.rb +0 -0
- data/ruby/tesla_maven.rb +56 -0
- metadata +42 -104
- data/LICENSE.txt +0 -202
- data/MIT-LICENSE +0 -20
- data/NOTICE.txt +0 -23
- data/README.txt +0 -77
- data/bin/mvn +0 -172
- data/bin/mvn.bat +0 -197
- data/bin/mvnDebug +0 -177
- data/bin/mvnDebug.bat +0 -200
- data/bin/mvnyjp +0 -193
- data/boot/plexus-classworlds-2.4.jar +0 -0
- data/conf/settings.xml +0 -257
- data/lib/aether-api-1.13.1.jar +0 -0
- data/lib/aether-connector-wagon-1.13.1.jar +0 -0
- data/lib/aether-impl-1.13.1.jar +0 -0
- data/lib/aether-spi-1.13.1.jar +0 -0
- data/lib/aether-util-1.13.1.jar +0 -0
- data/lib/commons-cli-1.2.jar +0 -0
- data/lib/ext/README.txt +0 -2
- data/lib/maven-aether-provider-3.0.4.jar +0 -0
- data/lib/maven-artifact-3.0.4.jar +0 -0
- data/lib/maven-compat-3.0.4.jar +0 -0
- data/lib/maven-core-3.0.4.jar +0 -0
- data/lib/maven-embedder-3.0.4.jar +0 -0
- data/lib/maven-model-3.0.4.jar +0 -0
- data/lib/maven-model-builder-3.0.4.jar +0 -0
- data/lib/maven-plugin-api-3.0.4.jar +0 -0
- data/lib/maven-repository-metadata-3.0.4.jar +0 -0
- data/lib/maven-settings-3.0.4.jar +0 -0
- data/lib/maven-settings-builder-3.0.4.jar +0 -0
- data/lib/plexus-cipher-1.7.jar +0 -0
- data/lib/plexus-component-annotations-1.5.5.jar +0 -0
- data/lib/plexus-interpolation-1.14.jar +0 -0
- data/lib/plexus-sec-dispatcher-1.3.jar +0 -0
- data/lib/plexus-utils-2.0.6.jar +0 -0
- data/lib/ruby/maven/cli.rb~ +0 -227
- data/lib/ruby/maven/cucumber_steps.rb~ +0 -134
- data/lib/ruby/maven/pom_magic.rb~ +0 -227
- data/lib/ruby/maven/ruby/Mavenfile +0 -7
- data/lib/ruby/maven/ruby/Mavenfile~ +0 -7
- data/lib/ruby/maven/ruby/cli.rb +0 -161
- data/lib/ruby/maven/ruby/cli.rb~ +0 -146
- data/lib/ruby/maven/ruby/maven.rb +0 -145
- data/lib/ruby/maven/ruby/maven.rb~ +0 -132
- data/lib/ruby/maven/ruby/pom_magic.rb +0 -132
- data/lib/ruby/maven/ruby/pom_magic.rb~ +0 -78
- data/lib/ruby/maven/ruby/version.rb +0 -32
- data/lib/ruby/maven/ruby/version.rb~ +0 -5
- data/lib/ruby/maven/ruby_cli.rb~ +0 -131
- data/lib/ruby/maven/ruby_maven.rb~ +0 -227
- data/lib/sisu-guava-0.9.9.jar +0 -0
- data/lib/sisu-guice-3.1.0-no_aop.jar +0 -0
- data/lib/sisu-inject-bean-2.3.0.jar +0 -0
- data/lib/sisu-inject-plexus-2.3.0.jar +0 -0
- data/lib/wagon-file-2.2.jar +0 -0
- data/lib/wagon-http-2.2-shaded.jar +0 -0
- data/lib/wagon-provider-api-2.2.jar +0 -0
data/lib/aether-api-1.13.1.jar
DELETED
Binary file
|
Binary file
|
data/lib/aether-impl-1.13.1.jar
DELETED
Binary file
|
data/lib/aether-spi-1.13.1.jar
DELETED
Binary file
|
data/lib/aether-util-1.13.1.jar
DELETED
Binary file
|
data/lib/commons-cli-1.2.jar
DELETED
Binary file
|
data/lib/ext/README.txt
DELETED
Binary file
|
Binary file
|
data/lib/maven-compat-3.0.4.jar
DELETED
Binary file
|
data/lib/maven-core-3.0.4.jar
DELETED
Binary file
|
Binary file
|
data/lib/maven-model-3.0.4.jar
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/plexus-cipher-1.7.jar
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/plexus-utils-2.0.6.jar
DELETED
Binary file
|
data/lib/ruby/maven/cli.rb~
DELETED
@@ -1,227 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'maven/tools/rails_project'
|
3
|
-
require 'java' if defined? JRUBY_VERSION
|
4
|
-
|
5
|
-
module Maven
|
6
|
-
class RubyMaven
|
7
|
-
|
8
|
-
# make the command line for the goals of the jruby-maven-plugins nicer
|
9
|
-
PLUGINS = {
|
10
|
-
:rake => [:rake],
|
11
|
-
:jruby => [:jruby, :compile],
|
12
|
-
:gem => [:package, :install, :push, :exec, :pom, :initialize, :irb],
|
13
|
-
:rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom, :initialize],
|
14
|
-
:cucumber => [:test],
|
15
|
-
:rspec => [:test],
|
16
|
-
:runit => [:test],
|
17
|
-
:mini => [:test,:spec],
|
18
|
-
:bundler => [:install, :update]
|
19
|
-
}
|
20
|
-
ALIASES = {
|
21
|
-
:ruby => :jruby,
|
22
|
-
:spec => :rspec,
|
23
|
-
:rails => :rails3,
|
24
|
-
:bundle => :bundler
|
25
|
-
}
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@maven_home = File.expand_path(File.join(File.dirname(__FILE__),'..','..'))
|
29
|
-
end
|
30
|
-
|
31
|
-
def launch_jruby(args)
|
32
|
-
classpath_array.each do |path|
|
33
|
-
require path
|
34
|
-
end
|
35
|
-
|
36
|
-
java.lang.System.setProperty("classworlds.conf",
|
37
|
-
File.join(@maven_home, 'bin', "m2.conf"))
|
38
|
-
|
39
|
-
java.lang.System.setProperty("maven.home", @maven_home)
|
40
|
-
|
41
|
-
org.codehaus.plexus.classworlds.launcher.Launcher.main(args)
|
42
|
-
end
|
43
|
-
|
44
|
-
def classpath_array
|
45
|
-
Dir.glob(File.join(@maven_home, "boot", "*jar")) +
|
46
|
-
Dir.glob(File.join(@maven_home, "ext", "ruby-tools*jar"))
|
47
|
-
end
|
48
|
-
|
49
|
-
def launch_java(*args)
|
50
|
-
system "java -cp #{classpath_array.join(':')} -Dmaven.home=#{File.expand_path(@maven_home)} -Dclassworlds.conf=#{File.expand_path(File.join(@maven_home, 'bin', 'm2.conf'))} org.codehaus.plexus.classworlds.launcher.Launcher #{args.join ' '}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def prepare(args)
|
54
|
-
if args.size > 0
|
55
|
-
name = args[0].to_sym
|
56
|
-
name = ALIASES[name] || name
|
57
|
-
if PLUGINS.member?(name)
|
58
|
-
start = 1
|
59
|
-
if args.size > 1
|
60
|
-
if PLUGINS[name].member? args[1].to_sym
|
61
|
-
goal = args[1].to_sym
|
62
|
-
start = 2
|
63
|
-
else
|
64
|
-
goal = PLUGINS[name][0]
|
65
|
-
end
|
66
|
-
else
|
67
|
-
goal = PLUGINS[name][0]
|
68
|
-
end
|
69
|
-
# determine the version and delete from args if given
|
70
|
-
version = args.detect do |a|
|
71
|
-
a =~ /^-Dplugin.version=/
|
72
|
-
end
|
73
|
-
version ||= options['-Dplugin.version']
|
74
|
-
|
75
|
-
if version
|
76
|
-
args.delete(version)
|
77
|
-
version = ":" + version.sub(/^-Dplugin.version=/, '')
|
78
|
-
end
|
79
|
-
aa = if index = args.index("--")
|
80
|
-
args[(index + 1)..-1]
|
81
|
-
else
|
82
|
-
[]
|
83
|
-
end
|
84
|
-
ruby_args = (args[start, (index || 1000) - start] || []).join(' ')
|
85
|
-
|
86
|
-
aa << "de.saumya.mojo:#{name}-maven-plugin#{version}:#{goal}"
|
87
|
-
aa << "-Dargs=\"#{ruby_args}\"" if ruby_args.size > 0
|
88
|
-
args.replace(aa)
|
89
|
-
else
|
90
|
-
args.delete("--")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
args
|
94
|
-
end
|
95
|
-
|
96
|
-
def log(args)
|
97
|
-
log = File.join('log', 'rmvn.log')
|
98
|
-
if File.exists? File.dirname(log)
|
99
|
-
File.open(log, 'a') do |f|
|
100
|
-
f.puts "#{$0.sub(/.*\//, '')} #{args.join ' '}"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def maybe_print_help(args)
|
106
|
-
if args.size == 0 || args[0] == "--help"
|
107
|
-
puts "usage: rmvn [<plugin-name> [<args>] [-- <maven-options>]] | [<maven-goal>|<maven-phase> <maven-options>] | --help"
|
108
|
-
PLUGINS.each do |name, goals|
|
109
|
-
puts
|
110
|
-
print "plugin #{name}"
|
111
|
-
print " - alias: #{ALIASES.invert[name]}" if ALIASES.invert[name]
|
112
|
-
puts
|
113
|
-
if goals.size > 1
|
114
|
-
print "\tgoals : #{goals.join(',')}"
|
115
|
-
puts
|
116
|
-
end
|
117
|
-
print "\tdefault goal: #{goals[0]}"
|
118
|
-
puts
|
119
|
-
end
|
120
|
-
puts
|
121
|
-
["--help"]
|
122
|
-
else
|
123
|
-
args
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def options
|
128
|
-
@options ||= {}
|
129
|
-
end
|
130
|
-
|
131
|
-
def options_string
|
132
|
-
options_array.join ' '
|
133
|
-
end
|
134
|
-
|
135
|
-
def options_array
|
136
|
-
options.collect do |k,v|
|
137
|
-
if k =~ /^-D/
|
138
|
-
v = "=#{v}" unless v.nil?
|
139
|
-
else
|
140
|
-
v = " #{v}" unless v.nil?
|
141
|
-
end
|
142
|
-
"#{k}#{v}"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def command_line(args)
|
147
|
-
args = prepare(args)
|
148
|
-
args = maybe_print_help(args)
|
149
|
-
args
|
150
|
-
end
|
151
|
-
|
152
|
-
def new_rails_project
|
153
|
-
Maven::Tools::RailsProject.new
|
154
|
-
end
|
155
|
-
|
156
|
-
def generate_pom(*args)
|
157
|
-
unless args.member?("-f") || args.member?("--file")
|
158
|
-
gemfiles = Dir["*Gemfile"]
|
159
|
-
gemfiles.delete_if {|g| g =~ /.pom/}
|
160
|
-
if gemfiles.size > 0
|
161
|
-
proj =
|
162
|
-
if File.exists? File.join( 'config', 'application.rb' )
|
163
|
-
new_rails_project
|
164
|
-
else
|
165
|
-
Maven::Tools::GemProject.new
|
166
|
-
end
|
167
|
-
filename = gemfiles[0]
|
168
|
-
proj.load_gemfile(filename)
|
169
|
-
else
|
170
|
-
gemspecs = Dir["*.gemspec"]
|
171
|
-
gemspecs.delete_if {|g| g =~ /.pom/}
|
172
|
-
if gemspecs.size > 0
|
173
|
-
proj = Maven::Tools::GemProject.new
|
174
|
-
filename = gemspecs[0]
|
175
|
-
proj.load_gemspec(filename)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
if filename
|
179
|
-
proj.load_jarfile(File.join(File.dirname(filename), 'Jarfile'))
|
180
|
-
proj.load_gemfile(File.join(File.dirname(filename), 'Mavenfile'))
|
181
|
-
proj.add_defaults
|
182
|
-
#target = File.join(File.dirname(filename), 'target')
|
183
|
-
#FileUtils.mkdir_p target
|
184
|
-
pom = ".pom.xml"
|
185
|
-
File.open(pom, 'w') do |f|
|
186
|
-
f.puts proj.to_xml
|
187
|
-
end
|
188
|
-
args << '-f'
|
189
|
-
args << pom
|
190
|
-
end
|
191
|
-
end
|
192
|
-
args
|
193
|
-
end
|
194
|
-
|
195
|
-
def exec(*args)
|
196
|
-
log(args)
|
197
|
-
a = command_line(args.dup.flatten)
|
198
|
-
verbose = options.delete('--verbose')
|
199
|
-
no_pom = options.delete('--no-pom')
|
200
|
-
a << options_array
|
201
|
-
a.flatten!
|
202
|
-
a = generate_pom(*a) unless no_pom
|
203
|
-
puts "mvn #{a.join(' ')}" if verbose
|
204
|
-
if defined? JRUBY_VERSION
|
205
|
-
# TODO use a setup like maven_gemify from jruby to launch maven
|
206
|
-
launch_java(a)
|
207
|
-
else
|
208
|
-
launch_java(a)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def exec_in(launchdirectory, *args)
|
213
|
-
succeeded = nil
|
214
|
-
FileUtils.cd(launchdirectory) do
|
215
|
-
succeeded = exec(args)
|
216
|
-
end
|
217
|
-
succeeded
|
218
|
-
end
|
219
|
-
|
220
|
-
def dump_pom(force = false, file = 'pom.xml')
|
221
|
-
if force || !File.exists?(file)
|
222
|
-
generate_pom
|
223
|
-
FileUtils.cp(".pom.xml", file)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'ruby-maven'
|
3
|
-
module Maven
|
4
|
-
class CucumberSteps
|
5
|
-
|
6
|
-
def initialize(options = {})
|
7
|
-
@options = {:ruby_version => RUBY_VERSION }
|
8
|
-
@options[:jruby_version] = JRUBY_VERSION if defined? JRUBY_VERSION
|
9
|
-
|
10
|
-
@options.merge!(options || {})
|
11
|
-
end
|
12
|
-
|
13
|
-
def rmvn
|
14
|
-
@rmvn ||= Maven::RubyMaven.new
|
15
|
-
end
|
16
|
-
|
17
|
-
def copy_tests(tests)
|
18
|
-
FileUtils.mkdir_p(@app_directory)
|
19
|
-
FileUtils.cp_r(File.join('templates', "tests-#{tests}", "."),
|
20
|
-
File.join(@app_directory, 'test'))
|
21
|
-
end
|
22
|
-
|
23
|
-
def copy_specs(specs)
|
24
|
-
FileUtils.mkdir_p(@app_directory)
|
25
|
-
FileUtils.cp_r(File.join('templates', "specs-#{specs}", "."),
|
26
|
-
File.join(@app_directory, 'spec'))
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_rails_application(template)
|
30
|
-
name = template.sub(/.template$/, '')
|
31
|
-
@app_directory = File.join('target', name)
|
32
|
-
|
33
|
-
# rails version from gemspec
|
34
|
-
gemspec = File.read(Dir.glob("*.gemspec")[0])
|
35
|
-
rails_version = gemspec.split("\n").detect { |l| l =~ /development_dep.*rails/ }.sub(/'$/, '').sub(/.*'/, '')
|
36
|
-
|
37
|
-
rmvn.options['-Dplugin.version'] = @options[:plugin_version] if @options[:plugin_version]
|
38
|
-
rmvn.options['-Djruby.version'] = @options[:jruby_version] if @options[:jruby_version]
|
39
|
-
if @options[:ruby_version]
|
40
|
-
rversion = @options[:ruby_version] =~ /^1.8./ ? '--1.8': '--1.9'
|
41
|
-
rmvn.options['-Djruby.switches'] = rversion
|
42
|
-
end
|
43
|
-
|
44
|
-
rmvn.options['-Drails.version'] = rails_version
|
45
|
-
rmvn.options['-Dgem.home'] = ENV['GEM_HOME']
|
46
|
-
rmvn.options['-Dgem.path'] = ENV['GEM_PATH']
|
47
|
-
rmvn.options['-o'] = nil
|
48
|
-
|
49
|
-
FileUtils.rm_rf(@app_directory)
|
50
|
-
|
51
|
-
template_file = File.expand_path("templates/#{template}")
|
52
|
-
rmvn.exec("rails", "new", @app_directory, "-f", '--', '-e', "-Dtemplate=#{template_file}")
|
53
|
-
end
|
54
|
-
|
55
|
-
def given_template(template)
|
56
|
-
create_rails_application(template)
|
57
|
-
end
|
58
|
-
|
59
|
-
def given_template_and_tests(template, tests)
|
60
|
-
create_rails_application(template)
|
61
|
-
copy_tests(tests)
|
62
|
-
end
|
63
|
-
|
64
|
-
def given_template_and_specs(template, specs)
|
65
|
-
create_rails_application(template)
|
66
|
-
copy_specs(specs)
|
67
|
-
end
|
68
|
-
|
69
|
-
def given_application(name)
|
70
|
-
@app_directory = File.join('target', name)
|
71
|
-
end
|
72
|
-
|
73
|
-
def given_application_and_tests(name, tests)
|
74
|
-
@app_directory = File.join('target', name)
|
75
|
-
copy_tests(tests)
|
76
|
-
end
|
77
|
-
|
78
|
-
def given_application_and_specs(name, specs)
|
79
|
-
@app_directory = File.join('target', name)
|
80
|
-
copy_specs(specs)
|
81
|
-
end
|
82
|
-
|
83
|
-
def execute(args)
|
84
|
-
rmvn.options['-l'] = "output.log"
|
85
|
-
rmvn.exec_in(@app_directory, args.split(' '))
|
86
|
-
end
|
87
|
-
|
88
|
-
def expected_output(expected)
|
89
|
-
result = File.read(File.join(@app_directory, "output.log"))
|
90
|
-
expected.split(/\"?\s+and\s+\"?/).each do |exp|
|
91
|
-
puts exp
|
92
|
-
yield(result =~ /.*#{exp}.*/)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
|
99
|
-
steps = Maven::CucumberSteps.new(:plugin_version => '0.28.5-SNAPSHOT')
|
100
|
-
|
101
|
-
Given /^I create new rails application with template "(.*)"$/ do |template|
|
102
|
-
steps.given_template(template)
|
103
|
-
end
|
104
|
-
|
105
|
-
Given /^I create new rails application with template "(.*)" and "(.*)" tests$/ do |template, tests|
|
106
|
-
steps.given_template_and_tests(template, tests)
|
107
|
-
end
|
108
|
-
|
109
|
-
Given /^I create new rails application with template "(.*)" and "(.*)" specs$/ do |template, specs|
|
110
|
-
steps.given_template_and_specs(template, specs)
|
111
|
-
end
|
112
|
-
|
113
|
-
Given /^me an existing rails application "(.*)"$/ do |name|
|
114
|
-
steps.given_application(name)
|
115
|
-
end
|
116
|
-
|
117
|
-
Given /^me an existing rails application "(.*)" and "(.*)" tests$/ do |name, tests|
|
118
|
-
steps.given_application_and_tests(name, tests)
|
119
|
-
end
|
120
|
-
|
121
|
-
Given /^me an existing rails application "(.*)" and "(.*)" specs$/ do |name, specs|
|
122
|
-
steps.given_application_and_specs(name, specs)
|
123
|
-
end
|
124
|
-
|
125
|
-
And /^I execute \"(.*)\"$/ do |args|
|
126
|
-
steps.execute(args)
|
127
|
-
end
|
128
|
-
|
129
|
-
Then /^the output should contain \"(.*)\"$/ do |expected|
|
130
|
-
steps.expected_output(expected) do |exp|
|
131
|
-
exp.should_not be_nil
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
@@ -1,227 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'maven/tools/rails_project'
|
3
|
-
require 'java' if defined? JRUBY_VERSION
|
4
|
-
|
5
|
-
module Maven
|
6
|
-
class RubyMaven
|
7
|
-
|
8
|
-
# make the command line for the goals of the jruby-maven-plugins nicer
|
9
|
-
PLUGINS = {
|
10
|
-
:rake => [:rake],
|
11
|
-
:jruby => [:jruby, :compile],
|
12
|
-
:gem => [:package, :install, :push, :exec, :pom, :initialize, :irb],
|
13
|
-
:rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom, :initialize],
|
14
|
-
:cucumber => [:test],
|
15
|
-
:rspec => [:test],
|
16
|
-
:runit => [:test],
|
17
|
-
:mini => [:test,:spec],
|
18
|
-
:bundler => [:install, :update]
|
19
|
-
}
|
20
|
-
ALIASES = {
|
21
|
-
:ruby => :jruby,
|
22
|
-
:spec => :rspec,
|
23
|
-
:rails => :rails3,
|
24
|
-
:bundle => :bundler
|
25
|
-
}
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@maven_home = File.expand_path(File.join(File.dirname(__FILE__),'..','..'))
|
29
|
-
end
|
30
|
-
|
31
|
-
def launch_jruby(args)
|
32
|
-
classpath_array.each do |path|
|
33
|
-
require path
|
34
|
-
end
|
35
|
-
|
36
|
-
java.lang.System.setProperty("classworlds.conf",
|
37
|
-
File.join(@maven_home, 'bin', "m2.conf"))
|
38
|
-
|
39
|
-
java.lang.System.setProperty("maven.home", @maven_home)
|
40
|
-
|
41
|
-
org.codehaus.plexus.classworlds.launcher.Launcher.main(args)
|
42
|
-
end
|
43
|
-
|
44
|
-
def classpath_array
|
45
|
-
Dir.glob(File.join(@maven_home, "boot", "*jar")) +
|
46
|
-
Dir.glob(File.join(@maven_home, "ext", "ruby-tools*jar"))
|
47
|
-
end
|
48
|
-
|
49
|
-
def launch_java(*args)
|
50
|
-
system "java -cp #{classpath_array.join(':')} -Dmaven.home=#{File.expand_path(@maven_home)} -Dclassworlds.conf=#{File.expand_path(File.join(@maven_home, 'bin', 'm2.conf'))} org.codehaus.plexus.classworlds.launcher.Launcher #{args.join ' '}"
|
51
|
-
end
|
52
|
-
|
53
|
-
def prepare(args)
|
54
|
-
if args.size > 0
|
55
|
-
name = args[0].to_sym
|
56
|
-
name = ALIASES[name] || name
|
57
|
-
if PLUGINS.member?(name)
|
58
|
-
start = 1
|
59
|
-
if args.size > 1
|
60
|
-
if PLUGINS[name].member? args[1].to_sym
|
61
|
-
goal = args[1].to_sym
|
62
|
-
start = 2
|
63
|
-
else
|
64
|
-
goal = PLUGINS[name][0]
|
65
|
-
end
|
66
|
-
else
|
67
|
-
goal = PLUGINS[name][0]
|
68
|
-
end
|
69
|
-
# determine the version and delete from args if given
|
70
|
-
version = args.detect do |a|
|
71
|
-
a =~ /^-Dplugin.version=/
|
72
|
-
end
|
73
|
-
version ||= options['-Dplugin.version']
|
74
|
-
|
75
|
-
if version
|
76
|
-
args.delete(version)
|
77
|
-
version = ":" + version.sub(/^-Dplugin.version=/, '')
|
78
|
-
end
|
79
|
-
aa = if index = args.index("--")
|
80
|
-
args[(index + 1)..-1]
|
81
|
-
else
|
82
|
-
[]
|
83
|
-
end
|
84
|
-
ruby_args = (args[start, (index || 1000) - start] || []).join(' ')
|
85
|
-
|
86
|
-
aa << "de.saumya.mojo:#{name}-maven-plugin#{version}:#{goal}"
|
87
|
-
aa << "-Dargs=\"#{ruby_args}\"" if ruby_args.size > 0
|
88
|
-
args.replace(aa)
|
89
|
-
else
|
90
|
-
args.delete("--")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
args
|
94
|
-
end
|
95
|
-
|
96
|
-
def log(args)
|
97
|
-
log = File.join('log', 'rmvn.log')
|
98
|
-
if File.exists? File.dirname(log)
|
99
|
-
File.open(log, 'a') do |f|
|
100
|
-
f.puts "#{$0.sub(/.*\//, '')} #{args.join ' '}"
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def maybe_print_help(args)
|
106
|
-
if args.size == 0 || args[0] == "--help"
|
107
|
-
puts "usage: rmvn [<plugin-name> [<args>] [-- <maven-options>]] | [<maven-goal>|<maven-phase> <maven-options>] | --help"
|
108
|
-
PLUGINS.each do |name, goals|
|
109
|
-
puts
|
110
|
-
print "plugin #{name}"
|
111
|
-
print " - alias: #{ALIASES.invert[name]}" if ALIASES.invert[name]
|
112
|
-
puts
|
113
|
-
if goals.size > 1
|
114
|
-
print "\tgoals : #{goals.join(',')}"
|
115
|
-
puts
|
116
|
-
end
|
117
|
-
print "\tdefault goal: #{goals[0]}"
|
118
|
-
puts
|
119
|
-
end
|
120
|
-
puts
|
121
|
-
["--help"]
|
122
|
-
else
|
123
|
-
args
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
def options
|
128
|
-
@options ||= {}
|
129
|
-
end
|
130
|
-
|
131
|
-
def options_string
|
132
|
-
options_array.join ' '
|
133
|
-
end
|
134
|
-
|
135
|
-
def options_array
|
136
|
-
options.collect do |k,v|
|
137
|
-
if k =~ /^-D/
|
138
|
-
v = "=#{v}" unless v.nil?
|
139
|
-
else
|
140
|
-
v = " #{v}" unless v.nil?
|
141
|
-
end
|
142
|
-
"#{k}#{v}"
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
def command_line(args)
|
147
|
-
args = prepare(args)
|
148
|
-
args = maybe_print_help(args)
|
149
|
-
args
|
150
|
-
end
|
151
|
-
|
152
|
-
def new_rails_project
|
153
|
-
Maven::Tools::RailsProject.new
|
154
|
-
end
|
155
|
-
|
156
|
-
def generate_pom(*args)
|
157
|
-
unless args.member?("-f") || args.member?("--file")
|
158
|
-
gemfiles = Dir["*Gemfile"]
|
159
|
-
gemfiles.delete_if {|g| g =~ /.pom/}
|
160
|
-
if gemfiles.size > 0
|
161
|
-
proj =
|
162
|
-
if File.exists? File.join( 'config', 'application.rb' )
|
163
|
-
new_rails_project
|
164
|
-
else
|
165
|
-
Maven::Tools::GemProject.new
|
166
|
-
end
|
167
|
-
filename = gemfiles[0]
|
168
|
-
proj.load_gemfile(filename)
|
169
|
-
else
|
170
|
-
gemspecs = Dir["*.gemspec"]
|
171
|
-
gemspecs.delete_if {|g| g =~ /.pom/}
|
172
|
-
if gemspecs.size > 0
|
173
|
-
proj = Maven::Tools::GemProject.new
|
174
|
-
filename = gemspecs[0]
|
175
|
-
proj.load_gemspec(filename)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
if filename
|
179
|
-
proj.load_jarfile(File.join(File.dirname(filename), 'Jarfile'))
|
180
|
-
proj.load_gemfile(File.join(File.dirname(filename), 'Mavenfile'))
|
181
|
-
proj.add_defaults
|
182
|
-
#target = File.join(File.dirname(filename), 'target')
|
183
|
-
#FileUtils.mkdir_p target
|
184
|
-
pom = ".pom.xml"
|
185
|
-
File.open(pom, 'w') do |f|
|
186
|
-
f.puts proj.to_xml
|
187
|
-
end
|
188
|
-
args << '-f'
|
189
|
-
args << pom
|
190
|
-
end
|
191
|
-
end
|
192
|
-
args
|
193
|
-
end
|
194
|
-
|
195
|
-
def exec(*args)
|
196
|
-
log(args)
|
197
|
-
a = command_line(args.dup.flatten)
|
198
|
-
verbose = options.delete('--verbose')
|
199
|
-
no_pom = options.delete('--no-pom')
|
200
|
-
a << options_array
|
201
|
-
a.flatten!
|
202
|
-
a = generate_pom(*a) unless no_pom
|
203
|
-
puts "mvn #{a.join(' ')}" if verbose
|
204
|
-
if defined? JRUBY_VERSION
|
205
|
-
# TODO use a setup like maven_gemify from jruby to launch maven
|
206
|
-
launch_java(a)
|
207
|
-
else
|
208
|
-
launch_java(a)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
def exec_in(launchdirectory, *args)
|
213
|
-
succeeded = nil
|
214
|
-
FileUtils.cd(launchdirectory) do
|
215
|
-
succeeded = exec(args)
|
216
|
-
end
|
217
|
-
succeeded
|
218
|
-
end
|
219
|
-
|
220
|
-
def dump_pom(force = false, file = 'pom.xml')
|
221
|
-
if force || !File.exists?(file)
|
222
|
-
generate_pom
|
223
|
-
FileUtils.cp(".pom.xml", file)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|