maven-tools 0.34.5 → 1.0.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/lib/maven/tools/artifact.rb +18 -12
  3. data/lib/maven/tools/dsl.rb +282 -121
  4. data/lib/maven/tools/gemfile_lock.rb +0 -6
  5. data/lib/maven/tools/model.rb +78 -69
  6. data/lib/maven/tools/pom.rb +8 -8
  7. data/lib/maven/tools/version.rb +1 -1
  8. data/lib/maven/tools/versions.rb +4 -4
  9. data/lib/maven/tools/visitor.rb +2 -2
  10. data/spec/gemfile_with_lock/bouncy-castle-version.rb +4 -0
  11. data/spec/pom_maven_alternative_style/pom.rb +116 -169
  12. data/spec/pom_maven_hash_style/pom.rb +134 -100
  13. data/spec/pom_maven_style/pom.rb +160 -163
  14. data/spec/pom_spec.rb +3 -1
  15. metadata +12 -90
  16. data/lib/maven/model/dependencies.rb +0 -249
  17. data/lib/maven/model/model.rb +0 -618
  18. data/lib/maven/model/utils.rb +0 -393
  19. data/lib/maven/tools/execute_in_phase.rb +0 -28
  20. data/lib/maven/tools/gem_project.rb +0 -513
  21. data/lib/maven/tools/maven_project.rb +0 -72
  22. data/lib/maven/tools/minimal_project.rb +0 -84
  23. data/lib/maven/tools/pom_generator.rb +0 -83
  24. data/lib/maven/tools/rails_project.rb +0 -133
  25. data/rspec/maven/model/dependencies_spec.rb +0 -260
  26. data/rspec/maven/model/model_spec.rb +0 -714
  27. data/rspec/maven/tools/Gemfile.gems +0 -11
  28. data/rspec/maven/tools/Gemfile.groups +0 -15
  29. data/rspec/maven/tools/Gemfile.ignored +0 -30
  30. data/rspec/maven/tools/Gemfile.lockfile +0 -8
  31. data/rspec/maven/tools/Gemfile.lockfile.lock +0 -53
  32. data/rspec/maven/tools/Gemfile.minimal +0 -1
  33. data/rspec/maven/tools/Gemfile.nolock +0 -1
  34. data/rspec/maven/tools/Gemfile.rails +0 -16
  35. data/rspec/maven/tools/Gemfile.simple +0 -7
  36. data/rspec/maven/tools/Gemfile.withlock +0 -1
  37. data/rspec/maven/tools/Gemfile.withlock.lock +0 -28
  38. data/rspec/maven/tools/Jarfile.with +0 -2
  39. data/rspec/maven/tools/Jarfile.with.lock +0 -1
  40. data/rspec/maven/tools/Jarfile.without +0 -2
  41. data/rspec/maven/tools/deps.gemspec +0 -8
  42. data/rspec/maven/tools/gem_project_spec.rb +0 -1126
  43. data/rspec/maven/tools/maven-tools.gemspec +0 -17
  44. data/rspec/maven/tools/minimal.gemspec +0 -5
  45. data/rspec/maven/tools/no-deps.gemspec +0 -27
  46. data/rspec/maven/tools/rails_project_spec.rb +0 -284
  47. data/rspec/maven/tools/spec_helper.rb +0 -22
@@ -7,7 +7,9 @@ describe Maven::Tools::POM do
7
7
  if File.directory?( dir )
8
8
  it "should convert #{dir}" do
9
9
  pom = Maven::Tools::POM.new( dir )
10
- pom_xml = File.read( File.join( dir, 'pom.xml' ) )
10
+ file = File.join( dir, 'pom.xml' )
11
+ file = File.join( File.dirname( dir ), 'pom.xml' ) unless File.exists? file
12
+ pom_xml = File.read( file )
11
13
  pom_xml.sub!( /<!--(.|\n)*-->\n/, '' )
12
14
  pom_xml.sub!( /<?.*?>\n/, '' )
13
15
  pom_xml.sub!( /<project([^>]|\n)*>/, '<project>' )
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maven-tools
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.34.5
4
+ version: 1.0.0.rc2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Christian Meier
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-04-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: virtus
@@ -17,14 +16,12 @@ dependencies:
17
16
  requirements:
18
17
  - - ~>
19
18
  - !ruby/object:Gem::Version
20
- version: '0.5'
21
- none: false
19
+ version: '1.0'
22
20
  requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - ~>
25
23
  - !ruby/object:Gem::Version
26
- version: '0.5'
27
- none: false
24
+ version: '1.0'
28
25
  prerelease: false
29
26
  type: :runtime
30
27
  - !ruby/object:Gem::Dependency
@@ -34,13 +31,11 @@ dependencies:
34
31
  - - ~>
35
32
  - !ruby/object:Gem::Version
36
33
  version: '10.0'
37
- none: false
38
34
  requirement: !ruby/object:Gem::Requirement
39
35
  requirements:
40
36
  - - ~>
41
37
  - !ruby/object:Gem::Version
42
38
  version: '10.0'
43
- none: false
44
39
  prerelease: false
45
40
  type: :development
46
41
  - !ruby/object:Gem::Dependency
@@ -49,30 +44,12 @@ dependencies:
49
44
  requirements:
50
45
  - - ~>
51
46
  - !ruby/object:Gem::Version
52
- version: '4.4'
53
- none: false
47
+ version: '5.3'
54
48
  requirement: !ruby/object:Gem::Requirement
55
49
  requirements:
56
50
  - - ~>
57
51
  - !ruby/object:Gem::Version
58
- version: '4.4'
59
- none: false
60
- prerelease: false
61
- type: :development
62
- - !ruby/object:Gem::Dependency
63
- name: rspec
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 2.13.0
69
- none: false
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - '='
73
- - !ruby/object:Gem::Version
74
- version: 2.13.0
75
- none: false
52
+ version: '5.3'
76
53
  prerelease: false
77
54
  type: :development
78
55
  description: adds versions conversion from rubygems to maven and vice versa, ruby DSL for POM (Project Object Model from maven), pom generators, etc
@@ -84,25 +61,16 @@ extra_rdoc_files: []
84
61
  files:
85
62
  - lib/maven_tools.rb
86
63
  - lib/maven-tools.rb
87
- - lib/maven/model/utils.rb
88
- - lib/maven/model/model.rb
89
- - lib/maven/model/dependencies.rb
90
64
  - lib/maven/tools/visitor.rb
91
65
  - lib/maven/tools/version.rb
92
66
  - lib/maven/tools/artifact.rb
93
- - lib/maven/tools/rails_project.rb
94
- - lib/maven/tools/pom_generator.rb
95
67
  - lib/maven/tools/model.rb
96
68
  - lib/maven/tools/versions.rb
97
- - lib/maven/tools/maven_project.rb
98
69
  - lib/maven/tools/gemspec_dependencies.rb
99
- - lib/maven/tools/minimal_project.rb
100
70
  - lib/maven/tools/gemfile_lock.rb
101
71
  - lib/maven/tools/dsl.rb
102
72
  - lib/maven/tools/jarfile.rb
103
- - lib/maven/tools/execute_in_phase.rb
104
73
  - lib/maven/tools/pom.rb
105
- - lib/maven/tools/gem_project.rb
106
74
  - lib/maven/tools/coordinate.rb
107
75
  - spec/artifact_spec.rb
108
76
  - spec/jarfile_spec.rb
@@ -113,6 +81,7 @@ files:
113
81
  - spec/gemfile_with_source/bouncy-castle-version.rb
114
82
  - spec/pom_maven_style/pom.rb
115
83
  - spec/gemspec_in_profile/bouncy-castle-version.rb
84
+ - spec/gemfile_with_lock/bouncy-castle-version.rb
116
85
  - spec/pom_from_jarfile/pom.rb
117
86
  - spec/gemfile_include_jars/bouncy-castle-version.rb
118
87
  - spec/gemfile/bouncy-castle-version.rb
@@ -124,34 +93,12 @@ files:
124
93
  - spec/gemspec_with_extras/bouncy-castle-version.rb
125
94
  - spec/gemfile_with_extras/bouncy-castle-version.rb
126
95
  - spec/pom_maven_alternative_style/pom.rb
127
- - rspec/maven/model/dependencies_spec.rb
128
- - rspec/maven/model/model_spec.rb
129
- - rspec/maven/tools/rails_project_spec.rb
130
- - rspec/maven/tools/no-deps.gemspec
131
- - rspec/maven/tools/Gemfile.lockfile.lock
132
- - rspec/maven/tools/Jarfile.without
133
- - rspec/maven/tools/Jarfile.with
134
- - rspec/maven/tools/Gemfile.groups
135
- - rspec/maven/tools/Gemfile.minimal
136
- - rspec/maven/tools/Gemfile.simple
137
- - rspec/maven/tools/Gemfile.lockfile
138
- - rspec/maven/tools/gem_project_spec.rb
139
- - rspec/maven/tools/Gemfile.rails
140
- - rspec/maven/tools/minimal.gemspec
141
- - rspec/maven/tools/maven-tools.gemspec
142
- - rspec/maven/tools/Jarfile.with.lock
143
- - rspec/maven/tools/Gemfile.gems
144
- - rspec/maven/tools/spec_helper.rb
145
- - rspec/maven/tools/Gemfile.ignored
146
- - rspec/maven/tools/Gemfile.nolock
147
- - rspec/maven/tools/Gemfile.withlock.lock
148
- - rspec/maven/tools/deps.gemspec
149
- - rspec/maven/tools/Gemfile.withlock
150
96
  - MIT-LICENSE
151
97
  - README.md
152
98
  homepage: http://github.com/torquebox/maven-tools
153
99
  licenses:
154
100
  - MIT
101
+ metadata: {}
155
102
  post_install_message:
156
103
  rdoc_options: []
157
104
  require_paths:
@@ -161,18 +108,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
161
108
  - - '>='
162
109
  - !ruby/object:Gem::Version
163
110
  version: '0'
164
- none: false
165
111
  required_rubygems_version: !ruby/object:Gem::Requirement
166
112
  requirements:
167
- - - '>='
113
+ - - '>'
168
114
  - !ruby/object:Gem::Version
169
- version: '0'
170
- none: false
115
+ version: 1.3.1
171
116
  requirements: []
172
117
  rubyforge_project:
173
- rubygems_version: 1.8.24
118
+ rubygems_version: 2.1.9
174
119
  signing_key:
175
- specification_version: 3
120
+ specification_version: 4
176
121
  summary: helpers for maven related tasks
177
122
  test_files:
178
123
  - spec/artifact_spec.rb
@@ -180,26 +125,3 @@ test_files:
180
125
  - spec/coordinate_spec.rb
181
126
  - spec/pom_spec.rb
182
127
  - spec/gemspec_dependencies_spec.rb
183
- - rspec/maven/model/dependencies_spec.rb
184
- - rspec/maven/model/model_spec.rb
185
- - rspec/maven/tools/rails_project_spec.rb
186
- - rspec/maven/tools/no-deps.gemspec
187
- - rspec/maven/tools/Gemfile.lockfile.lock
188
- - rspec/maven/tools/Jarfile.without
189
- - rspec/maven/tools/Jarfile.with
190
- - rspec/maven/tools/Gemfile.groups
191
- - rspec/maven/tools/Gemfile.minimal
192
- - rspec/maven/tools/Gemfile.simple
193
- - rspec/maven/tools/Gemfile.lockfile
194
- - rspec/maven/tools/gem_project_spec.rb
195
- - rspec/maven/tools/Gemfile.rails
196
- - rspec/maven/tools/minimal.gemspec
197
- - rspec/maven/tools/maven-tools.gemspec
198
- - rspec/maven/tools/Jarfile.with.lock
199
- - rspec/maven/tools/Gemfile.gems
200
- - rspec/maven/tools/spec_helper.rb
201
- - rspec/maven/tools/Gemfile.ignored
202
- - rspec/maven/tools/Gemfile.nolock
203
- - rspec/maven/tools/Gemfile.withlock.lock
204
- - rspec/maven/tools/deps.gemspec
205
- - rspec/maven/tools/Gemfile.withlock
@@ -1,249 +0,0 @@
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__), 'utils.rb')
23
- require File.join(File.dirname(File.dirname(__FILE__)), 'tools', 'coordinate.rb')
24
- #require 'maven/tools/coordinate'
25
-
26
- module Maven
27
- module Model
28
-
29
- class DependencyArray < Array
30
- def <<(dep)
31
- raise "not of type Dependency" unless dep.is_a?(Dependency)
32
- d = detect { |item| item == dep }
33
- if d
34
- d.version = dep.version
35
- self
36
- else
37
- super
38
- end
39
- end
40
- alias :push :<<
41
- end
42
-
43
- class ExclusionArray < Array
44
- def <<(*dep)
45
- excl = dep[0].is_a?(Exclusion) ? dep[0]: Exclusion.new(*dep.flatten)
46
- delete_if { |item| item == excl }
47
- super excl
48
- end
49
- alias :push :<<
50
- end
51
-
52
- class Coordinate < Tag
53
-
54
- private
55
-
56
- include ::Maven::Tools::Coordinate
57
-
58
- public
59
-
60
- tags :group_id, :artifact_id, :version
61
- def initialize(*args)
62
- @group_id, @artifact_id, @version = gav(*args.flatten)
63
- end
64
-
65
- def version?
66
- !(@version.nil? || @version == '[0,)')
67
- end
68
-
69
- def hash
70
- "#{group_id}:#{artifact_id}".hash
71
- end
72
-
73
- def ==(other)
74
- group_id == other.group_id && artifact_id == other.artifact_id
75
- end
76
- alias :eql? :==
77
-
78
- end
79
-
80
- class Parent < Coordinate
81
- tags :relative_path
82
-
83
- end
84
-
85
- class Exclusion < Tag
86
- tags :group_id, :artifact_id
87
- def initialize(*args)
88
- @group_id, @artifact_id = group_artifact(*args)
89
- end
90
-
91
- def hash
92
- "#{group_id}:#{artifact_id}".hash
93
- end
94
-
95
- def ==(other)
96
- group_id == other.group_id && artifact_id == other.artifact_id
97
- end
98
- alias :eql? :==
99
-
100
- private
101
-
102
- include ::Maven::Tools::Coordinate
103
- end
104
-
105
- class Dependency < Coordinate
106
- tags :type, :scope, :classifier, :exclusions
107
- def initialize(type, *args)
108
- super(*args)
109
- @type = type
110
- args.flatten!
111
- if args[0] =~ /:/ && args.size == 3
112
- @classifier = args[2] unless args[2] =~ /[=~><]/
113
- elsif args.size == 4
114
- @classifier = args[3] unless args[3] =~ /[=~><]/
115
- end
116
- end
117
-
118
- def hash
119
- "#{group_id}:#{artifact_id}:#{@type}:#{@classifier}".hash
120
- end
121
-
122
- def ==(other)
123
- super && @type == other.instance_variable_get(:@type) && @classifier == other.instance_variable_get(:@classifier)
124
- end
125
- alias :eql? :==
126
-
127
- def self.new_gem(gemname, *args)
128
- new(:gem, "rubygems", gemname, *args)
129
- end
130
-
131
- def self.new_pom(*args)
132
- new(:pom, *args)
133
- end
134
-
135
- def self.new_jar(*args)
136
- new(:jar, *args)
137
- end
138
-
139
- def self.new_test_jar(*args)
140
- result = new(:jar, *args)
141
- result.scope :test
142
- result
143
- end
144
-
145
- def exclusions(&block)
146
- @exclusions ||= ExclusionArray.new
147
- if block
148
- block.call(@exclusions)
149
- end
150
- @exclusions
151
- end
152
-
153
- def exclude(*args)
154
- exclusions << args
155
- end
156
- end
157
-
158
- module Dependencies
159
-
160
- def self.included(parent)
161
- parent.tags :dependencies
162
- end
163
-
164
- def jar?(*args)
165
- dependencies.member?(Dependency.new(:jar, *args))
166
- end
167
-
168
- def test_jar?(*args)
169
- dependencies.member?(Dependency.new_test_jar(*args))
170
- end
171
-
172
- def gem?(*args)
173
- dependencies.member?(Dependency.new(:gem, ['rubygems', *args].flatten))
174
- end
175
-
176
- def detect_gem(name)
177
- dependencies.detect { |d| d.type.to_sym == :gem && d.artifact_id == name }
178
- end
179
-
180
- def pom?(*args)
181
- dependencies.member?(Dependency.new_pom(*args))
182
- end
183
-
184
- def dependencies(&block)
185
- @dependencies ||= DependencyArray.new
186
- if block
187
- block.call(self)
188
- end
189
- @dependencies
190
- end
191
-
192
- def add_dependency(dep, has_version = true, &block)
193
- d = dependencies.detect { |d| d == dep }
194
- if d
195
- if has_version
196
- d.version = dep.version
197
- end
198
- dep = d
199
- else
200
- dependencies << dep
201
- end
202
- block.call(dep) if block
203
- dep
204
- end
205
- private :add_dependency
206
-
207
- def add_gem(*args, &block)
208
- args = args.flatten
209
- if args.size == 1
210
- dep = Dependency.new_gem(*args)
211
- dep = dependencies.detect { |d| d == dep }
212
- if dep
213
- return dep
214
- end
215
- args[1] = ">= 0"
216
- end
217
- add_dependency(Dependency.new_gem(*args), &block)
218
- end
219
- private :add_gem
220
-
221
- def add_something(method, args, block = nil)
222
- if args.last.is_a?(Hash)
223
- raise "hash not allowed for #{method.to_s.sub /new_/, ''}"
224
- end
225
- add_dependency(Dependency.send( method, *args), *args.size > 1, &block)
226
- end
227
- private :add_something
228
-
229
- def jar(*args, &block)
230
- add_something( :new_jar, args, block )
231
- end
232
-
233
- def test_jar(*args, &block)
234
- add_something( :new_test_jar, args, block )
235
- end
236
-
237
- def gem(*args, &block)
238
- if args.last.is_a?(Hash)
239
- raise "hash not allowed in that context"
240
- end
241
- add_gem(args, &block)
242
- end
243
-
244
- def pom(*args, &block)
245
- add_something( :new_pom, args, block )
246
- end
247
- end
248
- end
249
- end