maven-tools 0.30.0 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1 +1,21 @@
1
- # maven tools [![Build Status](https://secure.travis-ci.org/torquebox/maven-tools.png)](http://travis-ci.org/torquebox/maven-tools) #
1
+ maven tools
2
+ ===========
3
+
4
+ * [![Build Status](https://secure.travis-ci.org/torquebox/maven-tools.png)](http://travis-ci.org/torquebox/maven-tools)
5
+ * [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/torquebox/maven-tools)
6
+
7
+
8
+ Contributing
9
+ ------------
10
+
11
+ 1. Fork it
12
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
13
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
14
+ 4. Push to the branch (`git push origin my-new-feature`)
15
+ 5. Create new Pull Request
16
+
17
+ meta-fu
18
+ -------
19
+
20
+ enjoy :)
21
+
@@ -198,18 +198,20 @@ module Maven
198
198
  end
199
199
  private :add_gem
200
200
 
201
- def jar(*args, &block)
201
+ def add_something(method, args, block = nil)
202
202
  if args.last.is_a?(Hash)
203
- raise "hash not allowed for jar"
203
+ raise "hash not allowed for #{method.to_s.sub /new_/, ''}"
204
204
  end
205
- add_dependency(Dependency.new_jar(args), args.size > 1, &block)
205
+ add_dependency(Dependency.send( method, *args), *args.size > 1, &block)
206
+ end
207
+ private :add_something
208
+
209
+ def jar(*args, &block)
210
+ add_something( :new_jar, args, block )
206
211
  end
207
212
 
208
213
  def test_jar(*args, &block)
209
- if args.last.is_a?(Hash)
210
- raise "hash not allowed for test_jar"
211
- end
212
- add_dependency(Dependency.new_test_jar(args), args.size > 1, &block)
214
+ add_something( :new_test_jar, args, block )
213
215
  end
214
216
 
215
217
  def gem(*args, &block)
@@ -220,10 +222,7 @@ module Maven
220
222
  end
221
223
 
222
224
  def pom(*args, &block)
223
- if args.last.is_a?(Hash)
224
- raise "hash not allowed in that context"
225
- end
226
- add_dependency(Dependency.new_pom(args), args.size > 1, &block)
225
+ add_something( :new_pom, args, block )
227
226
  end
228
227
  end
229
228
  end
@@ -250,7 +250,7 @@ module Maven
250
250
  @email = args[2]
251
251
  end
252
252
  @email = @email[0] if @email.is_a? Array # this produces a partial list
253
- @id = @email.sub(/@/, '_at_').gsub(/\./, '_dot_') unless @id
253
+ @id = (@email || @name).sub(/@/, '_at_').gsub(/\./, '_dot_').gsub(/ /, '_') unless @id
254
254
  self
255
255
  end
256
256
  end
@@ -81,7 +81,7 @@ EOF
81
81
  when Hash
82
82
  if val.size > 0
83
83
  buf << "#{indent} <#{var}>\n"
84
- val.keys.each do |k|
84
+ val.keys.sort{ |n,m| n.to_s <=> m.to_s }.each do |k|
85
85
  v = val[k]
86
86
  if v.is_a? Tag
87
87
  v.to_xml(buf, indent + " ")
@@ -152,48 +152,47 @@ EOF
152
152
  default_model.send(method, *args, &block)
153
153
  end
154
154
  end
155
-
156
- class DeveloperHash < Hash
155
+
156
+ class NamedHash < Hash
157
157
 
158
158
  def keys
159
159
  @keys ||= []
160
160
  end
161
161
 
162
- def get(*args, &block)
163
- developer = if args.size == 1 && args[0].is_a?(Developer)
164
- args[0]
165
- else
166
- Developer.new(*args)
167
- end
168
- keys << developer.id unless keys.member? developer.id
169
- self[developer.id] = developer
162
+ def new_instance( clazz, args )
163
+ if args.size == 1 && args[0].is_a?(clazz)
164
+ args[0]
165
+ else
166
+ clazz.new(*args)
167
+ end
168
+ end
169
+
170
+ def do_get( clazz, args, method, block = nil)
171
+ value = new_instance( clazz, args )
172
+ key = value.send method
173
+ keys << key unless keys.member? key
174
+ self[ key ] = value
170
175
  if block
171
- block.call(developer)
176
+ block.call( value )
172
177
  end
173
- developer
178
+ value
174
179
  end
175
- alias :new :get
176
- alias :add :get
180
+ def get; end
177
181
  end
178
182
 
179
- class LicenseHash < Hash
183
+ class DeveloperHash < NamedHash
180
184
 
181
- def keys
182
- @keys ||= []
185
+ def get( *args, &block )
186
+ do_get( Developer, args, :id, block )
183
187
  end
188
+ alias :new :get
189
+ alias :add :get
190
+ end
184
191
 
185
- def get(*args, &block)
186
- license = if args.size == 1 && args[0].is_a?(License)
187
- args[0]
188
- else
189
- License.new(*args)
190
- end
191
- keys << license.name unless keys.member? license.name
192
- self[license.name] = license
193
- if block
194
- block.call(license)
195
- end
196
- license
192
+ class LicenseHash < NamedHash
193
+
194
+ def get( *args, &block )
195
+ do_get( License, args, :name, block )
197
196
  end
198
197
  alias :new :get
199
198
  alias :add :get
@@ -4,11 +4,19 @@ module Maven
4
4
 
5
5
  def to_coordinate(line)
6
6
  if line =~ /^\s*(jar|pom)\s/
7
-
8
- group_id, artifact_id, version, second_version = line.sub(/\s*[a-z]+\s+/, '').sub(/#.*/,'').gsub(/\s+/,'').gsub(/['"],/, ':').gsub(/['"]/, '').split(/:/)
7
+ packaging = line.strip.sub(/\s+.*/, '')
8
+
9
+ # Remove packaging, comments and whitespaces
10
+ sanitized_line = line.sub(/\s*[a-z]+\s+/, '').sub(/#.*/,'').gsub(/\s+/,'')
11
+
12
+ # Remove version(s) and quotes to find the group id, artifact id and classifier
13
+ group_id, artifact_id, classifier = sanitized_line.split(',')[0].gsub(/['"]/, '').split(/:/)
14
+
15
+ # Remove the group id, artifact id and classifier to find the version(s)
16
+ version, second_version = sanitized_line.split(',')[1..-1].join(',').gsub(/['"],/, ':').gsub(/['"]/, '').split(/:/)
9
17
  mversion = second_version ? to_version(version, second_version) : to_version(version)
10
- extension = line.strip.sub(/\s+.*/, '')
11
- "#{group_id}:#{artifact_id}:#{extension}:#{mversion}"
18
+
19
+ classifier ? "#{group_id}:#{artifact_id}:#{packaging}:#{classifier}:#{mversion}" : "#{group_id}:#{artifact_id}:#{packaging}:#{mversion}"
12
20
  end
13
21
  end
14
22
 
@@ -54,9 +54,14 @@ module Maven
54
54
  name spec.summary || "#{self.artifact_id} - gem"
55
55
  description spec.description if spec.description
56
56
  url spec.homepage if spec.homepage
57
+ done_authors = []
57
58
  (spec.email || []).zip(spec.authors || []).map do |email, author|
59
+ done_authors << author
58
60
  self.developers.new(author, email)
59
61
  end
62
+ (spec.authors - done_authors).each do |author|
63
+ self.developers.new(author, nil)
64
+ end
60
65
 
61
66
  # TODO work with collection of licenses - there can be more than one !!!
62
67
  (spec.licenses + spec.files.select {|file| file.to_s =~ /license|gpl/i }).each do |license|
@@ -338,8 +343,8 @@ module Maven
338
343
  options = {
339
344
  :lifecycleMappingMetadata => {
340
345
  :pluginExecutions => Maven::Model::NamedArray.new(:pluginExecution) do |e|
341
- # sort them for testing
342
- configs.sort {|m,n| -1 *(n.first[1][:artifactId].to_s <=> m.first[1][:artifactId].to_s) }.each { |c| e << c }
346
+ # sort them - handy for testing
347
+ configs.sort {|m,n| m[:pluginExecutionFilter][:artifactId].to_s <=> n[:pluginExecutionFilter][:artifactId].to_s }.each { |c| e << c }
343
348
  end
344
349
  }
345
350
  }
@@ -1,5 +1,5 @@
1
1
  module Maven
2
2
  module Tools
3
- VERSION = '0.30.0'.freeze
3
+ VERSION = '0.31.0'.freeze
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ module Maven
8
8
  :jar_plugin => "2.4",
9
9
  :jruby_plugins => "0.29.0",
10
10
  :bundler_version => "1.1.4",
11
- :jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "1.6.7.2"
11
+ :jruby_version => defined?(JRUBY_VERSION) ? JRUBY_VERSION : "1.6.8"
12
12
  }.freeze
13
13
  end
14
14
  end
@@ -44,4 +44,15 @@ describe Maven::Tools::Coordinate do
44
44
  subject.to_coordinate('pom "e:f", "[1.8,1.9.9)"').must_equal "e:f:pom:[1.8,1.9.9)"
45
45
  subject.to_coordinate('pom "f:g", ">1.2", "<=2.0"').must_equal "f:g:pom:(1.2,2.0]"
46
46
  end
47
+
48
+ it 'should support classifiers' do
49
+ subject.to_coordinate('something "a:b:jdk15"').must_be_nil
50
+ subject.to_coordinate('#jar "a:b:jdk15"').must_be_nil
51
+ subject.to_coordinate('jar "a:b:jdk15" # bla').must_equal "a:b:jar:jdk15:[0,)"
52
+ subject.to_coordinate("pom 'b:c:jdk15', '!2.3.4'").must_equal "b:c:pom:jdk15:(2.3.4,)"
53
+ subject.to_coordinate('jar "c:d:jdk15", "2.3.4"').must_equal "c:d:jar:jdk15:2.3.4"
54
+ subject.to_coordinate("jar 'd:e:jdk15', '~>1.8.2'").must_equal "d:e:jar:jdk15:[1.8.2,1.8.99999]"
55
+ subject.to_coordinate('pom "e:f:jdk15", "[1.8,1.9.9)"').must_equal "e:f:pom:jdk15:[1.8,1.9.9)"
56
+ subject.to_coordinate('pom "f:g:jdk15", ">1.2", "<=2.0"').must_equal "f:g:pom:jdk15:(1.2,2.0]"
57
+ end
47
58
  end
metadata CHANGED
@@ -1,53 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maven-tools
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 99
4
5
  prerelease:
5
- version: 0.30.0
6
+ segments:
7
+ - 0
8
+ - 31
9
+ - 0
10
+ version: 0.31.0
6
11
  platform: ruby
7
12
  authors:
8
- - Kristian Meier
13
+ - Kristian Meier
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2012-11-06 00:00:00 Z
18
+ date: 2013-01-20 00:00:00 Z
14
19
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rake
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
23
- version: 0.9.2.2
24
- type: :development
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: minitest
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
34
- version: 2.10.0
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
45
- version: 2.7.0
46
- type: :development
47
- version_requirements: *id003
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 73
29
+ segments:
30
+ - 10
31
+ - 0
32
+ - 3
33
+ version: 10.0.3
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: minitest
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 19
45
+ segments:
46
+ - 4
47
+ - 4
48
+ version: "4.4"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rspec
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ hash: 13
60
+ segments:
61
+ - 2
62
+ - 7
63
+ version: "2.7"
64
+ type: :development
65
+ version_requirements: *id003
48
66
  description: adds versions conversion from rubygems to maven and vice versa, ruby DSL for POM (Project Object Model from maven), pom generators, etc
49
67
  email:
50
- - m.kristian@web.de
68
+ - m.kristian@web.de
51
69
  executables: []
52
70
 
53
71
  extensions: []
@@ -55,38 +73,38 @@ extensions: []
55
73
  extra_rdoc_files: []
56
74
 
57
75
  files:
58
- - lib/maven_tools.rb
59
- - lib/maven-tools.rb
60
- - lib/maven-tools.rb~
61
- - lib/maven_tools.rb~
62
- - lib/maven/jarfile.rb~
63
- - lib/maven/maven_util.rb~
64
- - lib/maven/tools/coordinate.rb
65
- - lib/maven/tools/execute_in_phase.rb
66
- - lib/maven/tools/version.rb
67
- - lib/maven/tools/jarfile.rb~
68
- - lib/maven/tools/jarfile.rb
69
- - lib/maven/tools/rails_project.rb
70
- - lib/maven/tools/versions.rb~
71
- - lib/maven/tools/gem_project.rb
72
- - lib/maven/tools/gem_project.rb~
73
- - lib/maven/tools/pom_generator.rb
74
- - lib/maven/tools/gemfile_lock.rb~
75
- - lib/maven/tools/gemfile_lock.rb
76
- - lib/maven/tools/minimal_project.rb
77
- - lib/maven/tools/coordinate.rb~
78
- - lib/maven/tools/versions.rb
79
- - lib/maven/model/utils.rb
80
- - lib/maven/model/dependencies.rb~
81
- - lib/maven/model/model.rb
82
- - lib/maven/model/dependencies.rb
83
- - lib/maven/model/model_utils.rb~
84
- - lib/maven/model/utils.rb~
85
- - lib/maven/model/model.rb~
86
- - spec/coordinate_spec.rb
87
- - spec/jarfile_spec.rb
88
- - MIT-LICENSE
89
- - README.md
76
+ - lib/maven_tools.rb
77
+ - lib/maven-tools.rb
78
+ - lib/maven-tools.rb~
79
+ - lib/maven_tools.rb~
80
+ - lib/maven/jarfile.rb~
81
+ - lib/maven/tools/coordinate.rb
82
+ - lib/maven/tools/execute_in_phase.rb
83
+ - lib/maven/tools/version.rb
84
+ - lib/maven/tools/jarfile.rb~
85
+ - lib/maven/tools/jarfile.rb
86
+ - lib/maven/tools/rails_project.rb
87
+ - lib/maven/tools/versions.rb~
88
+ - lib/maven/tools/gem_project.rb
89
+ - lib/maven/tools/gem_project.rb~
90
+ - lib/maven/tools/pom_generator.rb
91
+ - lib/maven/tools/gemfile_lock.rb~
92
+ - lib/maven/tools/gemfile_lock.rb
93
+ - lib/maven/tools/minimal_project.rb
94
+ - lib/maven/tools/coordinate.rb~
95
+ - lib/maven/tools/versions.rb
96
+ - lib/maven/model/utils.rb
97
+ - lib/maven/model/dependencies.rb~
98
+ - lib/maven/model/model.rb
99
+ - 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
+ - spec/coordinate_spec.rb
105
+ - spec/jarfile_spec.rb
106
+ - MIT-LICENSE
107
+ - README.md
90
108
  homepage: http://github.com/torquebox/maven-tools
91
109
  licenses: []
92
110
 
@@ -94,26 +112,32 @@ post_install_message:
94
112
  rdoc_options: []
95
113
 
96
114
  require_paths:
97
- - lib
115
+ - lib
98
116
  required_ruby_version: !ruby/object:Gem::Requirement
99
117
  none: false
100
118
  requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: "0"
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
124
+ version: "0"
104
125
  required_rubygems_version: !ruby/object:Gem::Requirement
105
126
  none: false
106
127
  requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: "0"
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
110
134
  requirements: []
111
135
 
112
136
  rubyforge_project:
113
- rubygems_version: 1.8.24
137
+ rubygems_version: 1.8.15
114
138
  signing_key:
115
139
  specification_version: 3
116
140
  summary: helpers for maven related tasks
117
141
  test_files:
118
- - spec/coordinate_spec.rb
119
- - spec/jarfile_spec.rb
142
+ - spec/coordinate_spec.rb
143
+ - spec/jarfile_spec.rb