maven-tools 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,54 @@ require File.join(File.dirname(__FILE__), 'dependencies.rb')
5
5
  module Maven
6
6
  module Model
7
7
 
8
+ class Resource < Tag
9
+
10
+ tags :directory, :includes, :excludes, :target_path, :filtering
11
+
12
+ def includes(&block)
13
+ @includes ||= NamedArray.new( 'includes' )
14
+ if block
15
+ block.call( @includes )
16
+ end
17
+ @includes
18
+ end
19
+
20
+ def excludes(&block)
21
+ @excludes ||= NamedArray.new( 'excludes' )
22
+ if block
23
+ block.call(@excludes)
24
+ end
25
+ @excludes
26
+ end
27
+
28
+ end
29
+
30
+ class TestResource < Resource
31
+ tags :dummy
32
+
33
+ def _name
34
+ 'testResource'
35
+ end
36
+ end
37
+
8
38
  class Build < Tag
9
- tags :source_directory, :script_source_directory, :test_source_directory, :output_directory, :test_output_directory, :default_goal, :directory, :final_name, :plugins, :plugin_management
39
+ tags :source_directory, :script_source_directory, :test_source_directory, :output_directory, :test_output_directory, :default_goal, :directory, :final_name, :plugins, :plugin_management, :resources, :test_resources
40
+
41
+ def resources(&block)
42
+ @resources ||= ResourceArray.new
43
+ if block
44
+ block.call(@resources)
45
+ end
46
+ @resources
47
+ end
48
+
49
+ def test_resources(&block)
50
+ @test_resources ||= ResourceArray.new( 'testResources', TestResource )
51
+ if block
52
+ block.call(@test_resources)
53
+ end
54
+ @test_resources
55
+ end
10
56
 
11
57
  def plugins(&block)
12
58
  @plugins ||= PluginHash.new
@@ -29,7 +75,7 @@ module Maven
29
75
  end
30
76
 
31
77
  def to_xml(buf = "", indent = "")
32
- if @final_name.nil? && (@plugins.nil? || @plugins.size == 0) && @plugin_management.nil? #TODO check the rest
78
+ if @final_name.nil? && (@resources.nil? || @resources.size == 0) && (@test_resources.nil? || @test_resources.size == 0) && (@plugins.nil? || @plugins.size == 0) && @plugin_management.nil? #TODO check the rest
33
79
  ""
34
80
  else
35
81
  super
@@ -276,12 +322,20 @@ module Maven
276
322
  self
277
323
  end
278
324
  end
325
+
326
+ class SourceControl < Tag
279
327
 
328
+ tags :connection, :developer_connection, :url
329
+
330
+ def _name
331
+ 'scm'
332
+ end
333
+ end
280
334
 
281
335
  class Project < Coordinate
282
336
  prepend_tags :model_version, :parent
283
337
 
284
- tags :name, :packaging, :description, :url, :developers, :licenses, :repositories, :plugin_repositories
338
+ tags :name, :packaging, :description, :url, :developers, :licenses, :repositories, :plugin_repositories, :scm
285
339
 
286
340
  include Dependencies
287
341
 
@@ -325,9 +379,16 @@ module Maven
325
379
 
326
380
  def parent(*args, &block)
327
381
  @parent ||= Parent.new(*args)
328
- @parent.call(block) if block
382
+ block.call( @parent ) if block
329
383
  @parent
330
384
  end
385
+
386
+ def source_control(&block)
387
+ @scm ||= SourceControl.new
388
+ block.call( @scm ) if block
389
+ @scm
390
+ end
391
+ alias :scm :source_control
331
392
 
332
393
  def execute_in_phase(phase, name = nil, &block)
333
394
  gem_plugin = plugin("gem")
@@ -114,6 +114,29 @@ EOF
114
114
  end
115
115
  end
116
116
 
117
+ class ResourceArray < Array
118
+
119
+ def initialize( name = 'resources', child = Resource, &block )
120
+ @_child = child
121
+ #super( name, &block )
122
+ if block
123
+ block.call self
124
+ end
125
+ self
126
+ end
127
+
128
+ alias :do_add :<<
129
+
130
+ def add( &block )
131
+ r = @_child.new
132
+ block.call( r )
133
+ do_add r
134
+ r
135
+ end
136
+ alias :<< :add
137
+
138
+ end
139
+
117
140
  class ModelHash < Hash
118
141
 
119
142
  def initialize(clazz)
@@ -326,7 +349,14 @@ EOF
326
349
  buf << "#{indent} <#{k}>\n"
327
350
  singular = k.to_s.sub(/s$/, '')
328
351
  v.each do |i|
329
- buf << "#{indent} <#{singular}>#{i}</#{singular}>\n"
352
+ case i
353
+ when Hash
354
+ buf << "#{indent} <#{singular}>\n"
355
+ map_to_xml(buf, indent + " ", i)
356
+ buf << "#{indent} </#{singular}>\n"
357
+ else
358
+ buf << "#{indent} <#{singular}>#{i}</#{singular}>\n"
359
+ end
330
360
  end
331
361
  buf << "#{indent} </#{k}>\n"
332
362
  when /\n$/
@@ -2,7 +2,7 @@ require File.join(File.dirname(__FILE__), 'gem_project.rb')
2
2
 
3
3
  proj = Maven::Tools::GemProject.new("in_phase_execution")
4
4
 
5
- proj.load(ARGV[0])
5
+ proj.load_mavenfile(ARGV[0])
6
6
 
7
7
  block = proj.executions_in_phase[ARGV[1]]
8
8
  block.call if block
@@ -233,7 +233,7 @@ module Maven
233
233
  if packaging =~ /gem/
234
234
  gem.extensions = true
235
235
  if @gemspec && !(self.gem?('jruby-openssl') || self.gem?('jruby-openssl-maven'))
236
- gem.gem('jruby-openssl-maven')
236
+ gem.gem('jruby-openssl')
237
237
  end
238
238
  end
239
239
  if File.exists?('lib') && File.exists?(File.join('src', 'main', 'java'))
@@ -1,5 +1,5 @@
1
1
  module Maven
2
2
  module Tools
3
- VERSION = '0.31.0'.freeze
3
+ VERSION = '0.32.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,143 +1,116 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: maven-tools
3
- version: !ruby/object:Gem::Version
4
- hash: 99
5
- prerelease:
6
- segments:
7
- - 0
8
- - 31
9
- - 0
10
- version: 0.31.0
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.32.0
11
6
  platform: ruby
12
- authors:
13
- - Kristian Meier
14
- autorequire:
7
+ authors:
8
+ - Christian Meier
9
+ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-01-20 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 10.0.3
24
21
  none: false
25
- requirements:
26
- - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 73
29
- segments:
30
- - 10
31
- - 0
32
- - 3
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
33
26
  version: 10.0.3
27
+ none: false
28
+ prerelease: false
34
29
  type: :development
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
30
+ - !ruby/object:Gem::Dependency
37
31
  name: minitest
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '4.4'
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '4.4'
40
43
  none: false
41
- requirements:
42
- - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 19
45
- segments:
46
- - 4
47
- - 4
48
- version: "4.4"
44
+ prerelease: false
49
45
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
46
+ - !ruby/object:Gem::Dependency
52
47
  name: rspec
53
- prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '='
51
+ - !ruby/object:Gem::Version
52
+ version: '2.7'
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '='
57
+ - !ruby/object:Gem::Version
58
+ version: '2.7'
55
59
  none: false
56
- requirements:
57
- - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 13
60
- segments:
61
- - 2
62
- - 7
63
- version: "2.7"
60
+ prerelease: false
64
61
  type: :development
65
- version_requirements: *id003
66
62
  description: adds versions conversion from rubygems to maven and vice versa, ruby DSL for POM (Project Object Model from maven), pom generators, etc
67
- email:
63
+ email:
68
64
  - m.kristian@web.de
69
65
  executables: []
70
-
71
66
  extensions: []
72
-
73
67
  extra_rdoc_files: []
74
-
75
- files:
68
+ files:
76
69
  - lib/maven_tools.rb
77
70
  - lib/maven-tools.rb
78
- - lib/maven-tools.rb~
79
- - lib/maven_tools.rb~
80
- - lib/maven/jarfile.rb~
81
71
  - lib/maven/tools/coordinate.rb
82
72
  - lib/maven/tools/execute_in_phase.rb
83
73
  - lib/maven/tools/version.rb
84
- - lib/maven/tools/jarfile.rb~
85
74
  - lib/maven/tools/jarfile.rb
86
75
  - lib/maven/tools/rails_project.rb
87
- - lib/maven/tools/versions.rb~
88
76
  - lib/maven/tools/gem_project.rb
89
- - lib/maven/tools/gem_project.rb~
90
77
  - lib/maven/tools/pom_generator.rb
91
- - lib/maven/tools/gemfile_lock.rb~
92
78
  - lib/maven/tools/gemfile_lock.rb
93
79
  - lib/maven/tools/minimal_project.rb
94
- - lib/maven/tools/coordinate.rb~
95
80
  - lib/maven/tools/versions.rb
96
81
  - lib/maven/model/utils.rb
97
- - lib/maven/model/dependencies.rb~
98
82
  - lib/maven/model/model.rb
99
83
  - lib/maven/model/dependencies.rb
100
- - lib/maven/model/model_utils.rb~
101
- - lib/maven/model/utils.rb~
102
- - lib/maven/model/model.rb~
103
- - lib/maven/maven_util.rb~
104
84
  - spec/coordinate_spec.rb
105
85
  - spec/jarfile_spec.rb
106
86
  - MIT-LICENSE
107
87
  - README.md
108
88
  homepage: http://github.com/torquebox/maven-tools
109
89
  licenses: []
110
-
111
- post_install_message:
90
+ post_install_message:
112
91
  rdoc_options: []
113
-
114
- require_paths:
92
+ require_paths:
115
93
  - lib
116
- required_ruby_version: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
119
96
  - - ">="
120
- - !ruby/object:Gem::Version
121
- hash: 3
122
- segments:
123
- - 0
124
- version: "0"
125
- required_rubygems_version: !ruby/object:Gem::Requirement
97
+ - !ruby/object:Gem::Version
98
+ version: !binary |-
99
+ MA==
126
100
  none: false
127
- requirements:
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
128
103
  - - ">="
129
- - !ruby/object:Gem::Version
130
- hash: 3
131
- segments:
132
- - 0
133
- version: "0"
104
+ - !ruby/object:Gem::Version
105
+ version: !binary |-
106
+ MA==
107
+ none: false
134
108
  requirements: []
135
-
136
- rubyforge_project:
137
- rubygems_version: 1.8.15
138
- signing_key:
109
+ rubyforge_project:
110
+ rubygems_version: 1.8.24
111
+ signing_key:
139
112
  specification_version: 3
140
113
  summary: helpers for maven related tasks
141
- test_files:
114
+ test_files:
142
115
  - spec/coordinate_spec.rb
143
116
  - spec/jarfile_spec.rb
data/lib/maven-tools.rb~ DELETED
@@ -1 +0,0 @@
1
- require 'maven_tools/jarfile'
@@ -1,77 +0,0 @@
1
- require 'jbundler/maven_util'
2
- module JBundler
3
-
4
- class Mavenfile
5
- include MavenUtil
6
-
7
- def initialize(file = 'Mvnfile')
8
- @file = file
9
- @lockfile = file + ".lock"
10
- end
11
-
12
- def mtime
13
- File.mtime(@file)
14
- end
15
-
16
- def exists?
17
- File.exists?(@file)
18
- end
19
-
20
- def mtime_lock
21
- File.mtime(@lockfile)
22
- end
23
-
24
- def exists_lock?
25
- File.exists?(@lockfile)
26
- end
27
-
28
- def load_lockfile
29
- _locked = []
30
- if exists_lock?
31
- File.read(@lockfile).each_line do |line|
32
- line.strip!
33
- if line.size > 0 && !(line =~ /^\s*#/)
34
- _locked << line
35
- end
36
- end
37
- end
38
- _locked
39
- end
40
-
41
- def locked
42
- @locked ||= load_lockfile
43
- end
44
-
45
- def locked?(coordinate)
46
- coord = coordinate.sub(/^([^:]+:[^:]+):.+/) { $1 }
47
- locked.detect { |l| l.sub(/^([^:]+:[^:]+):.+/) { $1 } == coord } != nil
48
- end
49
-
50
- def populate_unlocked(aether)
51
- File.read(@file).each_line do |line|
52
- if coord = to_coordinate(line)
53
- unless locked?(coord)
54
- aether.add_artifact(coord)
55
- end
56
- elsif line =~ /^\s*(repository|source)\s/
57
- name, url = line.sub(/.*(repository|source)\s+/, '').gsub(/['":]/,'').split(/,/)
58
- url = name unless url
59
- aether.add_repository(name, url)
60
- end
61
- end
62
- end
63
-
64
- def populate_locked(aether)
65
- locked.each { |l| aether.add_artifact(l) }
66
- end
67
-
68
- def generate_lockfile(dependency_coordinates)
69
- File.open(@lockfile, 'w') do |f|
70
- dependency_coordinates.each do |d|
71
- f.puts d.to_s
72
- end
73
- end
74
- end
75
- end
76
-
77
- end