maven-tools 0.34.5 → 1.0.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,72 +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.dirname(__FILE__)), 'model', 'model.rb')
23
- require File.join(File.dirname(__FILE__), 'jarfile.rb')
24
- require File.join(File.dirname(__FILE__), 'coordinate.rb')
25
-
26
- module Maven
27
- module Tools
28
-
29
- class ArtifactPassthrough
30
-
31
- def initialize(&block)
32
- @block = block
33
- end
34
-
35
- def add_artifact(a)
36
- @block.call(a)
37
- end
38
-
39
- def add_repository(name, url)
40
- end
41
- end
42
-
43
- class MavenProject < Maven::Model::Project
44
- tags :dummy
45
-
46
- def load_mavenfile(file)
47
- file = file.path if file.is_a?(File)
48
- if File.exists? file
49
- @current_file = file
50
- content = File.read(file)
51
- eval content
52
- else
53
- self
54
- end
55
- end
56
-
57
- def load_jarfile(file)
58
- jars = Jarfile.new(file)
59
- if jars.exists?
60
- container = ArtifactPassthrough.new do |a|
61
- artifactId, groupId, extension, version = a.split(/:/)
62
- send(extension.to_sym, "#{artifactId}:#{groupId}", version)
63
- end
64
- if !jars.exists_lock? || jars.mtime > jars.mtime_lock
65
- jars.populate_unlocked container
66
- end
67
- jars.populate_locked container
68
- end
69
- end
70
- end
71
- end
72
- end
@@ -1,84 +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 'maven/model/model'
23
- require 'maven/tools/versions'
24
-
25
- module Maven
26
- module Tools
27
-
28
- class MinimalProject < Maven::Model::Project
29
- tags :dummy
30
-
31
- def self.create( gemfile, &block )
32
- require 'rubygems'
33
- require 'rubygems/format'
34
- self.new( Gem::Format.from_file_by_path( gemfile ).spec )
35
- end
36
-
37
- def initialize( spec, &block )
38
- super( "rubygems", spec.name, spec.version, &block )
39
-
40
- packaging "gem"
41
-
42
- name spec.summary || "#{self.artifact_id} - gem"
43
- description spec.description if spec.description
44
- url spec.homepage if spec.homepage
45
- ( [spec.email].flatten || [] ).zip( [spec.authors].flatten || [] ).map do |email, author|
46
- self.developers.new( author, email )
47
- end
48
-
49
- # flatten the array since copyright-header-1.0.3.gemspec has a double
50
- # nested array
51
- ( spec.licenses + spec.files.select {|file| file.to_s =~ /license|gpl/i } ).flatten.each do |license|
52
- # TODO make this better, i.e. detect the right license name from the file itself
53
- self.licenses.new( license )
54
- end
55
-
56
- plugin('gem', VERSIONS[:jruby_plugins]) do |g|
57
- g.extensions = true
58
- end
59
-
60
- spec.dependencies.each do |dep|
61
- versions = dep.requirement.requirements.collect do |req|
62
- # use this construct to get the same result in 1.8.x and 1.9.x
63
- req.collect{ |i| i.to_s }.join
64
- end
65
- g = gem( dep.name, versions )
66
- g.scope = 'test' if dep.type == :development
67
- end
68
-
69
- spec.requirements.each do |req|
70
- req.split( /\n/ ).each do |r|
71
- coord = to_coordinate( r )
72
- if coord
73
- name = coord.sub(/:[^:]+:[^:]+$/, '')
74
- versions = coord.sub(/.*:/, '')
75
- if r =~ /^\s*(jar|pom)\s/
76
- jar( name, versions )
77
- end
78
- end
79
- end
80
- end
81
- end
82
- end
83
- end
84
- end
@@ -1,83 +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
- require File.join(File.dirname(__FILE__), 'rails_project.rb')
22
- module Maven
23
- module Tools
24
- class PomGenerator
25
- def read_rails(filename, plugin_version = nil, jruby_version = nil)
26
- proj = Maven::Tools::RailsProject.new
27
- proj.load_gemfile(filename.to_s)
28
- proj.load_jarfile(File.join(File.dirname(filename.to_s), 'Jarfile'))
29
- proj.load_mavenfile(File.join(File.dirname(filename.to_s), 'Mavenfile'))
30
- proj.add_defaults(versions(plugin_version, jruby_version))
31
- proj.to_xml
32
- end
33
-
34
- # the dummy allows to have all three methods the same argument list
35
- def read_gemfile(filename, plugin_version = nil, dummy = nil)
36
- dir = File.dirname(filename)
37
- proj =
38
- if File.exists? File.join( dir, 'config', 'application.rb' )
39
- Maven::Tools::RailsProject.new
40
- else
41
- Maven::Tools::GemProject.new
42
- end
43
- proj.load_gemfile(filename.to_s)
44
- proj.load_jarfile(File.join(File.dirname(filename.to_s), 'Jarfile'))
45
- proj.load_mavenfile(File.join(File.dirname(filename.to_s), 'Mavenfile'))
46
- proj.add_defaults(versions(plugin_version, nil))
47
- proj.to_xml
48
- end
49
-
50
- # the dummy allows to have all three methods the same argument list
51
- def read_gemspec(filename, plugin_version = nil, dummy = nil)
52
- proj = Maven::Tools::GemProject.new
53
- proj.load_gemspec(filename.to_s)
54
- proj.load_jarfile(File.join(File.dirname(filename.to_s), 'Jarfile'))
55
- proj.load_mavenfile(File.join(File.dirname(filename.to_s), 'Mavenfile'))
56
- proj.add_defaults(versions(plugin_version, nil))
57
- proj.to_xml
58
- end
59
-
60
- private
61
-
62
- def versions(plugin_version, jruby_version)
63
- result = {}
64
- result[:jruby_plugins] = plugin_version if plugin_version
65
- result[:jruby_version] = jruby_version if jruby_version
66
- result
67
- end
68
- end
69
- end
70
- end
71
-
72
- generator = Maven::Tools::PomGenerator.new
73
-
74
- case ARGV.size
75
- when 2
76
- puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1])
77
- when 3
78
- puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1], ARGV[2])
79
- when 4
80
- puts generator.send("read_#{ARGV[0]}".to_sym, ARGV[1], ARGV[2], ARGV[3])
81
- else
82
- generator
83
- end
@@ -1,133 +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
- require File.join(File.dirname(__FILE__), 'gem_project.rb')
22
- module Maven
23
- module Tools
24
- class RailsProject < GemProject
25
- tags :dummy
26
-
27
- def initialize(name = dir_name, &block)
28
- super(name, &block)
29
- group_id "rails"
30
- packaging "war"
31
- end
32
-
33
- def has_gem?(gem)
34
- assets = profile(:assets)
35
- self.gem?(gem) || (assets && assets.gem?(gem))
36
- end
37
-
38
- def add_defaults(args = {})
39
- self.name = "#{dir_name} - rails application" unless name
40
-
41
- # setup bundler plugin
42
- plugin(:bundler)
43
-
44
- s_args = args.dup
45
- s_args.delete(:jruby_plugins)
46
- super(s_args)
47
-
48
- versions = VERSIONS.merge(args)
49
-
50
- rails_gem = dependencies.detect { |d| d.type.to_sym == :gem && d.artifact_id.to_s =~ /^rail.*s$/ } # allow rails or railties
51
-
52
- if !jar?("org.jruby:jruby-complete") && !jar?("org.jruby:jruby-core") && versions[:jruby_version]
53
- minor = versions[:jruby_version].sub(/[0-9]*\./, '').sub(/\..*/, '')
54
-
55
- #TODO once jruby-core pom is working !!!
56
- if minor.to_i > 55 #TODO fix minor minimum version
57
- jar("org.jruby:jruby-core", versions[:jruby_version])
58
- jar("org.jruby:jruby-stdlib", versions[:jruby_version])
59
- # override deps which works
60
- jar("jline:jline", '0.9.94') if versions[:jruby_version] =~ /1.6.[1-2]/
61
- jar("org.jruby.extras:jffi", '1.0.8', 'native') if versions[:jruby_version] =~ /1.6.[0-2]/
62
- jar("org.jruby.extras:jaffl", '0.5.10') if versions[:jruby_version] =~ /1.6.[0-2]/
63
- else
64
- jar("org.jruby:jruby-complete", "${jruby.version}")
65
- end
66
- end
67
-
68
- jar("org.jruby.rack:jruby-rack", versions[:jruby_rack]) unless jar?("org.jruby.rack:jruby-rack")
69
-
70
- self.properties = {
71
- "jruby.version" => versions[:jruby_version],
72
- "rails.env" => "development",
73
- "gem.includeRubygemsInTestResources" => false
74
- }.merge(self.properties)
75
-
76
- dependencies.find { |d| d.artifact_id == 'bundler' }.scope = nil
77
-
78
- plugin(:rails3) do |rails|
79
- rails.version = "${jruby.plugins.version}" unless rails.version
80
- rails.in_phase(:validate).execute_goal(:initialize)
81
- end
82
-
83
- plugin(:war, versions[:war_plugin]) unless plugin?(:war)
84
- plugin(:war) do |w|
85
- options = {
86
- :webResources => Maven::Model::NamedArray.new(:resource) do |l|
87
- l << { :directory => "public" }
88
- l << {
89
- :directory => ".",
90
- :targetPath => "WEB-INF",
91
- :includes => ['app/**', 'config/**', 'lib/**', 'vendor/**', 'Gemfile']
92
- }
93
- l << {
94
- :directory => '${gem.path}',
95
- :targetPath => 'WEB-INF/gems',
96
- :includes => ['gems/**', 'specifications/**']
97
- }
98
- if plugin(:bundler).dependencies.detect { |d| d.type.to_sym == :gem }
99
- l << {
100
- :directory => '${gem.path}-bundler-maven-plugin',
101
- :targetPath => 'WEB-INF/gems',
102
- :includes => ['specifications/**']
103
- }
104
- end
105
- end
106
- }
107
- options[:webXml] = 'config/web.xml' if File.exists?('config/web.xml') || !File.exists?('src/main/webapp/WEB-INF/web.xml')
108
- w.with options
109
- end
110
-
111
- profile(:assets).activation.by_default if profiles.key?(:assets)
112
- profile(:development).activation.by_default
113
- profile(:test).activation.by_default
114
- profile(:test).activation.property("rails.env", "test")
115
- profile(:production) do |prod|
116
- prod.activation.property("rails.env", "production")
117
- prod.properties = {
118
- "gem.home" => "${project.build.directory}/rubygems-production",
119
- "gem.path" => "${project.build.directory}/rubygems-production"
120
- }.merge(prod.properties)
121
- end
122
- end
123
- end
124
- end
125
- end
126
-
127
- if $0 == __FILE__
128
- proj = Maven::Tools::RailsProject.new
129
- proj.load(ARGV[0] || 'Gemfile')
130
- proj.load(ARGV[1] || 'Mavenfile')
131
- proj.add_defaults
132
- puts proj.to_xml
133
- end
@@ -1,260 +0,0 @@
1
- require 'maven/model/dependencies'
2
-
3
- class A < Maven::Model::Tag
4
-
5
- include Maven::Model::Dependencies
6
-
7
- end
8
-
9
- describe Maven::Model::Dependencies do
10
-
11
- before :each do
12
- @a = A.new
13
- end
14
-
15
- it 'should have empty dependencies' do
16
- @a.dependencies.empty?.should be_true
17
- @a.to_xml.should == <<-XML
18
- <a>
19
- </a>
20
- XML
21
- end
22
-
23
- it 'should allow gem dependencies with default version' do
24
- @a.gem 'rubyforge'
25
-
26
- @a.dependencies.empty?.should be_false
27
- @a.gem?("rubyforge").should be_true
28
- @a.to_xml.should == <<-XML
29
- <a>
30
- <dependencies>
31
- <dependency>
32
- <groupId>rubygems</groupId>
33
- <artifactId>rubyforge</artifactId>
34
- <version>[0,)</version>
35
- <type>gem</type>
36
- </dependency>
37
- </dependencies>
38
- </a>
39
- XML
40
- end
41
-
42
- it 'should allow gem dependencies with version' do
43
- @a.gem 'rubyforge', '> 0.1.0', '<=2.0'
44
-
45
- @a.dependencies.empty?.should be_false
46
- @a.gem?("rubyforge").should be_true
47
- @a.to_xml.should == <<-XML
48
- <a>
49
- <dependencies>
50
- <dependency>
51
- <groupId>rubygems</groupId>
52
- <artifactId>rubyforge</artifactId>
53
- <version>(0.1.0,2.0]</version>
54
- <type>gem</type>
55
- </dependency>
56
- </dependencies>
57
- </a>
58
- XML
59
- end
60
-
61
- it 'should allow gem dependencies with exclusions' do
62
- @a.gem 'rubyforge', ['> 0.1.0', '<=2.0'] do |g|
63
- g.exclude "rake"
64
- g.exclude "spork"
65
- end
66
-
67
- @a.dependencies.empty?.should be_false
68
- @a.gem?("rubyforge").should be_true
69
- @a.to_xml.should == <<-XML
70
- <a>
71
- <dependencies>
72
- <dependency>
73
- <groupId>rubygems</groupId>
74
- <artifactId>rubyforge</artifactId>
75
- <version>(0.1.0,2.0]</version>
76
- <type>gem</type>
77
- <exclusions>
78
- <exclusion>
79
- <groupId>rubygems</groupId>
80
- <artifactId>rake</artifactId>
81
- </exclusion>
82
- <exclusion>
83
- <groupId>rubygems</groupId>
84
- <artifactId>spork</artifactId>
85
- </exclusion>
86
- </exclusions>
87
- </dependency>
88
- </dependencies>
89
- </a>
90
- XML
91
- end
92
-
93
- it 'should allow jar dependencies without version' do
94
- @a.jar 'org.jruby', 'jruby-core'
95
-
96
- @a.dependencies.empty?.should be_false
97
- @a.jar?("org.jruby:jruby-core").should be_true
98
- @a.to_xml.should == <<-XML
99
- <a>
100
- <dependencies>
101
- <dependency>
102
- <groupId>org.jruby</groupId>
103
- <artifactId>jruby-core</artifactId>
104
- <type>jar</type>
105
- </dependency>
106
- </dependencies>
107
- </a>
108
- XML
109
- end
110
-
111
- it 'should allow jar dependencies with version' do
112
- @a.jar 'org.jruby:jruby-core', '~> 1.6.0'
113
-
114
- @a.dependencies.empty?.should be_false
115
- @a.jar?("org.jruby", "jruby-core").should be_true
116
- @a.to_xml.should == <<-XML
117
- <a>
118
- <dependencies>
119
- <dependency>
120
- <groupId>org.jruby</groupId>
121
- <artifactId>jruby-core</artifactId>
122
- <version>[1.6.0,1.6.99999]</version>
123
- <type>jar</type>
124
- </dependency>
125
- </dependencies>
126
- </a>
127
- XML
128
- end
129
-
130
- it 'should allow jar dependencies with exclusions' do
131
- @a.jar 'org.jruby', 'jruby-core', '>1.6.0' do |j|
132
- j.exclusions << "joda:joda-time"
133
- end
134
-
135
- @a.dependencies.empty?.should be_false
136
- @a.jar?("org.jruby:jruby-core").should be_true
137
- @a.to_xml.should == <<-XML
138
- <a>
139
- <dependencies>
140
- <dependency>
141
- <groupId>org.jruby</groupId>
142
- <artifactId>jruby-core</artifactId>
143
- <version>(1.6.0,)</version>
144
- <type>jar</type>
145
- <exclusions>
146
- <exclusion>
147
- <groupId>joda</groupId>
148
- <artifactId>joda-time</artifactId>
149
- </exclusion>
150
- </exclusions>
151
- </dependency>
152
- </dependencies>
153
- </a>
154
- XML
155
- end
156
-
157
- it 'should allow test_jar dependencies with exclusions' do
158
- @a.test_jar 'org.jruby', 'jruby-stdlib', '1.6.0' do |j|
159
- j.exclusions << ["joda", "joda-time"]
160
- j.exclusions << "rubyzip2"
161
- end
162
-
163
- @a.dependencies.empty?.should be_false
164
- @a.test_jar?("org.jruby:jruby-stdlib").should be_true
165
- @a.to_xml.should == <<-XML
166
- <a>
167
- <dependencies>
168
- <dependency>
169
- <groupId>org.jruby</groupId>
170
- <artifactId>jruby-stdlib</artifactId>
171
- <version>1.6.0</version>
172
- <type>jar</type>
173
- <scope>test</scope>
174
- <exclusions>
175
- <exclusion>
176
- <groupId>joda</groupId>
177
- <artifactId>joda-time</artifactId>
178
- </exclusion>
179
- <exclusion>
180
- <groupId>rubygems</groupId>
181
- <artifactId>rubyzip2</artifactId>
182
- </exclusion>
183
- </exclusions>
184
- </dependency>
185
- </dependencies>
186
- </a>
187
- XML
188
- end
189
-
190
- it 'should allow pom dependencies with exclusions' do
191
- @a.pom 'org.jruby:jruby-stdlib', '>= 1.6.0' do |j|
192
- j.exclusions << ["joda", "joda-time"]
193
- j.exclusions << "rubyzip2"
194
- end
195
- @a.dependencies.empty?.should be_false
196
- @a.jar?("org.jruby:jruby-stdlib").should be_false
197
- @a.pom?("org.jruby:jruby-stdlib").should be_true
198
- @a.to_xml.should == <<-XML
199
- <a>
200
- <dependencies>
201
- <dependency>
202
- <groupId>org.jruby</groupId>
203
- <artifactId>jruby-stdlib</artifactId>
204
- <version>[1.6.0,)</version>
205
- <type>pom</type>
206
- <exclusions>
207
- <exclusion>
208
- <groupId>joda</groupId>
209
- <artifactId>joda-time</artifactId>
210
- </exclusion>
211
- <exclusion>
212
- <groupId>rubygems</groupId>
213
- <artifactId>rubyzip2</artifactId>
214
- </exclusion>
215
- </exclusions>
216
- </dependency>
217
- </dependencies>
218
- </a>
219
- XML
220
- end
221
-
222
- it 'should have only one instance of jar dependency' do
223
- r1 = @a.jar 'org.jruby:jruby-core', ['1.6.0']
224
- r2 = @a.jar 'org.jruby:jruby-core'
225
- @a.jar?('org.jruby', 'jruby-core').should be_true
226
- @a.dependencies.size.should == 1
227
- r1.should == r2
228
- @a.to_xml.should == <<-XML
229
- <a>
230
- <dependencies>
231
- <dependency>
232
- <groupId>org.jruby</groupId>
233
- <artifactId>jruby-core</artifactId>
234
- <version>1.6.0</version>
235
- <type>jar</type>
236
- </dependency>
237
- </dependencies>
238
- </a>
239
- XML
240
- end
241
- it 'should have only one instance of gem dependency' do
242
- r1 = @a.gem 'rubyforge', ['> 0.1.0', '<=2.0']
243
- r2 = @a.gem 'rubyforge'
244
- @a.gem?("rubyforge").should be_true
245
- @a.dependencies.size.should == 1
246
- r1.should == r2
247
- @a.to_xml.should == <<-XML
248
- <a>
249
- <dependencies>
250
- <dependency>
251
- <groupId>rubygems</groupId>
252
- <artifactId>rubyforge</artifactId>
253
- <version>(0.1.0,2.0]</version>
254
- <type>gem</type>
255
- </dependency>
256
- </dependencies>
257
- </a>
258
- XML
259
- end
260
- end