ruby-maven 3.0.3.0.28.4.1 → 3.0.3.0.28.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ruby-maven-3.0.3.0.28.5.jar +0 -0
- data/lib/ruby/maven/cucumber_steps.rb +161 -0
- data/lib/ruby/maven/tools/gem_project.rb +5 -19
- data/lib/ruby/maven/tools/pom_generator.rb +6 -4
- data/lib/ruby/maven/tools/rails_project.rb +16 -0
- data/lib/ruby/maven/tools/versions.rb +1 -1
- data/lib/ruby/ruby-maven.rb +1 -0
- data/lib/ruby/ruby_maven.rb +5 -3
- metadata +5 -2
Binary file
|
@@ -0,0 +1,161 @@
|
|
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
|
+
:remove_destination => true)
|
22
|
+
end
|
23
|
+
|
24
|
+
def copy_specs(specs)
|
25
|
+
FileUtils.mkdir_p(@app_directory)
|
26
|
+
FileUtils.cp_r(File.join('templates', "specs-#{specs}", "."),
|
27
|
+
File.join(@app_directory, 'spec'),
|
28
|
+
:remove_destination => true)
|
29
|
+
end
|
30
|
+
|
31
|
+
def copy_files(files)
|
32
|
+
FileUtils.mkdir_p(@app_directory)
|
33
|
+
FileUtils.cp_r(File.join('templates', "files-#{files}", "."),
|
34
|
+
@app_directory,
|
35
|
+
:remove_destination => true)
|
36
|
+
end
|
37
|
+
|
38
|
+
def create_rails_application(template)
|
39
|
+
name = template.sub(/.template$/, '')
|
40
|
+
@app_directory = File.join('target', name)
|
41
|
+
|
42
|
+
# rails version from gemspec
|
43
|
+
gemspec = File.read(Dir.glob("*.gemspec")[0])
|
44
|
+
rails_version = gemspec.split("\n").detect { |l| l =~ /development_dep.*rails/ }.sub(/'$/, '').sub(/.*'/, '')
|
45
|
+
|
46
|
+
rmvn.options['-Dplugin.version'] = @options[:plugin_version] if @options[:plugin_version]
|
47
|
+
rmvn.options['-Djruby.version'] = @options[:jruby_version] if @options[:jruby_version]
|
48
|
+
if @options[:ruby_version]
|
49
|
+
rversion = @options[:ruby_version] =~ /^1.8./ ? '--1.8': '--1.9'
|
50
|
+
rmvn.options['-Djruby.switches'] = rversion
|
51
|
+
end
|
52
|
+
|
53
|
+
rmvn.options['-Drails.version'] = rails_version
|
54
|
+
rmvn.options['-Dgem.home'] = ENV['GEM_HOME']
|
55
|
+
rmvn.options['-Dgem.path'] = ENV['GEM_PATH']
|
56
|
+
rmvn.options['-o'] = nil
|
57
|
+
|
58
|
+
FileUtils.rm_rf(@app_directory)
|
59
|
+
|
60
|
+
template_file = File.expand_path("templates/#{template}")
|
61
|
+
rmvn.exec("rails", "new", @app_directory, "-f", '--', '-e', "-Dtemplate=#{template_file}")
|
62
|
+
end
|
63
|
+
|
64
|
+
def given_template(template)
|
65
|
+
create_rails_application(template)
|
66
|
+
end
|
67
|
+
|
68
|
+
def given_template_and_tests(template, tests)
|
69
|
+
create_rails_application(template)
|
70
|
+
copy_tests(tests)
|
71
|
+
end
|
72
|
+
|
73
|
+
def given_template_and_specs(template, specs)
|
74
|
+
create_rails_application(template)
|
75
|
+
copy_specs(specs)
|
76
|
+
end
|
77
|
+
|
78
|
+
def given_template_and_files(template, files)
|
79
|
+
create_rails_application(template)
|
80
|
+
copy_files(files)
|
81
|
+
end
|
82
|
+
|
83
|
+
def given_application(name)
|
84
|
+
@app_directory = File.join('target', name)
|
85
|
+
end
|
86
|
+
|
87
|
+
def given_application_and_tests(name, tests)
|
88
|
+
@app_directory = File.join('target', name)
|
89
|
+
copy_tests(tests)
|
90
|
+
end
|
91
|
+
|
92
|
+
def given_application_and_specs(name, specs)
|
93
|
+
@app_directory = File.join('target', name)
|
94
|
+
copy_specs(specs)
|
95
|
+
end
|
96
|
+
|
97
|
+
def given_application_and_files(name, files)
|
98
|
+
@app_directory = File.join('target', name)
|
99
|
+
copy_files(files)
|
100
|
+
end
|
101
|
+
|
102
|
+
def execute(args)
|
103
|
+
rmvn.options['-l'] = "output.log"
|
104
|
+
rmvn.exec_in(@app_directory, args.split(' '))
|
105
|
+
end
|
106
|
+
|
107
|
+
def expected_output(expected)
|
108
|
+
result = File.read(File.join(@app_directory, "output.log"))
|
109
|
+
expected.split(/\"?\s+and\s+\"?/).each do |exp|
|
110
|
+
puts exp
|
111
|
+
yield(result =~ /.*#{exp}.*/)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
steps = Maven::CucumberSteps.new(:plugin_version => '0.28.5-SNAPSHOT')
|
119
|
+
|
120
|
+
Given /^I create new rails application with template "(.*)"$/ do |template|
|
121
|
+
steps.given_template(template)
|
122
|
+
end
|
123
|
+
|
124
|
+
Given /^I create new rails application with template "(.*)" and "(.*)" tests$/ do |template, tests|
|
125
|
+
steps.given_template_and_tests(template, tests)
|
126
|
+
end
|
127
|
+
|
128
|
+
Given /^I create new rails application with template "(.*)" and "(.*)" specs$/ do |template, specs|
|
129
|
+
steps.given_template_and_specs(template, specs)
|
130
|
+
end
|
131
|
+
|
132
|
+
Given /^I create new rails application with template "(.*)" and "(.*)" files$/ do |template, files|
|
133
|
+
steps.given_template_and_files(template, files)
|
134
|
+
end
|
135
|
+
|
136
|
+
Given /^me an existing rails application "(.*)"$/ do |name|
|
137
|
+
steps.given_application(name)
|
138
|
+
end
|
139
|
+
|
140
|
+
Given /^me an existing rails application "(.*)" and "(.*)" tests$/ do |name, tests|
|
141
|
+
steps.given_application_and_tests(name, tests)
|
142
|
+
end
|
143
|
+
|
144
|
+
Given /^me an existing rails application "(.*)" and "(.*)" specs$/ do |name, specs|
|
145
|
+
steps.given_application_and_specs(name, specs)
|
146
|
+
end
|
147
|
+
|
148
|
+
Given /^me an existing rails application "(.*)" and "(.*)" files$/ do |name, files|
|
149
|
+
steps.given_application_and_files(name, files)
|
150
|
+
end
|
151
|
+
|
152
|
+
And /^I execute \"(.*)\"$/ do |args|
|
153
|
+
steps.execute(args)
|
154
|
+
end
|
155
|
+
|
156
|
+
Then /^the output should contain \"(.*)\"$/ do |expected|
|
157
|
+
steps.expected_output(expected) do |exp|
|
158
|
+
exp.should_not be_nil
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
@@ -46,9 +46,9 @@ module Maven
|
|
46
46
|
else
|
47
47
|
spec = ::Gem::Specification.load(specfile)
|
48
48
|
loaded_files << File.expand_path(specfile)
|
49
|
+
@gemspec = specfile
|
49
50
|
end
|
50
51
|
raise "file not found '#{specfile}'" unless spec
|
51
|
-
@is_gemspec = loaded_files.size == 0
|
52
52
|
artifact_id spec.name
|
53
53
|
version spec.version
|
54
54
|
name spec.summary || "#{self.artifact_id} - gem"
|
@@ -65,6 +65,7 @@ module Maven
|
|
65
65
|
end
|
66
66
|
|
67
67
|
config = {}
|
68
|
+
add_param(config, "gemspec", @gemspec) if loaded_files.size == 1
|
68
69
|
add_param(config, "autorequire", spec.autorequire)
|
69
70
|
add_param(config, "defaultExecutable", spec.default_executable)
|
70
71
|
add_param(config, "testFiles", spec.test_files)
|
@@ -113,7 +114,8 @@ module Maven
|
|
113
114
|
end
|
114
115
|
|
115
116
|
versions = dep.requirement.requirements.collect do |req|
|
116
|
-
|
117
|
+
# use this construct to get the same result in 1.8.x and 1.9.x
|
118
|
+
req.collect{ |i| i.to_s }.join
|
117
119
|
end
|
118
120
|
gem(dep.name, versions).scope = scope
|
119
121
|
end
|
@@ -173,22 +175,6 @@ module Maven
|
|
173
175
|
|
174
176
|
repository("rubygems-prereleases").url = "http://rubygems-proxy.torquebox.org/prereleases" if has_prerelease && !repository("rubygems-prereleases").url
|
175
177
|
|
176
|
-
if !jar?("org.jruby:jruby-complete") && !jar?("org.jruby:jruby-core") && versions[:jruby_version]
|
177
|
-
minor = versions[:jruby_version].sub(/[0-9]*\./, '').sub(/\..*/, '')
|
178
|
-
|
179
|
-
#TODO once jruby-core pom is working !!!
|
180
|
-
if minor.to_i > 55 #TODO fix minor minimum version
|
181
|
-
jar("org.jruby:jruby-core", versions[:jruby_version])
|
182
|
-
jar("org.jruby:jruby-stdlib", versions[:jruby_version])
|
183
|
-
# override deps which works
|
184
|
-
jar("jline:jline", '0.9.94') if versions[:jruby_version] =~ /1.6.[1-2]/
|
185
|
-
jar("org.jruby.extras:jffi", '1.0.8', 'native') if versions[:jruby_version] =~ /1.6.[0-2]/
|
186
|
-
jar("org.jruby.extras:jaffl", '0.5.10') if versions[:jruby_version] =~ /1.6.[0-2]/
|
187
|
-
else
|
188
|
-
jar("org.jruby:jruby-complete", versions[:jruby_version])
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
178
|
# TODO go through all plugins to find out any SNAPSHOT version !!
|
193
179
|
if versions[:jruby_plugins] =~ /-SNAPSHOT$/ || properties['jruby.plugins.version'] =~ /-SNAPSHOT$/
|
194
180
|
plugin_repository("sonatype-snapshots") do |nexus|
|
@@ -339,7 +325,7 @@ module Maven
|
|
339
325
|
end
|
340
326
|
end
|
341
327
|
end
|
342
|
-
if dep && !@
|
328
|
+
if dep && !@gemspec
|
343
329
|
project = self
|
344
330
|
|
345
331
|
# first collect the missing deps it any
|
@@ -11,7 +11,8 @@ module Maven
|
|
11
11
|
proj.to_xml
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
# the dummy allows to have all three methods the same argument list
|
15
|
+
def read_gemfile(filename, plugin_version = nil, dummy = nil)
|
15
16
|
dir = File.dirname(filename)
|
16
17
|
proj =
|
17
18
|
if File.exists? File.join( dir, 'config', 'application.rb' )
|
@@ -21,16 +22,17 @@ module Maven
|
|
21
22
|
end
|
22
23
|
proj.load(filename.to_s)
|
23
24
|
proj.load(File.join(File.dirname(filename.to_s), 'Mavenfile'))
|
24
|
-
proj.add_defaults(versions(plugin_version,
|
25
|
+
proj.add_defaults(versions(plugin_version, nil))
|
25
26
|
proj.dump_loaded_file_list
|
26
27
|
proj.to_xml
|
27
28
|
end
|
28
29
|
|
29
|
-
|
30
|
+
# the dummy allows to have all three methods the same argument list
|
31
|
+
def read_gemspec(filename, plugin_version = nil, dummy = nil)
|
30
32
|
proj = Maven::Tools::GemProject.new
|
31
33
|
proj.load_gemspec(filename.to_s)
|
32
34
|
proj.load(File.join(File.dirname(filename.to_s), 'Mavenfile'))
|
33
|
-
proj.add_defaults(versions(plugin_version,
|
35
|
+
proj.add_defaults(versions(plugin_version, nil))
|
34
36
|
proj.dump_loaded_file_list
|
35
37
|
proj.to_xml
|
36
38
|
end
|
@@ -28,6 +28,22 @@ module Maven
|
|
28
28
|
versions[:jruby_rack] = '1.1.0.dev'
|
29
29
|
end
|
30
30
|
|
31
|
+
if !jar?("org.jruby:jruby-complete") && !jar?("org.jruby:jruby-core") && versions[:jruby_version]
|
32
|
+
minor = versions[:jruby_version].sub(/[0-9]*\./, '').sub(/\..*/, '')
|
33
|
+
|
34
|
+
#TODO once jruby-core pom is working !!!
|
35
|
+
if minor.to_i > 55 #TODO fix minor minimum version
|
36
|
+
jar("org.jruby:jruby-core", versions[:jruby_version])
|
37
|
+
jar("org.jruby:jruby-stdlib", versions[:jruby_version])
|
38
|
+
# override deps which works
|
39
|
+
jar("jline:jline", '0.9.94') if versions[:jruby_version] =~ /1.6.[1-2]/
|
40
|
+
jar("org.jruby.extras:jffi", '1.0.8', 'native') if versions[:jruby_version] =~ /1.6.[0-2]/
|
41
|
+
jar("org.jruby.extras:jaffl", '0.5.10') if versions[:jruby_version] =~ /1.6.[0-2]/
|
42
|
+
else
|
43
|
+
jar("org.jruby:jruby-complete", versions[:jruby_version])
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
31
47
|
jar("org.jruby.rack:jruby-rack", versions[:jruby_rack]) unless jar?("org.jruby.rack:jruby-rack")
|
32
48
|
|
33
49
|
self.properties = {
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'ruby_maven'
|
data/lib/ruby/ruby_maven.rb
CHANGED
@@ -16,7 +16,7 @@ module Maven
|
|
16
16
|
:cucumber => [:test],
|
17
17
|
:rspec => [:test],
|
18
18
|
:runit => [:test],
|
19
|
-
:bundler => [:install]
|
19
|
+
:bundler => [:install, :update]
|
20
20
|
}
|
21
21
|
ALIASES = {
|
22
22
|
:ruby => :jruby,
|
@@ -71,10 +71,11 @@ module Maven
|
|
71
71
|
version = args.detect do |a|
|
72
72
|
a =~ /^-Dplugin.version=/
|
73
73
|
end
|
74
|
+
version ||= options['-Dplugin.version']
|
74
75
|
|
75
76
|
if version
|
76
77
|
args.delete(version)
|
77
|
-
version = version.sub(/^-Dplugin.version=/, '
|
78
|
+
version = ":" + version.sub(/^-Dplugin.version=/, '')
|
78
79
|
end
|
79
80
|
aa = if index = args.index("--")
|
80
81
|
args[(index + 1)..-1]
|
@@ -193,7 +194,8 @@ module Maven
|
|
193
194
|
a = generate_pom(*a)
|
194
195
|
puts a.join ' '
|
195
196
|
if defined? JRUBY_VERSION
|
196
|
-
|
197
|
+
# TODO use a setup like maven_gemify from jruby to launch maven
|
198
|
+
launch_java(a)
|
197
199
|
else
|
198
200
|
launch_java(a)
|
199
201
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ruby-maven
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 3.0.3.0.28.
|
5
|
+
version: 3.0.3.0.28.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- mkristian
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-13 00:00:00 +05:30
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -63,6 +63,7 @@ files:
|
|
63
63
|
- lib/maven-aether-provider-3.0.3.jar
|
64
64
|
- lib/plexus-component-annotations-1.5.5.jar
|
65
65
|
- lib/wagon-http-shared-1.0-beta-7.jar
|
66
|
+
- lib/ruby-maven-3.0.3.0.28.5.jar
|
66
67
|
- lib/maven-model-builder-3.0.3.jar
|
67
68
|
- lib/maven-repository-metadata-3.0.3.jar
|
68
69
|
- lib/maven-model-3.0.3.jar
|
@@ -86,6 +87,8 @@ files:
|
|
86
87
|
- lib/plexus-sec-dispatcher-1.3.jar
|
87
88
|
- lib/ext/README.txt
|
88
89
|
- lib/ruby/ruby_maven.rb
|
90
|
+
- lib/ruby/ruby-maven.rb
|
91
|
+
- lib/ruby/maven/cucumber_steps.rb
|
89
92
|
- lib/ruby/maven/tools/execute_in_phase.rb
|
90
93
|
- lib/ruby/maven/tools/rails_project.rb
|
91
94
|
- lib/ruby/maven/tools/gem_project.rb
|