ruby-maven 3.0.3.0.28.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +202 -0
- data/NOTICE.txt +23 -0
- data/README.txt +77 -0
- data/bin/gwt +59 -0
- data/bin/jetty-run +25 -0
- data/bin/m2.conf +7 -0
- data/bin/mvn +172 -0
- data/bin/mvn.bat +197 -0
- data/bin/mvnDebug +177 -0
- data/bin/mvnDebug.bat +200 -0
- data/bin/mvnyjp +193 -0
- data/bin/rmvn +9 -0
- data/bin/tomcat-run +25 -0
- data/boot/plexus-classworlds-2.4.jar +0 -0
- data/conf/settings.xml +257 -0
- data/lib/aether-api-1.11.jar +0 -0
- data/lib/aether-connector-wagon-1.11.jar +0 -0
- data/lib/aether-impl-1.11.jar +0 -0
- data/lib/aether-spi-1.11.jar +0 -0
- data/lib/aether-util-1.11.jar +0 -0
- data/lib/commons-cli-1.2.jar +0 -0
- data/lib/ext/README.txt +2 -0
- data/lib/maven-aether-provider-3.0.3.jar +0 -0
- data/lib/maven-artifact-3.0.3.jar +0 -0
- data/lib/maven-compat-3.0.3.jar +0 -0
- data/lib/maven-core-3.0.3.jar +0 -0
- data/lib/maven-embedder-3.0.3.jar +0 -0
- data/lib/maven-model-3.0.3.jar +0 -0
- data/lib/maven-model-builder-3.0.3.jar +0 -0
- data/lib/maven-plugin-api-3.0.3.jar +0 -0
- data/lib/maven-repository-metadata-3.0.3.jar +0 -0
- data/lib/maven-settings-3.0.3.jar +0 -0
- data/lib/maven-settings-builder-3.0.3.jar +0 -0
- data/lib/nekohtml-1.9.6.2.jar +0 -0
- data/lib/plexus-cipher-1.4.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/model/dependencies.rb +281 -0
- data/lib/ruby/maven/model/model.rb +490 -0
- data/lib/ruby/maven/model/model_utils.rb +322 -0
- data/lib/ruby/maven/tools/execute_in_phase.rb +9 -0
- data/lib/ruby/maven/tools/gem_project.rb +387 -0
- data/lib/ruby/maven/tools/gemfile_lock.rb +67 -0
- data/lib/ruby/maven/tools/pom_generator.rb +61 -0
- data/lib/ruby/maven/tools/rails_project.rb +147 -0
- data/lib/ruby/maven/tools/versions.rb +11 -0
- data/lib/ruby/ruby_maven.rb +206 -0
- data/lib/sisu-guice-2.9.4-no_aop.jar +0 -0
- data/lib/sisu-inject-bean-2.1.1.jar +0 -0
- data/lib/sisu-inject-plexus-2.1.1.jar +0 -0
- data/lib/wagon-file-1.0-beta-7.jar +0 -0
- data/lib/wagon-http-lightweight-1.0-beta-7.jar +0 -0
- data/lib/wagon-http-shared-1.0-beta-7.jar +0 -0
- data/lib/wagon-provider-api-1.0-beta-7.jar +0 -0
- data/lib/xercesMinimal-1.9.6.2.jar +0 -0
- metadata +128 -0
@@ -0,0 +1,281 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'model_utils.rb')
|
2
|
+
|
3
|
+
module Maven
|
4
|
+
module Model
|
5
|
+
|
6
|
+
class DependencyArray < Array
|
7
|
+
def <<(dep)
|
8
|
+
raise "not of type Dependency" unless dep.is_a?(Dependency)
|
9
|
+
d = detect { |item| item == dep }
|
10
|
+
if d
|
11
|
+
d.version = dep.version
|
12
|
+
self
|
13
|
+
else
|
14
|
+
super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
alias :push :<<
|
18
|
+
end
|
19
|
+
|
20
|
+
class ExclusionArray < Array
|
21
|
+
def <<(*dep)
|
22
|
+
excl = dep[0].is_a?(Exclusion) ? dep[0]: Exclusion.new(*dep.flatten)
|
23
|
+
delete_if { |item| item == excl }
|
24
|
+
super excl
|
25
|
+
end
|
26
|
+
alias :push :<<
|
27
|
+
end
|
28
|
+
|
29
|
+
class Coordinate < Tag
|
30
|
+
tags :group_id, :artifact_id, :version
|
31
|
+
def initialize(*args)
|
32
|
+
@group_id, @artifact_id, @version = *coordinate(*args.flatten)
|
33
|
+
end
|
34
|
+
|
35
|
+
def hash
|
36
|
+
"#{group_id}:#{artifact_id}".hash
|
37
|
+
end
|
38
|
+
|
39
|
+
def ==(other)
|
40
|
+
group_id == other.group_id && artifact_id == other.artifact_id
|
41
|
+
end
|
42
|
+
alias :eql? :==
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def coordinate(*args)
|
47
|
+
if args[0] =~ /:/
|
48
|
+
[args[0].sub(/:[^:]+$/, ''), args[0].sub(/.*:/, ''), convert_version(*args[1, 2])]
|
49
|
+
else
|
50
|
+
[args[0], args[1], convert_version(*args[2,3])]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def convert_version(*args)
|
55
|
+
if args.size == 0
|
56
|
+
nil
|
57
|
+
else
|
58
|
+
low, high = convert(args[0])
|
59
|
+
low, high = convert(args[1], low, high) if args[1] =~ /[=~><]/
|
60
|
+
if low == high
|
61
|
+
low
|
62
|
+
else
|
63
|
+
"#{low || '[0.0.0'},#{high || ')'}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def convert(arg, low = nil, high = nil)
|
69
|
+
if arg =~ /~>/
|
70
|
+
val = arg.sub(/~>\s*/, '')
|
71
|
+
last = val.sub(/\.[^.]+$/, '.99999')
|
72
|
+
["[#{val}", "#{last}]"]
|
73
|
+
elsif arg =~ />=/
|
74
|
+
val = arg.sub(/>=\s*/, '')
|
75
|
+
["[#{val}", (nil || high)]
|
76
|
+
elsif arg =~ /<=/
|
77
|
+
val = arg.sub(/<=\s*/, '')
|
78
|
+
[(nil || low), "#{val}]"]
|
79
|
+
# treat '!' the same way as '>' since maven can not describe such range
|
80
|
+
elsif arg =~ /[!>]/
|
81
|
+
val = arg.sub(/>\s*/, '')
|
82
|
+
["(#{val}", (nil || high)]
|
83
|
+
elsif arg =~ /</
|
84
|
+
val = arg.sub(/<\s*/, '')
|
85
|
+
[(nil || low), "#{val})"]
|
86
|
+
elsif arg =~ /\=/
|
87
|
+
val = arg.sub(/=\s*/, '')
|
88
|
+
[val, val]
|
89
|
+
else
|
90
|
+
[arg, arg]
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
class Parent < Coordinate
|
96
|
+
tags :relative_path
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
class Exclusion < Tag
|
101
|
+
tags :group_id, :artifact_id
|
102
|
+
def initialize(*args)
|
103
|
+
@group_id, @artifact_id = *coordinate(*args)
|
104
|
+
end
|
105
|
+
|
106
|
+
def hash
|
107
|
+
"#{group_id}:#{artifact_id}".hash
|
108
|
+
end
|
109
|
+
|
110
|
+
def ==(other)
|
111
|
+
group_id == other.group_id && artifact_id == other.artifact_id
|
112
|
+
end
|
113
|
+
alias :eql? :==
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
def coordinate(*args)
|
118
|
+
case args.size
|
119
|
+
when 1
|
120
|
+
name = args[0].sub(/^mvn:/, '')
|
121
|
+
if name =~ /:/
|
122
|
+
[name.sub(/:[^:]+$/, ''), name.sub(/.*:/, '')]
|
123
|
+
else
|
124
|
+
["rubygems", name]
|
125
|
+
end
|
126
|
+
else
|
127
|
+
[args[0], args[1]]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
class Dependency < Coordinate
|
133
|
+
tags :type, :scope, :classifier, :exclusions
|
134
|
+
def initialize(type, *args)
|
135
|
+
super(*args)
|
136
|
+
@type = type
|
137
|
+
args.flatten!
|
138
|
+
if args[0] =~ /:/ && args.size == 3
|
139
|
+
@classifier = args[2] unless args[2] =~ /[=~><]/
|
140
|
+
elsif args.size == 4
|
141
|
+
@classifier = args[3] unless args[3] =~ /[=~><]/
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def hash
|
146
|
+
"#{group_id}:#{artifact_id}:#{@type}:#{@classifier}".hash
|
147
|
+
end
|
148
|
+
|
149
|
+
def ==(other)
|
150
|
+
super && @type == other.instance_variable_get(:@type) && @classifier == other.instance_variable_get(:@classifier)
|
151
|
+
end
|
152
|
+
alias :eql? :==
|
153
|
+
|
154
|
+
def self.new_gem(gemname, *args)
|
155
|
+
if gemname =~ /^mvn:/
|
156
|
+
new(:maven_gem, gemname.sub(/^mvn:/, ''), *args)
|
157
|
+
else
|
158
|
+
new(:gem, "rubygems", gemname, *args)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.new_maven_gem(gemname, *args)
|
163
|
+
new(:maven_gem, gemname.sub(/^mvn:/, ''), *args)
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.new_jar(*args)
|
167
|
+
new(:jar, *args)
|
168
|
+
end
|
169
|
+
|
170
|
+
def self.new_test_jar(*args)
|
171
|
+
result = new(:jar, *args)
|
172
|
+
result.scope :test
|
173
|
+
result
|
174
|
+
end
|
175
|
+
|
176
|
+
def exclusions(&block)
|
177
|
+
@exclusions ||= ExclusionArray.new
|
178
|
+
if block
|
179
|
+
block.call(@exclusions)
|
180
|
+
end
|
181
|
+
@exclusions
|
182
|
+
end
|
183
|
+
|
184
|
+
def exclude(*args)
|
185
|
+
exclusions << args
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
module Dependencies
|
190
|
+
|
191
|
+
def self.included(parent)
|
192
|
+
parent.tags :dependencies
|
193
|
+
end
|
194
|
+
|
195
|
+
def jar?(*args)
|
196
|
+
dependencies.member?(Dependency.new(:jar, *args))
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_jar?(*args)
|
200
|
+
dependencies.member?(Dependency.new_test_jar(*args))
|
201
|
+
end
|
202
|
+
|
203
|
+
def gem?(*args)
|
204
|
+
dependencies.member?(Dependency.new(:gem, ['rubygems', *args].flatten))
|
205
|
+
end
|
206
|
+
|
207
|
+
def detect_gem(name)
|
208
|
+
dependencies.detect { |d| d.type.to_sym == :gem && d.artifact_id == name }
|
209
|
+
end
|
210
|
+
|
211
|
+
def maven_gem?(*args)
|
212
|
+
dependencies.member?(Dependency.new_maven_gem(*args))
|
213
|
+
end
|
214
|
+
|
215
|
+
def dependencies(&block)
|
216
|
+
@dependencies ||= DependencyArray.new
|
217
|
+
if block
|
218
|
+
block.call(self)
|
219
|
+
end
|
220
|
+
@dependencies
|
221
|
+
end
|
222
|
+
|
223
|
+
def add_dependency(dep, has_version = true, &block)
|
224
|
+
d = dependencies.detect { |d| d == dep }
|
225
|
+
if d
|
226
|
+
if has_version
|
227
|
+
d.version = dep.version
|
228
|
+
end
|
229
|
+
dep = d
|
230
|
+
else
|
231
|
+
dependencies << dep
|
232
|
+
end
|
233
|
+
block.call(dep) if block
|
234
|
+
dep
|
235
|
+
end
|
236
|
+
private :add_dependency
|
237
|
+
|
238
|
+
def add_gem(*args, &block)
|
239
|
+
args = args.flatten
|
240
|
+
if args.size == 1
|
241
|
+
dep = Dependency.new_gem(*args)
|
242
|
+
dep = dependencies.detect { |d| d == dep }
|
243
|
+
if dep
|
244
|
+
return dep
|
245
|
+
end
|
246
|
+
args[1] = ">= 0.0.0"
|
247
|
+
end
|
248
|
+
add_dependency(Dependency.new_gem(*args), &block)
|
249
|
+
end
|
250
|
+
private :add_gem
|
251
|
+
|
252
|
+
def jar(*args, &block)
|
253
|
+
if args.last.is_a?(Hash)
|
254
|
+
raise "hash not allowed for jar"
|
255
|
+
end
|
256
|
+
add_dependency(Dependency.new_jar(args), args.size > 1, &block)
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_jar(*args, &block)
|
260
|
+
if args.last.is_a?(Hash)
|
261
|
+
raise "hash not allowed for test_jar"
|
262
|
+
end
|
263
|
+
add_dependency(Dependency.new_test_jar(args), args.size > 1, &block)
|
264
|
+
end
|
265
|
+
|
266
|
+
def gem(*args, &block)
|
267
|
+
if args.last.is_a?(Hash)
|
268
|
+
raise "hash not allowed in that context"
|
269
|
+
end
|
270
|
+
add_gem(args, &block)
|
271
|
+
end
|
272
|
+
|
273
|
+
def maven_gem(*args, &block)
|
274
|
+
if args.last.is_a?(Hash)
|
275
|
+
raise "hash not allowed in that context"
|
276
|
+
end
|
277
|
+
add_dependency(Dependency.new_maven_gem(args), args.size > 1, &block)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|