ruby-maven 3.0.3.0.29.0.pre → 3.0.4.0.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/LICENSE.txt +202 -202
  2. data/NOTICE.txt +23 -23
  3. data/README.txt +77 -77
  4. data/bin/m2.conf +2 -2
  5. data/bin/rmvn +0 -1
  6. data/conf/settings.xml +257 -257
  7. data/lib/aether-api-1.13.1.jar +0 -0
  8. data/lib/aether-connector-wagon-1.13.1.jar +0 -0
  9. data/lib/aether-impl-1.13.1.jar +0 -0
  10. data/lib/aether-spi-1.13.1.jar +0 -0
  11. data/lib/aether-util-1.13.1.jar +0 -0
  12. data/lib/ext/README.txt +2 -2
  13. data/lib/maven-aether-provider-3.0.4.jar +0 -0
  14. data/lib/maven-artifact-3.0.4.jar +0 -0
  15. data/lib/{maven-compat-3.0.3.jar → maven-compat-3.0.4.jar} +0 -0
  16. data/lib/{maven-core-3.0.3.jar → maven-core-3.0.4.jar} +0 -0
  17. data/lib/maven-embedder-3.0.4.jar +0 -0
  18. data/lib/maven-model-3.0.4.jar +0 -0
  19. data/lib/{maven-model-builder-3.0.3.jar → maven-model-builder-3.0.4.jar} +0 -0
  20. data/lib/{maven-plugin-api-3.0.3.jar → maven-plugin-api-3.0.4.jar} +0 -0
  21. data/lib/{maven-repository-metadata-3.0.3.jar → maven-repository-metadata-3.0.4.jar} +0 -0
  22. data/lib/{maven-settings-3.0.3.jar → maven-settings-3.0.4.jar} +0 -0
  23. data/lib/{maven-settings-builder-3.0.3.jar → maven-settings-builder-3.0.4.jar} +0 -0
  24. data/lib/plexus-cipher-1.7.jar +0 -0
  25. data/lib/ruby/ruby_maven.rb +25 -10
  26. data/lib/sisu-guava-0.9.9.jar +0 -0
  27. data/lib/sisu-guice-3.1.0-no_aop.jar +0 -0
  28. data/lib/sisu-inject-bean-2.3.0.jar +0 -0
  29. data/lib/sisu-inject-plexus-2.3.0.jar +0 -0
  30. data/lib/wagon-file-2.2.jar +0 -0
  31. data/lib/wagon-http-2.2-shaded.jar +0 -0
  32. data/lib/wagon-provider-api-2.2.jar +0 -0
  33. metadata +40 -46
  34. data/bin/gwt +0 -59
  35. data/bin/jetty-run +0 -26
  36. data/bin/tomcat-run +0 -26
  37. data/lib/aether-api-1.11.jar +0 -0
  38. data/lib/aether-connector-wagon-1.11.jar +0 -0
  39. data/lib/aether-impl-1.11.jar +0 -0
  40. data/lib/aether-spi-1.11.jar +0 -0
  41. data/lib/aether-util-1.11.jar +0 -0
  42. data/lib/maven-aether-provider-3.0.3.jar +0 -0
  43. data/lib/maven-artifact-3.0.3.jar +0 -0
  44. data/lib/maven-embedder-3.0.3.jar +0 -0
  45. data/lib/maven-model-3.0.3.jar +0 -0
  46. data/lib/nekohtml-1.9.6.2.jar +0 -0
  47. data/lib/plexus-cipher-1.4.jar +0 -0
  48. data/lib/ruby-maven-3.0.3.0.29.0.pre.jar +0 -0
  49. data/lib/ruby/maven/model/dependencies.rb +0 -281
  50. data/lib/ruby/maven/model/model.rb +0 -490
  51. data/lib/ruby/maven/model/model_utils.rb +0 -322
  52. data/lib/ruby/maven/tools/execute_in_phase.rb +0 -9
  53. data/lib/ruby/maven/tools/gem_project.rb +0 -400
  54. data/lib/ruby/maven/tools/gemfile_lock.rb +0 -67
  55. data/lib/ruby/maven/tools/pom_generator.rb +0 -63
  56. data/lib/ruby/maven/tools/rails_project.rb +0 -164
  57. data/lib/ruby/maven/tools/versions.rb +0 -12
  58. data/lib/sisu-guice-2.9.4-no_aop.jar +0 -0
  59. data/lib/sisu-inject-bean-2.1.1.jar +0 -0
  60. data/lib/sisu-inject-plexus-2.1.1.jar +0 -0
  61. data/lib/wagon-file-1.0-beta-7.jar +0 -0
  62. data/lib/wagon-http-lightweight-1.0-beta-7.jar +0 -0
  63. data/lib/wagon-http-shared-1.0-beta-7.jar +0 -0
  64. data/lib/wagon-provider-api-1.0-beta-7.jar +0 -0
  65. data/lib/xercesMinimal-1.9.6.2.jar +0 -0
@@ -1,322 +0,0 @@
1
- module Maven
2
- module Model
3
- class Tag
4
-
5
- def self.prepend_tags(*tags)
6
- _tags(true, *tags)
7
- end
8
-
9
- def self.tags(*tags)
10
- _tags(false, *tags)
11
- end
12
-
13
- def self._tags(prepend, *tags)
14
- if tags.size == 0
15
- @tags
16
- else
17
- #self.send :attr_accessor, *tags
18
- tags.each do |tag|
19
- eval <<-EOF
20
- def #{tag.to_s}(val = nil)
21
- @#{tag.to_s} = val if val
22
- @#{tag.to_s}
23
- end
24
- def #{tag.to_s}=(val)
25
- @#{tag.to_s} = val
26
- end
27
- EOF
28
- end
29
- if self.superclass.respond_to?:tags
30
- @tags ||= (self.superclass.tags || []).dup
31
- else
32
- @tags ||= []
33
- end
34
- unless @tags.include? tags[0]
35
- if prepend
36
- @tags.replace([tags, @tags].flatten)
37
- else
38
- @tags.replace([@tags, tags].flatten)
39
- end
40
- end
41
- @tags
42
- end
43
- end
44
-
45
- def _name
46
- self.class.to_s.downcase.sub(/.*::/, '')
47
- end
48
-
49
- def initialize(args = {})
50
- warn "deprecated #{args.inspect}" if args.size > 0
51
- args.each do |k,v|
52
- send("#{k}=".to_sym, v)
53
- end
54
- end
55
-
56
- def comment(c)
57
- @comment = c if c
58
- @comment
59
- end
60
-
61
- def to_xml(buf = "", indent = "")
62
- buf << "#{indent}<#{_name}>\n"
63
- buf << "#{indent}<!--\n#{indent}#{@comment}\n#{indent}-->\n" if @comment
64
- self.class.tags.each do |var|
65
- val = instance_variable_get("@#{var}".to_sym)
66
- var = var.to_s.gsub(/_(.)/) { $1.upcase }
67
- case val
68
- when Array
69
- val.flatten!
70
- if val.size > 0
71
- buf << "#{indent} <#{var}>\n"
72
- val.each do |v|
73
- if v.is_a? Tag
74
- v.to_xml(buf, indent + " ")
75
- else
76
- buf << "#{indent} <#{var.to_s.sub(/s$/, '')}>#{v}</#{var.to_s.sub(/s$/, '')}>\n"
77
- end
78
- end
79
- buf << "#{indent} </#{var}>\n"
80
- end
81
- when Hash
82
- if val.size > 0
83
- buf << "#{indent} <#{var}>\n"
84
- val.each do |k, v|
85
- if v.is_a? Tag
86
- v.to_xml(buf, indent + " ")
87
- else
88
- buf << "#{indent} <#{k}>#{v}</#{k}>\n"
89
- end
90
- end
91
- buf << "#{indent} </#{var}>\n"
92
- end
93
- when Tag
94
- val.to_xml(buf, indent + " ")
95
- else
96
- #when String
97
- buf << "#{indent} <#{var}>#{val}</#{var}>\n" if val
98
- end
99
- end
100
- buf << "#{indent}</#{_name.sub(/ .*$/, '')}>\n"
101
- buf
102
- end
103
- end
104
-
105
- class NamedArray < Array
106
- attr_reader :name
107
- def initialize(name, &block)
108
- @name = name.to_s
109
- if block
110
- block.call(self)
111
- end
112
- self
113
- end
114
- end
115
-
116
- class ModelHash < Hash
117
-
118
- def initialize(clazz)
119
- @clazz = clazz
120
- end
121
-
122
- def get(key, &block)
123
- key = key.to_sym if key
124
- result = self[key]
125
- if result.nil?
126
- result = (self[key] = @clazz.new(key))
127
- end
128
- if block
129
- block.call(result)
130
- end
131
- result
132
- end
133
- alias :new :get
134
- alias :add :get
135
-
136
- def default_model
137
- @default_model ||=
138
- begin
139
- model = @clazz.new
140
- self[nil] = model
141
- model
142
- end
143
- end
144
-
145
- def method_missing(method, *args, &block)
146
- default_model.send(method, *args, &block)
147
- end
148
- end
149
-
150
- class DeveloperHash < Hash
151
-
152
- def get(*args, &block)
153
- developer = if args.size == 1 && args[0].is_a?(Developer)
154
- args[0]
155
- else
156
- Developer.new(*args)
157
- end
158
- self[developer.id] = developer
159
- if block
160
- block.call(developer)
161
- end
162
- developer
163
- end
164
- alias :new :get
165
- alias :add :get
166
- end
167
-
168
- class LicenseHash < Hash
169
-
170
- def get(*args, &block)
171
- license = if args.size == 1 && args[0].is_a?(License)
172
- args[0]
173
- else
174
- License.new(*args)
175
- end
176
- self[license.name] = license
177
- if block
178
- block.call(license)
179
- end
180
- license
181
- end
182
- alias :new :get
183
- alias :add :get
184
- end
185
-
186
- class PluginHash < Hash
187
-
188
- def adjust_key(name)
189
- name = name.to_s
190
- if (name =~ /\:/).nil?
191
- if [:jruby, :gem, :rspec, :rake, :minitest, :rails3, :gemify, :cucumber, :runit, :bundler].member? name.to_sym
192
- "de.saumya.mojo:#{name}-maven-plugin"
193
- else
194
- "maven-#{name}-plugin"
195
- end
196
- else
197
- name
198
- end
199
- end
200
-
201
- def key?(k)
202
- super( adjust_key(k).to_sym )
203
- end
204
-
205
- def get(*args, &block)
206
- case args.size
207
- when 3
208
- name = "#{args[0]}:#{args[1]}"
209
- version = args[2]
210
- when 2
211
- name = args[0].to_s
212
- version = args[1]
213
- when 1
214
- name = args[0].to_s
215
- else
216
- raise "need name"
217
- end
218
-
219
- name = adjust_key(name)
220
- group_id = name =~ /\:/ ? name.sub(/:.+$/, '') : nil
221
- artifact_id = name.sub(/^.+:/, '')
222
-
223
- k = "#{group_id}:#{artifact_id}".to_sym
224
- result = self[k]
225
- if result.nil?
226
- result = (self[k] = Plugin.new(group_id, artifact_id, version))
227
- end
228
- result.version = version if version
229
- if block
230
- block.call(result)
231
- end
232
- result
233
- end
234
- alias :new :get
235
- alias :add :get
236
-
237
- end
238
-
239
- class ListItems < Tag
240
-
241
- def initialize(name = nil)
242
- @name = name
243
- end
244
-
245
- def add(item)
246
- @items ||= Array.new
247
- @items << item
248
- end
249
- alias :<< :add
250
-
251
- def to_xml(buf = "", indent = "")
252
- buf << "#{indent}<#{@name}>\n" if @name
253
- buf << "#{indent}<!--\n#{indent}#{@comment}\n#{indent}-->\n" if @comment
254
- @items.each do |i|
255
- i.to_xml(buf, indent)
256
- end
257
- buf << "#{indent}</#{@name}>\n" if @name
258
- end
259
-
260
- end
261
-
262
- class HashTag < Tag
263
-
264
- def initialize(name, args = {})
265
- @name = name
266
- @props = args
267
- end
268
-
269
- def [](key)
270
- @props ||= {}
271
- @props[key]
272
- end
273
-
274
- def []=(key, value)
275
- @props ||= {}
276
- @props[key] = value
277
- end
278
-
279
- def to_xml(buf = "", indent = "")
280
- buf << "#{indent}<#{@name}>\n"
281
- buf << "#{indent}<!--\n#{indent}#{@comment}\n#{indent}-->\n" if @comment
282
- map_to_xml(buf, indent, @props)
283
- buf << "#{indent}</#{@name}>\n"
284
- end
285
-
286
- def map_to_xml(buf, indent, map)
287
- # sort the hash over the keys
288
- map.collect { |k,v| [k.to_s, v]}.sort.each do |k,v|
289
- case v
290
- when Hash
291
- buf << "#{indent} <#{k}>\n"
292
- map_to_xml(buf, indent + " ", v)
293
- buf << "#{indent} </#{k}>\n"
294
- when NamedArray
295
- buf << "#{indent} <#{k}>\n"
296
- v.each do|i|
297
- buf << "#{indent} <#{v.name}>\n"
298
- case i
299
- when Hash
300
- map_to_xml(buf, indent + " ", i)
301
- end
302
- buf << "#{indent} </#{v.name}>\n"
303
- end
304
- buf << "#{indent} </#{k}>\n"
305
- when Array
306
- buf << "#{indent} <#{k}>\n"
307
- singular = k.to_s.sub(/s$/, '')
308
- v.each do |i|
309
- buf << "#{indent} <#{singular}>#{i}</#{singular}>\n"
310
- end
311
- buf << "#{indent} </#{k}>\n"
312
- when /\n$/
313
- buf << "#{indent} <#{k}>#{v}"
314
- buf << "#{indent} </#{k}>\n"
315
- else
316
- buf << "#{indent} <#{k}>#{v}</#{k}>\n"
317
- end
318
- end
319
- end
320
- end
321
- end
322
- end
@@ -1,9 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'gem_project.rb')
2
-
3
- proj = Maven::Tools::GemProject.new("in_phase_execution")
4
-
5
- proj.load(ARGV[0])
6
-
7
- block = proj.executions_in_phase[ARGV[1]]
8
- block.call if block
9
-
@@ -1,400 +0,0 @@
1
- require File.join(File.dirname(File.dirname(__FILE__)), 'model', 'model.rb')
2
- require File.join(File.dirname(__FILE__), 'gemfile_lock.rb')
3
- require File.join(File.dirname(__FILE__), 'versions.rb')
4
-
5
- module Maven
6
- module Tools
7
- class GemProject < Maven::Model::Project
8
- tags :dummy
9
-
10
- def initialize(artifact_id = dir_name, version = "0.0.0", &block)
11
- super("rubygems", artifact_id, version, &block)
12
- packaging "gem"
13
- end
14
-
15
- def loaded_files
16
- @files ||= []
17
- end
18
-
19
- def current_file
20
- loaded_files.last
21
- end
22
-
23
- def dump_loaded_file_list
24
- if loaded_files.size > 0
25
- basedir = File.dirname(loaded_files[0])
26
- File.open(loaded_files[0] + ".files", 'w') do |f|
27
- loaded_files.each { |i| f.puts i.sub(/^#{basedir}./, '') }
28
- end
29
- end
30
- end
31
-
32
- def add_param(config, name, list, default = [])
33
- if list.is_a? Array
34
- config[name] = list.join(",").to_s unless (list || []) == default
35
- else
36
- # list == nil => (list || []) == default is true
37
- config[name] = list.to_s unless (list || []) == default
38
- end
39
- end
40
- private :add_param
41
-
42
- def load_gemspec(specfile)
43
- require 'rubygems'
44
- if specfile.is_a? ::Gem::Specification
45
- spec = specfile
46
- else
47
- spec = ::Gem::Specification.load(specfile)
48
- loaded_files << File.expand_path(specfile)
49
- @gemspec = specfile
50
- end
51
- raise "file not found '#{specfile}'" unless spec
52
- artifact_id spec.name
53
- version spec.version
54
- name spec.summary || "#{self.artifact_id} - gem"
55
- description spec.description if spec.description
56
- url spec.homepage if spec.homepage
57
- (spec.email || []).zip(spec.authors || []).map do |email, author|
58
- self.developers.new(author, email)
59
- end
60
-
61
- # TODO work with collection of licenses - there can be more than one !!!
62
- (spec.licenses + spec.files.select {|file| file.to_s =~ /license|gpl/i }).each do |license|
63
- # TODO make this better, i.e. detect the right license name from the file itself
64
- self.licenses.new(license)
65
- end
66
-
67
- config = {}
68
- add_param(config, "gemspec", @gemspec) if loaded_files.size == 1
69
- add_param(config, "autorequire", spec.autorequire)
70
- add_param(config, "defaultExecutable", spec.default_executable)
71
- add_param(config, "testFiles", spec.test_files)
72
- #has_rdoc always gives true => makes not sense to keep it then
73
- #add_param(config, "hasRdoc", spec.has_rdoc)
74
- add_param(config, "extraRdocFiles", spec.extra_rdoc_files)
75
- add_param(config, "rdocOptions", spec.rdoc_options)
76
- add_param(config, "requirePaths", spec.require_paths, ["lib"])
77
- add_param(config, "rubyforgeProject", spec.rubyforge_project)
78
- add_param(config, "requiredRubygemsVersion",
79
- spec.required_rubygems_version && spec.required_rubygems_version != ">= 0" ? "<![CDATA[#{spec.required_rubygems_version}]]>" : nil)
80
- add_param(config, "bindir", spec.bindir, "bin")
81
- add_param(config, "requiredRubyVersion",
82
- spec.required_ruby_version && spec.required_ruby_version != ">= 0" ? "<![CDATA[#{spec.required_ruby_version}]]>" : nil)
83
- add_param(config, "postInstallMessage",
84
- spec.post_install_message ? "<![CDATA[#{spec.post_install_message}]]>" : nil)
85
- add_param(config, "executables", spec.executables)
86
- add_param(config, "extensions", spec.extensions)
87
- add_param(config, "platform", spec.platform, 'ruby')
88
-
89
- # # TODO maybe calculate extra files
90
- # files = spec.files.dup
91
- # (Dir['lib/**/*'] + Dir['spec/**/*'] + Dir['features/**/*'] + Dir['test/**/*'] + spec.licenses + spec.extra_rdoc_files).each do |f|
92
- # files.delete(f)
93
- # if f =~ /^.\//
94
- # files.delete(f.sub(/^.\//, ''))
95
- # else
96
- # files.delete("./#{f}")
97
- # end
98
- # end
99
- #add_param(config, "extraFiles", files)
100
- add_param(config, "files", spec.files)
101
-
102
- plugin('gem').with(config) if config.size > 0
103
-
104
- spec.dependencies.each do |dep|
105
- scope =
106
- case dep.type
107
- when :runtime
108
- "compile"
109
- when :development
110
- "test"
111
- else
112
- warn "unknown scope: #{dep.type}"
113
- "compile"
114
- end
115
-
116
- versions = dep.requirement.requirements.collect do |req|
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
119
- end
120
- gem(dep.name, versions).scope = scope
121
- end
122
-
123
- spec.requirements.each do |req|
124
- begin
125
- eval req
126
- rescue => e
127
- # TODO requirements is a list !!!
128
- add_param(config, "requirements", req)
129
- warn e
130
- rescue SyntaxError => e
131
- # TODO requirements is a list !!!
132
- add_param(config, "requirements", req)
133
- end
134
- end
135
- end
136
-
137
- def load(file)
138
- file = file.path if file.is_a?(File)
139
- if File.exists? file
140
- content = File.read(file)
141
- loaded_files << file
142
- if @lock.nil?
143
- @lock = GemfileLock.new(file + ".lock")
144
- if @lock.size == 0
145
- @lock = nil
146
- else
147
- loaded_files << file + ".lock"
148
- @lock.hull.each do |dep|
149
- dependency_management.gem dep
150
- end
151
- end
152
- end
153
- eval content
154
- else
155
- self
156
- end
157
- end
158
-
159
- def dir_name
160
- File.basename(File.expand_path("."))
161
- end
162
- private :dir_name
163
-
164
- def add_defaults(args = {})
165
- versions = VERSIONS
166
- versions = versions.merge(args) if args
167
-
168
- name "#{dir_name} - gem" unless name
169
-
170
- packaging "gem" unless packaging
171
-
172
- repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless repository("rubygems-releases").url
173
-
174
- unless repository("rubygems-prereleases").url
175
- repository("rubygems-prereleases") do |r|
176
- r.url = "http://rubygems-proxy.torquebox.org/prereleases"
177
- r.releases(:enabled => false)
178
- r.snapshots(:enabled => true)
179
- end
180
- end
181
-
182
- # TODO go through all plugins to find out any SNAPSHOT version !!
183
- if versions[:jruby_plugins] =~ /-SNAPSHOT$/ || properties['jruby.plugins.version'] =~ /-SNAPSHOT$/
184
- plugin_repository("sonatype-snapshots") do |nexus|
185
- nexus.url = "http://oss.sonatype.org/content/repositories/snapshots"
186
- nexus.releases(:enabled => false)
187
- nexus.snapshots(:enabled => true)
188
- end
189
- end
190
-
191
- if packaging =~ /gem/ || plugin?(:gem)
192
- gem = plugin(:gem)
193
- gem.version = "${jruby.plugins.version}" unless gem.version
194
- gem.extensions = true if packaging =~ /gem/
195
- if File.exists?('lib') && File.exists?(File.join('src', 'main', 'java'))
196
- plugin(:jar) do |j|
197
- j.version = versions[:jar_plugin] unless j.version
198
- j.in_phase('prepare-package').execute_goal(:jar).with :outputDirectory => '${project.basedir}/lib', :finalName => '${project.artifactId}'
199
- end
200
- end
201
- end
202
-
203
- if plugin?(:bundler)
204
- bundler = plugin(:bundler)
205
- bundler.version = "${jruby.plugins.version}" unless bundler.version
206
- bundler.executions.goals << "install"
207
- unless gem?(:bundler)
208
- gem("bundler")
209
- end
210
- end
211
-
212
- if versions[:jruby_plugins]
213
- #add_test_plugin(nil, "test")
214
- add_test_plugin("rspec", "spec")
215
- add_test_plugin("cucumber", "features")
216
- add_test_plugin("minitest", "test")
217
- add_test_plugin("minitest", "spec", 'spec')
218
- end
219
-
220
- self.properties = {
221
- "project.build.sourceEncoding" => "UTF-8",
222
- "gem.home" => "${project.build.directory}/rubygems",
223
- "gem.path" => "${project.build.directory}/rubygems",
224
- "jruby.plugins.version" => versions[:jruby_plugins]
225
- }.merge(self.properties)
226
-
227
- has_plugin_gems = build.plugins.detect do |k, pl|
228
- pl.dependencies.detect { |d| d.type.to_sym == :gem } if pl.dependencies
229
- end
230
-
231
- if has_plugin_gems
232
- plugin_repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless plugin_repository("rubygems-releases").url
233
-
234
- unless plugin_repository("rubygems-prereleases").url
235
- plugin_repository("rubygems-prereleases") do |r|
236
- r.url = "http://rubygems-proxy.torquebox.org/prereleases"
237
- r.releases(:enabled => false)
238
- r.snapshots(:enabled => true)
239
- end
240
- end
241
- end
242
- end
243
-
244
- def add_test_plugin(name, test_dir, goal = 'test')
245
- unless plugin?(name)
246
- has_gem = name.nil? ? true : gem?(name)
247
- if has_gem && File.exists?(test_dir)
248
- plugin(name || 'runit', "${jruby.plugins.version}").execution.goals << goal
249
- end
250
- else
251
- pl = plugin(name || 'runit')
252
- pl.version = "${jruby.plugins.version}" unless pl.version
253
- end
254
- end
255
- private :add_test_plugin
256
-
257
- def stack
258
- @stack ||= [[:default]]
259
- end
260
- private :stack
261
-
262
- def group(*args, &block)
263
- stack << args
264
- block.call if block
265
- stack.pop
266
- end
267
-
268
- def gemspec(name = nil)
269
- if name
270
- load_gemspec(File.join(File.dirname(current_file), name))
271
- else
272
- Dir[File.join(File.dirname(current_file), "*.gemspec")].each do |file|
273
- load_gemspec(file)
274
- end
275
- end
276
- end
277
-
278
- def source(*args)
279
- warn "ignore source #{args}" if !(args[0].to_s =~ /^https?:\/\/rubygems.org/) && args[0] != :rubygems
280
- end
281
-
282
- def path(*args)
283
- end
284
-
285
- def git(*args)
286
- end
287
-
288
- def is_jruby_platform(*args)
289
- args.detect { |a| :jruby == a.to_sym }
290
- end
291
- private :is_jruby_platform
292
-
293
- def platforms(*args, &block)
294
- if is_jruby_platform(*args)
295
- block.call
296
- end
297
- end
298
-
299
- def gem(*args, &block)
300
- dep = nil
301
- if args.last.is_a?(Hash)
302
- options = args.delete(args.last)
303
- unless options.key?(:git) || options.key?(:path)
304
- if options[:platforms].nil? || is_jruby_platform(*(options[:platforms] || []))
305
- group = options[:group] || options[:groups]
306
- if group
307
- [group].flatten.each do |g|
308
- if dep
309
- profile(g).dependencies << dep
310
- else
311
- dep = profile(g).gem(args, &block)
312
- end
313
- end
314
- else
315
- self.gem(args, &block)
316
- end
317
- end
318
- end
319
- else
320
- stack.last.each do |c|
321
- if c == :default
322
- if @lock.nil?
323
- dep = add_gem(args, &block)
324
- else
325
- dep = add_gem(args[0], &block)
326
-
327
- # add its dependencies as well to have the version
328
- # determine by the dependencyManagement
329
- @lock.dependency_hull(args[0]).map.each do |d|
330
- add_gem d[0], nil
331
- end
332
- end
333
- else
334
- if @lock.nil?
335
- if dep
336
- profile(c).dependencies << dep
337
- else
338
- dep = profile(c).gem(args, &block)
339
- end
340
- else
341
- if dep
342
- profile(c).dependencies << dep
343
- else
344
- dep = profile(c).gem(args[0], nil, &block)
345
- end
346
- # add its dependencies as well to have the version
347
- # determine by the dependencyManagement
348
- @lock.dependency_hull(args[0]).map.each do |d|
349
- profile(c).gem d[0], nil unless gem? d[0]
350
- end
351
- end
352
- end
353
- end
354
- end
355
- if dep && !@gemspec
356
- project = self
357
-
358
- # first collect the missing deps it any
359
- bundler_deps = []
360
- #plugin(:bundler) do |bundler|
361
- # use a dep with version so just create it from the args
362
- bundler_deps << args
363
-
364
- #TODO this should be done after all deps are in place - otherwise it depends on order how bundler gets setup
365
- if @lock
366
- # add its dependencies as well to have the version
367
- # determine by the dependencyManagement
368
- @lock.dependency_hull(dep.artifact_id).map.each do |d|
369
- bundler_deps << d unless project.gem? d[0]
370
- end
371
- end
372
- #end
373
-
374
- # now add the deps to bundler plugin
375
- # avoid to setup bundler if it has no deps
376
- if bundler_deps.size > 0
377
- plugin(:bundler) do |bundler|
378
- bundler_deps.each do |d|
379
- bundler.gem(d)
380
- end
381
- end
382
- end
383
- end
384
- dep
385
- end
386
- end
387
- end
388
- end
389
-
390
- if $0 == __FILE__
391
- proj = Maven::Tools::GemProject.new("test_gem")
392
- if ARGV[0] =~ /\.gemspec$/
393
- proj.load_gemspec(ARGV[0])
394
- else
395
- proj.load(ARGV[0] || 'Gemfile')
396
- end
397
- proj.load(ARGV[1] || 'Mavenfile')
398
- proj.add_defaults
399
- puts proj.to_xml
400
- end