maven-tools 0.32.4 → 0.32.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,6 +4,10 @@ maven tools
4
4
  * [![Build Status](https://secure.travis-ci.org/torquebox/maven-tools.png)](http://travis-ci.org/torquebox/maven-tools)
5
5
  * [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/torquebox/maven-tools)
6
6
 
7
+ Note on Ruby-1.8
8
+ ----------------
9
+
10
+ ordering is important within the pom.xml since it carry info on the sequence of execution. jruby and ruby-1.9 do iterate in same order as the keys gets included, that helps to copy the order of declaration from the ruby DSL over to pom.xml. with ruby-1.8 the hash behaviour is different and since ruby-1.8 is end of life there is no support for ruby-1.8. though it might just works fine on simple setup.
7
11
 
8
12
  Contributing
9
13
  ------------
@@ -374,6 +374,11 @@ module Maven
374
374
  'project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"'
375
375
  end
376
376
 
377
+ def dump_pom( file = nil )
378
+ @dump_pom = file if file
379
+ @dump_pom
380
+ end
381
+
377
382
  def version(val = nil)
378
383
  self.version = val if val
379
384
  @version ||= (@parent.nil? ? '0.0.0' : @parent.version)
@@ -591,11 +596,11 @@ module Maven
591
596
  end
592
597
 
593
598
  def releases(args = {})
594
- @releases ||= OHash.new.replace(args)
599
+ @releases ||= args
595
600
  end
596
601
 
597
602
  def snapshots(args = {})
598
- @snapshots ||= OHash.new.replace(args)
603
+ @snapshots ||= args
599
604
  end
600
605
 
601
606
  def to_xml(*args)
@@ -603,14 +608,6 @@ module Maven
603
608
  end
604
609
  end
605
610
 
606
- class OHash < Hash
607
-
608
- def keys
609
- k = super
610
- k.sort { |n,m| n.to_s <=> m.to_s }
611
- end
612
- end
613
-
614
611
  class PluginRepository < Repository
615
612
  tags :dummy
616
613
  def _name
@@ -618,4 +615,4 @@ module Maven
618
615
  end
619
616
  end
620
617
  end
621
- end
618
+ end
@@ -101,7 +101,7 @@ EOF
101
101
  when Hash
102
102
  if val.size > 0
103
103
  buf << "#{indent} <#{var}>\n"
104
- val.keys.sort{ |n,m| n.to_s <=> m.to_s }.each do |k|
104
+ val.keys.each do |k|
105
105
  v = val[k]
106
106
  if v.is_a? Tag
107
107
  v.to_xml(buf, indent + " ")
@@ -347,8 +347,7 @@ EOF
347
347
  end
348
348
 
349
349
  def map_to_xml(buf, indent, map)
350
- # sort the hash over the keys
351
- map.collect { |k,v| [k.to_s, v]}.sort.each do |k,v|
350
+ map.each do |k,v|
352
351
  case v
353
352
  when Hash
354
353
  buf << "#{indent} <#{k}>\n"
@@ -374,6 +373,8 @@ EOF
374
373
  buf << "#{indent} <#{singular}>\n"
375
374
  map_to_xml(buf, indent + " ", i)
376
375
  buf << "#{indent} </#{singular}>\n"
376
+ when /^<.*>$/ #allow any kind of xml as is
377
+ buf << "#{indent} #{i}\n"
377
378
  else
378
379
  buf << "#{indent} <#{singular}>#{i}</#{singular}>\n"
379
380
  end
@@ -389,4 +390,4 @@ EOF
389
390
  end
390
391
  end
391
392
  end
392
- end
393
+ end
@@ -17,31 +17,14 @@
17
17
  # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
18
  # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
19
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
- #
21
- # TODO make nice require after ruby-maven uses the same ruby files
22
- require File.join(File.dirname(File.dirname(__FILE__)), 'model', 'model.rb')
23
20
  require File.join(File.dirname(__FILE__), 'gemfile_lock.rb')
24
21
  require File.join(File.dirname(__FILE__), 'versions.rb')
25
- require File.join(File.dirname(__FILE__), 'jarfile.rb')
22
+ require File.join(File.dirname(__FILE__), 'maven_project.rb')
26
23
 
27
24
  module Maven
28
25
  module Tools
29
26
 
30
- class ArtifactPassthrough
31
-
32
- def initialize(&block)
33
- @block = block
34
- end
35
-
36
- def add_artifact(a)
37
- @block.call(a)
38
- end
39
-
40
- def add_repository(name, url)
41
- end
42
- end
43
-
44
- class GemProject < Maven::Model::Project
27
+ class GemProject < MavenProject
45
28
  tags :dummy
46
29
 
47
30
  def initialize(artifact_id = dir_name, version = "0.0.0", &block)
@@ -61,7 +44,7 @@ module Maven
61
44
 
62
45
  def load_gemspec(specfile)
63
46
  require 'rubygems'
64
- if specfile.is_a? ::Gem::Specification
47
+ if specfile.is_a? ::Gem::Specification
65
48
  spec = specfile
66
49
  else
67
50
  spec = ::Gem::Specification.load(specfile)
@@ -104,12 +87,12 @@ module Maven
104
87
  add_param(config, "rdocOptions", spec.rdoc_options)
105
88
  add_param(config, "requirePaths", spec.require_paths, ["lib"])
106
89
  add_param(config, "rubyforgeProject", spec.rubyforge_project)
107
- add_param(config, "requiredRubygemsVersion",
108
- spec.required_rubygems_version && spec.required_rubygems_version != ">= 0" ? "<![CDATA[#{spec.required_rubygems_version}]]>" : nil)
90
+ add_param(config, "requiredRubygemsVersion",
91
+ spec.required_rubygems_version && spec.required_rubygems_version.to_s != ">= 0" ? "<![CDATA[#{spec.required_rubygems_version}]]>" : nil)
109
92
  add_param(config, "bindir", spec.bindir, "bin")
110
- add_param(config, "requiredRubyVersion",
111
- spec.required_ruby_version && spec.required_ruby_version != ">= 0" ? "<![CDATA[#{spec.required_ruby_version}]]>" : nil)
112
- add_param(config, "postInstallMessage",
93
+ add_param(config, "requiredRubyVersion",
94
+ spec.required_ruby_version && spec.required_ruby_version.to_s != ">= 0" ? "<![CDATA[#{spec.required_ruby_version}]]>" : nil)
95
+ add_param(config, "postInstallMessage",
113
96
  spec.post_install_message ? "<![CDATA[#{spec.post_install_message}]]>" : nil)
114
97
  add_param(config, "executables", spec.executables)
115
98
  add_param(config, "extensions", spec.extensions)
@@ -127,11 +110,11 @@ module Maven
127
110
  # end
128
111
  #add_param(config, "extraFiles", files)
129
112
  add_param(config, "files", spec.files)
130
-
113
+
131
114
  plugin('gem').with(config) if config.size > 0
132
115
 
133
116
  spec.dependencies.each do |dep|
134
- scope =
117
+ scope =
135
118
  case dep.type
136
119
  when :runtime
137
120
  "compile"
@@ -172,17 +155,6 @@ module Maven
172
155
  end
173
156
  end
174
157
 
175
- def load_mavenfile(file)
176
- file = file.path if file.is_a?(File)
177
- if File.exists? file
178
- @current_file = file
179
- content = File.read(file)
180
- eval content
181
- else
182
- self
183
- end
184
- end
185
-
186
158
  def load_gemfile(file)
187
159
  file = file.path if file.is_a?(File)
188
160
  if File.exists? file
@@ -208,7 +180,7 @@ module Maven
208
180
  if @lock
209
181
  dependencies.each do |d|
210
182
  if d.group_id == 'rubygems' && @lock.keys.member?( d.artifact_id )
211
- d.version = nil
183
+ d.version = nil
212
184
  end
213
185
  end
214
186
  end
@@ -216,20 +188,6 @@ module Maven
216
188
  self
217
189
  end
218
190
  end
219
-
220
- def load_jarfile(file)
221
- jars = Jarfile.new(file)
222
- if jars.exists?
223
- container = ArtifactPassthrough.new do |a|
224
- artifactId, groupId, extension, version = a.split(/:/)
225
- send(extension.to_sym, "#{artifactId}:#{groupId}", version)
226
- end
227
- if !jars.exists_lock? || jars.mtime > jars.mtime_lock
228
- jars.populate_unlocked container
229
- end
230
- jars.populate_locked container
231
- end
232
- end
233
191
 
234
192
  def dir_name
235
193
  File.basename(File.expand_path("."))
@@ -241,7 +199,7 @@ module Maven
241
199
  versions = versions.merge(args) if args
242
200
 
243
201
  name "#{dir_name} - gem" unless name
244
-
202
+
245
203
  packaging "gem" unless packaging
246
204
 
247
205
  repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless repository("rubygems-releases").url
@@ -253,7 +211,7 @@ module Maven
253
211
  # r.releases(:enabled => false)
254
212
  r.snapshots(:enabled => true)
255
213
  end
256
- end
214
+ end
257
215
 
258
216
  # TODO go through all plugins to find out any SNAPSHOT version !!
259
217
  if versions[:jruby_plugins] =~ /-SNAPSHOT$/ || properties['jruby.plugins.version'] =~ /-SNAPSHOT$/
@@ -280,7 +238,7 @@ module Maven
280
238
  end
281
239
  end
282
240
  end
283
-
241
+
284
242
  if @bundler_deps && @bundler_deps.size > 0
285
243
  plugin(:bundler)
286
244
  bdeps = []
@@ -298,10 +256,10 @@ module Maven
298
256
  @bundler_deps.each do |args, dep|
299
257
  bdeps << args unless has_gem? args[0]
300
258
  end
301
-
259
+
302
260
  # now add the deps to bundler plugin
303
261
  # avoid to setup bundler if it has no deps
304
- if bdeps.size > 0
262
+ if bdeps.size > 0
305
263
  plugin(:bundler) do |bundler|
306
264
  # install will be triggered on initialize phase
307
265
  bundler.execution.goals << "install"
@@ -309,7 +267,7 @@ module Maven
309
267
  bdeps.each do |d|
310
268
  bundler.gem(d)
311
269
  end
312
-
270
+
313
271
  # use the locked down version if available
314
272
  if @lock
315
273
  bundler.dependencies.each do |d|
@@ -344,8 +302,8 @@ module Maven
344
302
  end
345
303
 
346
304
  self.properties = {
347
- "project.build.sourceEncoding" => "UTF-8",
348
- "gem.home" => "${project.build.directory}/rubygems",
305
+ "project.build.sourceEncoding" => "UTF-8",
306
+ "gem.home" => "${project.build.directory}/rubygems",
349
307
  "gem.path" => "${project.build.directory}/rubygems",
350
308
  "jruby.plugins.version" => versions[:jruby_plugins]
351
309
  }.merge(self.properties)
@@ -353,10 +311,10 @@ module Maven
353
311
  has_plugin_gems = build.plugins.detect do |k, pl|
354
312
  pl.dependencies.detect { |d| d.type.to_sym == :gem } if pl.dependencies
355
313
  end
356
-
314
+
357
315
  if has_plugin_gems
358
316
  plugin_repository("rubygems-releases").url = "http://rubygems-proxy.torquebox.org/releases" unless plugin_repository("rubygems-releases").url
359
-
317
+
360
318
  # unless plugin_repository("rubygems-prereleases").url
361
319
  # plugin_repository("rubygems-prereleases") do |r|
362
320
  # r.url = "http://rubygems-proxy.torquebox.org/prereleases"
@@ -367,8 +325,8 @@ module Maven
367
325
  end
368
326
  # TODO
369
327
  configs = {
370
- :gem => [:initialize],
371
- :rails3 => [:initialize, :pom],
328
+ :gem => [:initialize],
329
+ :rails3 => [:initialize, :pom],
372
330
  :bundler => [:install]
373
331
  }.collect do |name, goals|
374
332
  if plugin?(name)
@@ -386,8 +344,8 @@ module Maven
386
344
  configs.delete_if { |c| c.nil? }
387
345
  if configs.size > 0
388
346
  build.plugin_management do |pm|
389
- options = {
390
- :lifecycleMappingMetadata => {
347
+ options = {
348
+ :lifecycleMappingMetadata => {
391
349
  :pluginExecutions => Maven::Model::NamedArray.new(:pluginExecution) do |e|
392
350
  # sort them - handy for testing
393
351
  configs.sort {|m,n| m[:pluginExecutionFilter][:artifactId].to_s <=> n[:pluginExecutionFilter][:artifactId].to_s }.each { |c| e << c }
@@ -414,7 +372,7 @@ module Maven
414
372
  end
415
373
  end
416
374
  end
417
-
375
+
418
376
  def has_gem?(gem)
419
377
  self.gem?(gem)
420
378
  end
@@ -436,7 +394,7 @@ module Maven
436
394
  @stack ||= [[:default]]
437
395
  end
438
396
  private :stack
439
-
397
+
440
398
  def group(*args, &block)
441
399
  stack << args
442
400
  block.call if block
@@ -0,0 +1,71 @@
1
+ #
2
+ # Copyright (C) 2013 Christian Meier
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ # this software and associated documentation files (the "Software"), to deal in
6
+ # the Software without restriction, including without limitation the rights to
7
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ # the Software, and to permit persons to whom the Software is furnished to do so,
9
+ # subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ #
21
+ # TODO make nice require after ruby-maven uses the same ruby files
22
+ require File.join(File.dirname(File.dirname(__FILE__)), 'model', 'model.rb')
23
+ require File.join(File.dirname(__FILE__), 'jarfile.rb')
24
+
25
+ module Maven
26
+ module Tools
27
+
28
+ class ArtifactPassthrough
29
+
30
+ def initialize(&block)
31
+ @block = block
32
+ end
33
+
34
+ def add_artifact(a)
35
+ @block.call(a)
36
+ end
37
+
38
+ def add_repository(name, url)
39
+ end
40
+ end
41
+
42
+ class MavenProject < Maven::Model::Project
43
+ tags :dummy
44
+
45
+ def load_mavenfile(file)
46
+ file = file.path if file.is_a?(File)
47
+ if File.exists? file
48
+ @current_file = file
49
+ content = File.read(file)
50
+ eval content
51
+ else
52
+ self
53
+ end
54
+ end
55
+
56
+ def load_jarfile(file)
57
+ jars = Jarfile.new(file)
58
+ if jars.exists?
59
+ container = ArtifactPassthrough.new do |a|
60
+ artifactId, groupId, extension, version = a.split(/:/)
61
+ send(extension.to_sym, "#{artifactId}:#{groupId}", version)
62
+ end
63
+ if !jars.exists_lock? || jars.mtime > jars.mtime_lock
64
+ jars.populate_unlocked container
65
+ end
66
+ jars.populate_locked container
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -20,6 +20,6 @@
20
20
  #
21
21
  module Maven
22
22
  module Tools
23
- VERSION = '0.32.4'.freeze
23
+ VERSION = '0.32.5'.freeze
24
24
  end
25
25
  end
@@ -22,13 +22,13 @@ module Maven
22
22
  module Tools
23
23
  unless defined? VERSIONS
24
24
  VERSIONS = {
25
- :jruby_rack => "1.1.13.1",
26
- :assembly_plugin => "2.3",
25
+ :jruby_rack => "1.1.13.2",
26
+ :assembly_plugin => "2.4",
27
27
  :war_plugin => "2.2",
28
28
  :jar_plugin => "2.4",
29
- :jruby_plugins => "0.29.4",
30
- :bundler_version => "1.2.3",
31
- :jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "1.7.3"
29
+ :jruby_plugins => "1.0.0-beta",
30
+ :bundler_version => "1.3.5",
31
+ :jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "1.7.4"
32
32
  }.freeze
33
33
  end
34
34
  end
@@ -21,6 +21,7 @@ XML
21
21
 
22
22
  it 'should setup a minimal project' do
23
23
  project = Maven::Model::Project.new
24
+ project.dump_pom 'pom-ng.xml'
24
25
  project.artifact_id = 'mini'
25
26
  project.parent('test:parent', '1.2.3')
26
27
  project.to_xml.should == <<-XML
@@ -148,25 +149,25 @@ XML
148
149
  <artifactId>project</artifactId>
149
150
  <version>0.0.0</version>
150
151
  <repositories>
152
+ <repository>
153
+ <id>rubygems-releases</id>
154
+ <url>http://rubygems-proxy.torquebox.org/releases</url>
155
+ </repository>
151
156
  <repository>
152
157
  <id>jboss-public-repository-group</id>
153
158
  <name>JBoss Public Maven Repository Group</name>
154
159
  <url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
155
160
  <releases>
156
- <checksumPolicy>strict</checksumPolicy>
157
161
  <enabled>false</enabled>
158
162
  <updatePolicy>never</updatePolicy>
163
+ <checksumPolicy>strict</checksumPolicy>
159
164
  </releases>
160
165
  <snapshots>
161
- <checksumPolicy>ignore</checksumPolicy>
162
166
  <enabled>true</enabled>
163
167
  <updatePolicy>daily</updatePolicy>
168
+ <checksumPolicy>ignore</checksumPolicy>
164
169
  </snapshots>
165
170
  </repository>
166
- <repository>
167
- <id>rubygems-releases</id>
168
- <url>http://rubygems-proxy.torquebox.org/releases</url>
169
- </repository>
170
171
  </repositories>
171
172
  <pluginRepositories>
172
173
  <pluginRepository>
@@ -343,6 +344,9 @@ XML
343
344
  <version>0.0.0</version>
344
345
  <build>
345
346
  <plugins>
347
+ <plugin>
348
+ <artifactId>maven-release-plugin</artifactId>
349
+ </plugin>
346
350
  <plugin>
347
351
  <artifactId>maven-clean-plugin</artifactId>
348
352
  <version>2.4.1</version>
@@ -355,9 +359,6 @@ XML
355
359
  <target>1.5</target>
356
360
  </configuration>
357
361
  </plugin>
358
- <plugin>
359
- <artifactId>maven-release-plugin</artifactId>
360
- </plugin>
361
362
  </plugins>
362
363
  </build>
363
364
  </project>
@@ -378,31 +379,31 @@ XML
378
379
  <plugins>
379
380
  <plugin>
380
381
  <groupId>de.saumya.mojo</groupId>
381
- <artifactId>cucumber-maven-plugin</artifactId>
382
+ <artifactId>gem-maven-plugin</artifactId>
383
+ <extensions>true</extensions>
382
384
  <executions>
383
385
  <execution>
384
- <id>in_phase_integration_test</id>
385
- <phase>integration-test</phase>
386
+ <id>in_phase_pre_integration_test</id>
387
+ <phase>pre-integration-test</phase>
386
388
  <goals>
387
- <goal>test</goal>
389
+ <goal>install</goal>
388
390
  </goals>
389
- <configuration>
390
- <cucumberArgs>--no-colors</cucumberArgs>
391
- </configuration>
392
391
  </execution>
393
392
  </executions>
394
393
  </plugin>
395
394
  <plugin>
396
395
  <groupId>de.saumya.mojo</groupId>
397
- <artifactId>gem-maven-plugin</artifactId>
398
- <extensions>true</extensions>
396
+ <artifactId>cucumber-maven-plugin</artifactId>
399
397
  <executions>
400
398
  <execution>
401
- <id>in_phase_pre_integration_test</id>
402
- <phase>pre-integration-test</phase>
399
+ <id>in_phase_integration_test</id>
400
+ <phase>integration-test</phase>
403
401
  <goals>
404
- <goal>install</goal>
402
+ <goal>test</goal>
405
403
  </goals>
404
+ <configuration>
405
+ <cucumberArgs>--no-colors</cucumberArgs>
406
+ </configuration>
406
407
  </execution>
407
408
  </executions>
408
409
  </plugin>
@@ -455,31 +456,6 @@ XML
455
456
  <version>0.0.0</version>
456
457
  <build>
457
458
  <plugins>
458
- <plugin>
459
- <artifactId>maven-war-plugin</artifactId>
460
- <configuration>
461
- <webResources>
462
- <resource>
463
- <directory>public</directory>
464
- </resource>
465
- <resource>
466
- <directory>.</directory>
467
- <includes>
468
- <include>app/**</include>
469
- <include>config/**</include>
470
- <include>lib/**</include>
471
- <include>vendor/**</include>
472
- <include>Gemfile</include>
473
- </includes>
474
- <targetPath>WEB-INF</targetPath>
475
- </resource>
476
- <resource>
477
- <directory>${gem.path}</directory>
478
- <targetPath>WEB-INF/gems</targetPath>
479
- </resource>
480
- </webResources>
481
- </configuration>
482
- </plugin>
483
459
  <plugin>
484
460
  <groupId>org.codehaus.mojo</groupId>
485
461
  <artifactId>gwt-maven-plugin</artifactId>
@@ -516,6 +492,31 @@ XML
516
492
  </connectors>
517
493
  </configuration>
518
494
  </plugin>
495
+ <plugin>
496
+ <artifactId>maven-war-plugin</artifactId>
497
+ <configuration>
498
+ <webResources>
499
+ <resource>
500
+ <directory>public</directory>
501
+ </resource>
502
+ <resource>
503
+ <directory>.</directory>
504
+ <targetPath>WEB-INF</targetPath>
505
+ <includes>
506
+ <include>app/**</include>
507
+ <include>config/**</include>
508
+ <include>lib/**</include>
509
+ <include>vendor/**</include>
510
+ <include>Gemfile</include>
511
+ </includes>
512
+ </resource>
513
+ <resource>
514
+ <directory>${gem.path}</directory>
515
+ <targetPath>WEB-INF/gems</targetPath>
516
+ </resource>
517
+ </webResources>
518
+ </configuration>
519
+ </plugin>
519
520
  </plugins>
520
521
  </build>
521
522
  </project>