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
Binary file
Binary file
Binary file
Binary file
data/lib/ext/README.txt CHANGED
@@ -1,2 +1,2 @@
1
- Use this directory to contribute 3rd-party extensions to the Maven core. These extensions can either extend or override
2
- Maven's default implementation.
1
+ Use this directory to contribute 3rd-party extensions to the Maven core. These extensions can either extend or override
2
+ Maven's default implementation.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -10,12 +10,11 @@ module Maven
10
10
  :rake => [:rake],
11
11
  :jruby => [:jruby, :compile],
12
12
  :gem => [:package, :install, :push, :exec, :pom, :initialize, :irb],
13
- :gemify => [:gemify, :versions],
14
- :rails2 => [:new, :generate, :rake, :server, :console],
15
13
  :rails3 => [:new, :generate, :rake, :server, :console, :dbconsole, :pom, :initialize],
16
14
  :cucumber => [:test],
17
15
  :rspec => [:test],
18
16
  :runit => [:test],
17
+ :mini => [:test,:spec],
19
18
  :bundler => [:install, :update]
20
19
  }
21
20
  ALIASES = {
@@ -136,9 +135,9 @@ module Maven
136
135
  def options_array
137
136
  options.collect do |k,v|
138
137
  if k =~ /^-D/
139
- v = "=#{v}" if v
138
+ v = "=#{v}" unless v.nil?
140
139
  else
141
- v = " #{v}" if v
140
+ v = " #{v}" unless v.nil?
142
141
  end
143
142
  "#{k}#{v}"
144
143
  end
@@ -150,6 +149,10 @@ module Maven
150
149
  args
151
150
  end
152
151
 
152
+ def new_rails_project
153
+ Maven::Tools::RailsProject.new
154
+ end
155
+
153
156
  def generate_pom(*args)
154
157
  unless args.member?("-f") || args.member?("--file")
155
158
  gemfiles = Dir["*Gemfile"]
@@ -157,12 +160,12 @@ module Maven
157
160
  if gemfiles.size > 0
158
161
  proj =
159
162
  if File.exists? File.join( 'config', 'application.rb' )
160
- Maven::Tools::RailsProject.new
163
+ new_rails_project
161
164
  else
162
165
  Maven::Tools::GemProject.new
163
166
  end
164
167
  filename = gemfiles[0]
165
- proj.load(filename)
168
+ proj.load_gemfile(filename)
166
169
  else
167
170
  gemspecs = Dir["*.gemspec"]
168
171
  gemspecs.delete_if {|g| g =~ /.pom/}
@@ -173,9 +176,12 @@ module Maven
173
176
  end
174
177
  end
175
178
  if filename
176
- proj.load(File.join(File.dirname(filename), 'Mavenfile'))
179
+ proj.load_jarfile(File.join(File.dirname(filename), 'Jarfile'))
180
+ proj.load_gemfile(File.join(File.dirname(filename), 'Mavenfile'))
177
181
  proj.add_defaults
178
- pom = filename + ".pom"
182
+ #target = File.join(File.dirname(filename), 'target')
183
+ #FileUtils.mkdir_p target
184
+ pom = ".pom.xml"
179
185
  File.open(pom, 'w') do |f|
180
186
  f.puts proj.to_xml
181
187
  end
@@ -194,7 +200,7 @@ module Maven
194
200
  a << options_array
195
201
  a.flatten!
196
202
  a = generate_pom(*a) unless no_pom
197
- puts a.join ' ' if verbose
203
+ puts "mvn #{a.join(' ')}" if verbose
198
204
  if defined? JRUBY_VERSION
199
205
  # TODO use a setup like maven_gemify from jruby to launch maven
200
206
  launch_java(a)
@@ -204,8 +210,17 @@ module Maven
204
210
  end
205
211
 
206
212
  def exec_in(launchdirectory, *args)
213
+ succeeded = nil
207
214
  FileUtils.cd(launchdirectory) do
208
- exec(args)
215
+ succeeded = exec(args)
216
+ end
217
+ succeeded
218
+ end
219
+
220
+ def dump_pom(force = false, file = 'pom.xml')
221
+ if force || !File.exists?(file)
222
+ generate_pom
223
+ FileUtils.cp(".pom.xml", file)
209
224
  end
210
225
  end
211
226
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-maven
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: 13
5
- version: 3.0.3.0.29.0.pre
4
+ prerelease:
5
+ version: 3.0.4.0.29.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - mkristian
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-04-17 00:00:00 Z
13
+ date: 2012-06-13 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -23,13 +23,22 @@ dependencies:
23
23
  version: 0.14.6
24
24
  type: :runtime
25
25
  version_requirements: *id001
26
- description: maven support for rubygems based on maven 3.0. it allows to use xyz.gemspec file as pom file or the usual pom.xml files. with a rails3 application with a Gemfile (suitable for jruby) you can run jetty as development server. this gem is a stripped polyglot-maven which includes only the jruby part. the executable runs only with jruby.
26
+ - !ruby/object:Gem::Dependency
27
+ name: maven-tools
28
+ prerelease: false
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ~>
33
+ - !ruby/object:Gem::Version
34
+ version: 0.29.1
35
+ type: :runtime
36
+ version_requirements: *id002
37
+ description: maven support for rubygems based on maven 3.0. it allows to use xyz.gemspec file as pom file or the usual pom.xml files. with a rails3 application with a Gemfile (suitable for jruby). you need java installed or jruby but it will run with MRI (without installed jruby) since the maven will take care of the jruby to use.
27
38
  email:
28
39
  - m.kristian@web.de
29
40
  executables:
30
41
  - rmvn
31
- - gwt
32
- - jetty-run
33
42
  extensions: []
34
43
 
35
44
  extra_rdoc_files:
@@ -40,9 +49,6 @@ files:
40
49
  - LICENSE.txt
41
50
  - NOTICE.txt
42
51
  - README.txt
43
- - bin/gwt
44
- - bin/tomcat-run
45
- - bin/jetty-run
46
52
  - bin/mvnDebug.bat
47
53
  - bin/mvn
48
54
  - bin/mvn.bat
@@ -52,51 +58,39 @@ files:
52
58
  - bin/m2.conf
53
59
  - boot/plexus-classworlds-2.4.jar
54
60
  - conf/settings.xml
55
- - lib/plexus-cipher-1.4.jar
56
- - lib/maven-core-3.0.3.jar
57
- - lib/aether-util-1.11.jar
58
- - lib/maven-settings-builder-3.0.3.jar
59
- - lib/wagon-provider-api-1.0-beta-7.jar
60
- - lib/ruby-maven-3.0.3.0.29.0.pre.jar
61
- - lib/maven-settings-3.0.3.jar
62
- - lib/maven-embedder-3.0.3.jar
63
- - lib/maven-aether-provider-3.0.3.jar
61
+ - lib/maven-settings-3.0.4.jar
62
+ - lib/sisu-guava-0.9.9.jar
63
+ - lib/wagon-http-2.2-shaded.jar
64
+ - lib/aether-api-1.13.1.jar
64
65
  - lib/plexus-component-annotations-1.5.5.jar
65
- - lib/wagon-http-shared-1.0-beta-7.jar
66
- - lib/maven-model-builder-3.0.3.jar
67
- - lib/maven-repository-metadata-3.0.3.jar
68
- - lib/maven-model-3.0.3.jar
69
- - lib/aether-spi-1.11.jar
70
- - lib/wagon-file-1.0-beta-7.jar
66
+ - lib/aether-spi-1.13.1.jar
67
+ - lib/maven-repository-metadata-3.0.4.jar
68
+ - lib/maven-compat-3.0.4.jar
69
+ - lib/maven-core-3.0.4.jar
70
+ - lib/aether-impl-1.13.1.jar
71
+ - lib/plexus-cipher-1.7.jar
71
72
  - lib/plexus-utils-2.0.6.jar
72
- - lib/aether-connector-wagon-1.11.jar
73
- - lib/aether-impl-1.11.jar
74
- - lib/nekohtml-1.9.6.2.jar
75
- - lib/sisu-inject-plexus-2.1.1.jar
73
+ - lib/maven-artifact-3.0.4.jar
74
+ - lib/maven-model-builder-3.0.4.jar
75
+ - lib/sisu-inject-bean-2.3.0.jar
76
+ - lib/maven-aether-provider-3.0.4.jar
77
+ - lib/wagon-provider-api-2.2.jar
78
+ - lib/maven-settings-builder-3.0.4.jar
79
+ - lib/maven-model-3.0.4.jar
80
+ - lib/maven-plugin-api-3.0.4.jar
76
81
  - lib/plexus-interpolation-1.14.jar
77
- - lib/maven-plugin-api-3.0.3.jar
78
- - lib/wagon-http-lightweight-1.0-beta-7.jar
79
- - lib/aether-api-1.11.jar
80
- - lib/sisu-guice-2.9.4-no_aop.jar
81
- - lib/maven-artifact-3.0.3.jar
82
- - lib/maven-compat-3.0.3.jar
82
+ - lib/aether-connector-wagon-1.13.1.jar
83
+ - lib/wagon-file-2.2.jar
84
+ - lib/aether-util-1.13.1.jar
85
+ - lib/maven-embedder-3.0.4.jar
83
86
  - lib/commons-cli-1.2.jar
84
- - lib/xercesMinimal-1.9.6.2.jar
85
- - lib/sisu-inject-bean-2.1.1.jar
87
+ - lib/sisu-guice-3.1.0-no_aop.jar
86
88
  - lib/plexus-sec-dispatcher-1.3.jar
89
+ - lib/sisu-inject-plexus-2.3.0.jar
87
90
  - lib/ext/README.txt
88
91
  - lib/ruby/ruby_maven.rb
89
92
  - lib/ruby/ruby-maven.rb
90
93
  - lib/ruby/maven/cucumber_steps.rb
91
- - lib/ruby/maven/tools/execute_in_phase.rb
92
- - lib/ruby/maven/tools/rails_project.rb
93
- - lib/ruby/maven/tools/gem_project.rb
94
- - lib/ruby/maven/tools/pom_generator.rb
95
- - lib/ruby/maven/tools/gemfile_lock.rb
96
- - lib/ruby/maven/tools/versions.rb
97
- - lib/ruby/maven/model/model_utils.rb
98
- - lib/ruby/maven/model/model.rb
99
- - lib/ruby/maven/model/dependencies.rb
100
94
  homepage: http://github.com/mkristian/ruby-maven
101
95
  licenses: []
102
96
 
@@ -121,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
115
  requirements: []
122
116
 
123
117
  rubyforge_project:
124
- rubygems_version: 1.8.9
118
+ rubygems_version: 1.8.24
125
119
  signing_key:
126
120
  specification_version: 3
127
121
  summary: maven support for ruby projects with gemspec, Gemfile
data/bin/gwt DELETED
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'ruby_maven'
3
- require 'thor'
4
-
5
- class GWTCommand < Thor
6
- no_tasks do
7
- def mvn
8
- @mvn ||= Maven::RubyMaven.new
9
- end
10
-
11
- def exec(*args)
12
- ARGV.clear # clean up in case another script gets executed
13
- print "maven commandline: "
14
- mvn.exec(args)
15
- end
16
- end
17
-
18
- desc "new APP_PATH GWT_PACKAGE_NAME [rails-options] [-- maven-options]", "create a new rails application with GWT UI given the path of the application and its package for the new GWT module"
19
- method_option :session, :type => :boolean, :default => false, :desc => 'adds session support'
20
- method_option :menu, :type => :boolean, :default => false, :desc => 'adds menu support'
21
- def new(app_path, gwt_package, *args)
22
- args = ARGV.dup
23
- args.delete('new')
24
- args.delete(app_path)
25
- args.delete(gwt_package)
26
- args.delete_if {|a| a =~ /^--session|^--menu/ }
27
- if i = args.index("--")
28
- maven_args = args[i..-1]
29
- args = i == 0 ? [] : args[0..(i-1)]
30
- end
31
- margs = ["rails3:new", "-Dargs=\"#{[app_path, args].flatten!.join ' '}\"", "-Dgwt.package=#{gwt_package}", "-Dgwt.session=#{options['session'] || false}", "-Dgwt.menu=#{options['menu'] || false}", maven_args || []].flatten!
32
- exec(margs)
33
- end
34
-
35
- def help(*args)
36
- super
37
- exec ["rails3:new", "-Dargs=--help"] if File.exists?('Gemfile')
38
- end
39
-
40
- desc "run [maven_options]", "starts the GWT development shell"
41
- def server(*args)
42
- args = ARGV.dup
43
- args.delete('server')
44
-
45
- exec ["gwt:run", args].flatten!
46
- end
47
-
48
- desc "compile [maven_options]", "compiles the gwt java code to javascript"
49
- def compile(*args)
50
- args = ARGV.dup
51
- args.delete('compile')
52
-
53
- exec ["compile", "gwt:compile", args].flatten!
54
- end
55
- end
56
- if ARGV[0] == 'run'
57
- ARGV[0] = 'server'
58
- end
59
- GWTCommand.start
data/bin/jetty-run DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
- if ARGV.size > 4 || ARGV[0] == "--help" || ARGV[0] == "-h" || ARGV[0] == "-?"
3
- puts "usage: #{File.basename($0)} [-e <environment>] [--war [<path/to/warfile>]]"
4
- puts "\tdefault environment: development"
5
- exit 1
6
- end
7
-
8
- args = [__FILE__.gsub(/-/, ':').gsub(/.*[\/\\]/, '')]
9
- if ARGV.size == 2 && ARGV[0] == "-e"
10
- args << "-Drails.env=#{ARGV[1]}"
11
- args << "-Prun"
12
- elsif ARGV.size == 1 && ARGV[0] == "--war"
13
- args = ["jetty:run-war", "-Pwar"]
14
- elsif ARGV.size == 2 && ARGV[0] == "--war"
15
- args = ["jetty:deploy-war", "-DwebApp=#{ARGV[1]}", "-Pwar"]
16
- elsif ARGV.size == 3 && ARGV[0] == "-e" && ARGV[2] == "--war"
17
- args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[1]}"]
18
- elsif ARGV.size == 3 && ARGV[1] == "-e" && ARGV[0] == "--war"
19
- args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[2]}"]
20
- elsif ARGV.size == 4 && ARGV[0] == "-e" && ARGV[2] == "--war"
21
- args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[3]}", "-Drails.env=#{ARGV[1]}"]
22
- elsif ARGV.size == 4 && ARGV[2] == "-e" && ARGV[0] == "--war"
23
- args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[1]}", "-Drails.env=#{ARGV[3]}"]
24
- end
25
- ARGV.replace(args)
26
- load File.join(File.dirname(__FILE__), "rmvn")
data/bin/tomcat-run DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
- if ARGV.size > 4 || ARGV[0] == "--help" || ARGV[0] == "-h" || ARGV[0] == "-?"
3
- puts "usage: #{File.basename($0)} [-e <environment>] [--war [<path/to/warfile>]]"
4
- puts "\tdefault environment: development"
5
- exit 1
6
- end
7
-
8
- args = [__FILE__.gsub(/-/, ':').gsub(/.*[\/\\]/, '')]
9
- if ARGV.size == 2 && ARGV[0] == "-e"
10
- args << "-Drails.env=#{ARGV[1]}"
11
- args << "-Prun"
12
- elsif ARGV.size == 1 && ARGV[0] == "--war"
13
- args = ["jetty:run-war", "-Pwar"]
14
- elsif ARGV.size == 2 && ARGV[0] == "--war"
15
- args = ["jetty:deploy-war", "-DwebApp=#{ARGV[1]}", "-Pwar"]
16
- elsif ARGV.size == 3 && ARGV[0] == "-e" && ARGV[2] == "--war"
17
- args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[1]}"]
18
- elsif ARGV.size == 3 && ARGV[1] == "-e" && ARGV[0] == "--war"
19
- args = ["jetty:run-war", "-Pwar", "-Drails.env=#{ARGV[2]}"]
20
- elsif ARGV.size == 4 && ARGV[0] == "-e" && ARGV[2] == "--war"
21
- args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[3]}", "-Drails.env=#{ARGV[1]}"]
22
- elsif ARGV.size == 4 && ARGV[2] == "-e" && ARGV[0] == "--war"
23
- args = ["jetty:deploy-war", "-Pwar", "-DwebApp=#{ARGV[1]}", "-Drails.env=#{ARGV[3]}"]
24
- end
25
- ARGV.replace(args)
26
- load File.join(File.dirname(__FILE__), "rmvn")
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,281 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'model_utils.rb')
2
-
3
- module Maven
4
- module Model
5
-
6
- class DependencyArray < Array
7
- def <<(dep)
8
- raise "not of type Dependency" unless dep.is_a?(Dependency)
9
- d = detect { |item| item == dep }
10
- if d
11
- d.version = dep.version
12
- self
13
- else
14
- super
15
- end
16
- end
17
- alias :push :<<
18
- end
19
-
20
- class ExclusionArray < Array
21
- def <<(*dep)
22
- excl = dep[0].is_a?(Exclusion) ? dep[0]: Exclusion.new(*dep.flatten)
23
- delete_if { |item| item == excl }
24
- super excl
25
- end
26
- alias :push :<<
27
- end
28
-
29
- class Coordinate < Tag
30
- tags :group_id, :artifact_id, :version
31
- def initialize(*args)
32
- @group_id, @artifact_id, @version = *coordinate(*args.flatten)
33
- end
34
-
35
- def hash
36
- "#{group_id}:#{artifact_id}".hash
37
- end
38
-
39
- def ==(other)
40
- group_id == other.group_id && artifact_id == other.artifact_id
41
- end
42
- alias :eql? :==
43
-
44
- private
45
-
46
- def coordinate(*args)
47
- if args[0] =~ /:/
48
- [args[0].sub(/:[^:]+$/, ''), args[0].sub(/.*:/, ''), convert_version(*args[1, 2])]
49
- else
50
- [args[0], args[1], convert_version(*args[2,3])]
51
- end
52
- end
53
-
54
- def convert_version(*args)
55
- if args.size == 0
56
- nil
57
- else
58
- low, high = convert(args[0])
59
- low, high = convert(args[1], low, high) if args[1] =~ /[=~><]/
60
- if low == high
61
- low
62
- else
63
- "#{low || '[0.0.0'},#{high || ')'}"
64
- end
65
- end
66
- end
67
-
68
- def convert(arg, low = nil, high = nil)
69
- if arg =~ /~>/
70
- val = arg.sub(/~>\s*/, '')
71
- last = val.sub(/\.[^.]+$/, '.99999')
72
- ["[#{val}", "#{last}]"]
73
- elsif arg =~ />=/
74
- val = arg.sub(/>=\s*/, '')
75
- ["[#{val}", (nil || high)]
76
- elsif arg =~ /<=/
77
- val = arg.sub(/<=\s*/, '')
78
- [(nil || low), "#{val}]"]
79
- # treat '!' the same way as '>' since maven can not describe such range
80
- elsif arg =~ /[!>]/
81
- val = arg.sub(/>\s*/, '')
82
- ["(#{val}", (nil || high)]
83
- elsif arg =~ /</
84
- val = arg.sub(/<\s*/, '')
85
- [(nil || low), "#{val})"]
86
- elsif arg =~ /\=/
87
- val = arg.sub(/=\s*/, '')
88
- [val, val]
89
- else
90
- [arg, arg]
91
- end
92
- end
93
- end
94
-
95
- class Parent < Coordinate
96
- tags :relative_path
97
-
98
- end
99
-
100
- class Exclusion < Tag
101
- tags :group_id, :artifact_id
102
- def initialize(*args)
103
- @group_id, @artifact_id = *coordinate(*args)
104
- end
105
-
106
- def hash
107
- "#{group_id}:#{artifact_id}".hash
108
- end
109
-
110
- def ==(other)
111
- group_id == other.group_id && artifact_id == other.artifact_id
112
- end
113
- alias :eql? :==
114
-
115
- private
116
-
117
- def coordinate(*args)
118
- case args.size
119
- when 1
120
- name = args[0].sub(/^mvn:/, '')
121
- if name =~ /:/
122
- [name.sub(/:[^:]+$/, ''), name.sub(/.*:/, '')]
123
- else
124
- ["rubygems", name]
125
- end
126
- else
127
- [args[0], args[1]]
128
- end
129
- end
130
- end
131
-
132
- class Dependency < Coordinate
133
- tags :type, :scope, :classifier, :exclusions
134
- def initialize(type, *args)
135
- super(*args)
136
- @type = type
137
- args.flatten!
138
- if args[0] =~ /:/ && args.size == 3
139
- @classifier = args[2] unless args[2] =~ /[=~><]/
140
- elsif args.size == 4
141
- @classifier = args[3] unless args[3] =~ /[=~><]/
142
- end
143
- end
144
-
145
- def hash
146
- "#{group_id}:#{artifact_id}:#{@type}:#{@classifier}".hash
147
- end
148
-
149
- def ==(other)
150
- super && @type == other.instance_variable_get(:@type) && @classifier == other.instance_variable_get(:@classifier)
151
- end
152
- alias :eql? :==
153
-
154
- def self.new_gem(gemname, *args)
155
- if gemname =~ /^mvn:/
156
- new(:maven_gem, gemname.sub(/^mvn:/, ''), *args)
157
- else
158
- new(:gem, "rubygems", gemname, *args)
159
- end
160
- end
161
-
162
- def self.new_maven_gem(gemname, *args)
163
- new(:maven_gem, gemname.sub(/^mvn:/, ''), *args)
164
- end
165
-
166
- def self.new_jar(*args)
167
- new(:jar, *args)
168
- end
169
-
170
- def self.new_test_jar(*args)
171
- result = new(:jar, *args)
172
- result.scope :test
173
- result
174
- end
175
-
176
- def exclusions(&block)
177
- @exclusions ||= ExclusionArray.new
178
- if block
179
- block.call(@exclusions)
180
- end
181
- @exclusions
182
- end
183
-
184
- def exclude(*args)
185
- exclusions << args
186
- end
187
- end
188
-
189
- module Dependencies
190
-
191
- def self.included(parent)
192
- parent.tags :dependencies
193
- end
194
-
195
- def jar?(*args)
196
- dependencies.member?(Dependency.new(:jar, *args))
197
- end
198
-
199
- def test_jar?(*args)
200
- dependencies.member?(Dependency.new_test_jar(*args))
201
- end
202
-
203
- def gem?(*args)
204
- dependencies.member?(Dependency.new(:gem, ['rubygems', *args].flatten))
205
- end
206
-
207
- def detect_gem(name)
208
- dependencies.detect { |d| d.type.to_sym == :gem && d.artifact_id == name }
209
- end
210
-
211
- def maven_gem?(*args)
212
- dependencies.member?(Dependency.new_maven_gem(*args))
213
- end
214
-
215
- def dependencies(&block)
216
- @dependencies ||= DependencyArray.new
217
- if block
218
- block.call(self)
219
- end
220
- @dependencies
221
- end
222
-
223
- def add_dependency(dep, has_version = true, &block)
224
- d = dependencies.detect { |d| d == dep }
225
- if d
226
- if has_version
227
- d.version = dep.version
228
- end
229
- dep = d
230
- else
231
- dependencies << dep
232
- end
233
- block.call(dep) if block
234
- dep
235
- end
236
- private :add_dependency
237
-
238
- def add_gem(*args, &block)
239
- args = args.flatten
240
- if args.size == 1
241
- dep = Dependency.new_gem(*args)
242
- dep = dependencies.detect { |d| d == dep }
243
- if dep
244
- return dep
245
- end
246
- args[1] = ">= 0.0.0"
247
- end
248
- add_dependency(Dependency.new_gem(*args), &block)
249
- end
250
- private :add_gem
251
-
252
- def jar(*args, &block)
253
- if args.last.is_a?(Hash)
254
- raise "hash not allowed for jar"
255
- end
256
- add_dependency(Dependency.new_jar(args), args.size > 1, &block)
257
- end
258
-
259
- def test_jar(*args, &block)
260
- if args.last.is_a?(Hash)
261
- raise "hash not allowed for test_jar"
262
- end
263
- add_dependency(Dependency.new_test_jar(args), args.size > 1, &block)
264
- end
265
-
266
- def gem(*args, &block)
267
- if args.last.is_a?(Hash)
268
- raise "hash not allowed in that context"
269
- end
270
- add_gem(args, &block)
271
- end
272
-
273
- def maven_gem(*args, &block)
274
- if args.last.is_a?(Hash)
275
- raise "hash not allowed in that context"
276
- end
277
- add_dependency(Dependency.new_maven_gem(args), args.size > 1, &block)
278
- end
279
- end
280
- end
281
- end