maven-tools 0.32.0 → 0.32.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/maven-tools.rb +20 -0
- data/lib/maven/model/dependencies.rb +21 -1
- data/lib/maven/model/model.rb +21 -1
- data/lib/maven/model/utils.rb +21 -1
- data/lib/maven/tools/coordinate.rb +21 -1
- data/lib/maven/tools/execute_in_phase.rb +20 -1
- data/lib/maven/tools/gem_project.rb +39 -3
- data/lib/maven/tools/gemfile_lock.rb +21 -1
- data/lib/maven/tools/jarfile.rb +21 -1
- data/lib/maven/tools/minimal_project.rb +21 -1
- data/lib/maven/tools/pom_generator.rb +21 -1
- data/lib/maven/tools/rails_project.rb +23 -2
- data/lib/maven/tools/version.rb +21 -1
- data/lib/maven/tools/versions.rb +25 -5
- data/lib/maven_tools.rb +20 -0
- data/rspec/maven/model/dependencies_spec.rb +260 -0
- data/rspec/maven/model/model_spec.rb +713 -0
- data/rspec/maven/tools/Gemfile.gems +11 -0
- data/rspec/maven/tools/Gemfile.groups +15 -0
- data/rspec/maven/tools/Gemfile.ignored +30 -0
- data/rspec/maven/tools/Gemfile.lockfile +8 -0
- data/rspec/maven/tools/Gemfile.lockfile.lock +53 -0
- data/rspec/maven/tools/Gemfile.minimal +1 -0
- data/rspec/maven/tools/Gemfile.nolock +1 -0
- data/rspec/maven/tools/Gemfile.rails +16 -0
- data/rspec/maven/tools/Gemfile.simple +7 -0
- data/rspec/maven/tools/Gemfile.withlock +1 -0
- data/rspec/maven/tools/Gemfile.withlock.lock +28 -0
- data/rspec/maven/tools/Jarfile.with +2 -0
- data/rspec/maven/tools/Jarfile.with.lock +1 -0
- data/rspec/maven/tools/Jarfile.without +2 -0
- data/rspec/maven/tools/deps.gemspec +8 -0
- data/rspec/maven/tools/gem_project_spec.rb +1127 -0
- data/rspec/maven/tools/maven-tools.gemspec +17 -0
- data/rspec/maven/tools/minimal.gemspec +5 -0
- data/rspec/maven/tools/no-deps.gemspec +27 -0
- data/rspec/maven/tools/rails_project_spec.rb +286 -0
- data/rspec/maven/tools/spec_helper.rb +22 -0
- metadata +66 -3
data/lib/maven_tools.rb
CHANGED
@@ -1 +1,21 @@
|
|
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
|
+
#
|
1
21
|
require 'maven/tools/jarfile'
|
@@ -0,0 +1,260 @@
|
|
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
|
@@ -0,0 +1,713 @@
|
|
1
|
+
require 'maven/model/model'
|
2
|
+
|
3
|
+
describe Maven::Model do
|
4
|
+
|
5
|
+
describe Maven::Model::Project do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@project = Maven::Model::Project.new("test:project", '0.0.0')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should setup a project with split args' do
|
12
|
+
Maven::Model::Project.new("test", "project", "1.0.0").to_xml.should == <<-XML
|
13
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
14
|
+
<modelVersion>4.0.0</modelVersion>
|
15
|
+
<groupId>test</groupId>
|
16
|
+
<artifactId>project</artifactId>
|
17
|
+
<version>1.0.0</version>
|
18
|
+
</project>
|
19
|
+
XML
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should setup a minimal project' do
|
23
|
+
project = Maven::Model::Project.new
|
24
|
+
project.artifact_id = 'mini'
|
25
|
+
project.parent('test:parent', '1.2.3')
|
26
|
+
project.to_xml.should == <<-XML
|
27
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
28
|
+
<modelVersion>4.0.0</modelVersion>
|
29
|
+
<parent>
|
30
|
+
<groupId>test</groupId>
|
31
|
+
<artifactId>parent</artifactId>
|
32
|
+
<version>1.2.3</version>
|
33
|
+
</parent>
|
34
|
+
<artifactId>mini</artifactId>
|
35
|
+
</project>
|
36
|
+
XML
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should setup a project with parent' do
|
40
|
+
@project.parent("test:parent", '0.1.2').relative_path='../pom.rb'
|
41
|
+
@project.to_xml.should == <<-XML
|
42
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
43
|
+
<modelVersion>4.0.0</modelVersion>
|
44
|
+
<parent>
|
45
|
+
<groupId>test</groupId>
|
46
|
+
<artifactId>parent</artifactId>
|
47
|
+
<version>0.1.2</version>
|
48
|
+
<relativePath>../pom.rb</relativePath>
|
49
|
+
</parent>
|
50
|
+
<groupId>test</groupId>
|
51
|
+
<artifactId>project</artifactId>
|
52
|
+
<version>0.0.0</version>
|
53
|
+
</project>
|
54
|
+
XML
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should setup a project with metadata' do
|
58
|
+
@project.name "name"
|
59
|
+
@project.packaging = :jar
|
60
|
+
@project.description <<-TXT
|
61
|
+
some text
|
62
|
+
more
|
63
|
+
TXT
|
64
|
+
@project.url "http://example.com"
|
65
|
+
@project.to_xml.should == <<-XML
|
66
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
67
|
+
<modelVersion>4.0.0</modelVersion>
|
68
|
+
<groupId>test</groupId>
|
69
|
+
<artifactId>project</artifactId>
|
70
|
+
<version>0.0.0</version>
|
71
|
+
<name><![CDATA[name]]></name>
|
72
|
+
<packaging>jar</packaging>
|
73
|
+
<description><![CDATA[some text
|
74
|
+
more
|
75
|
+
]]></description>
|
76
|
+
<url>http://example.com</url>
|
77
|
+
</project>
|
78
|
+
XML
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should setup a project with developers' do
|
82
|
+
@project.developers.new("my name1", "my_email1@example.com")
|
83
|
+
@project.developers.new("my name2 <my_email2@example.com>")
|
84
|
+
@project.to_xml.should == <<-XML
|
85
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
86
|
+
<modelVersion>4.0.0</modelVersion>
|
87
|
+
<groupId>test</groupId>
|
88
|
+
<artifactId>project</artifactId>
|
89
|
+
<version>0.0.0</version>
|
90
|
+
<developers>
|
91
|
+
<developer>
|
92
|
+
<id>my_email1_at_example_dot_com</id>
|
93
|
+
<name>my name1</name>
|
94
|
+
<email>my_email1@example.com</email>
|
95
|
+
</developer>
|
96
|
+
<developer>
|
97
|
+
<id>my_email2_at_example_dot_com</id>
|
98
|
+
<name>my name2</name>
|
99
|
+
<email>my_email2@example.com</email>
|
100
|
+
</developer>
|
101
|
+
</developers>
|
102
|
+
</project>
|
103
|
+
XML
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should setup a project with licenses' do
|
107
|
+
@project.licenses.new("MIT-LICENSE.txt")
|
108
|
+
@project.licenses.new("http://www.gnu.org/licenses/gpl.html")
|
109
|
+
@project.to_xml.should == <<-XML
|
110
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
111
|
+
<modelVersion>4.0.0</modelVersion>
|
112
|
+
<groupId>test</groupId>
|
113
|
+
<artifactId>project</artifactId>
|
114
|
+
<version>0.0.0</version>
|
115
|
+
<licenses>
|
116
|
+
<license>
|
117
|
+
<name>MIT-LICENSE</name>
|
118
|
+
<url>./MIT-LICENSE.txt</url>
|
119
|
+
<distribution>repo</distribution>
|
120
|
+
</license>
|
121
|
+
<license>
|
122
|
+
<name>gpl</name>
|
123
|
+
<url>http://www.gnu.org/licenses/gpl.html</url>
|
124
|
+
<distribution>repo</distribution>
|
125
|
+
</license>
|
126
|
+
</licenses>
|
127
|
+
</project>
|
128
|
+
XML
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'should setup a project with repositories' do
|
132
|
+
@project.repository("rubygems-releases", "http://rubygems-proxy.torquebox.org/releases")
|
133
|
+
@project.plugin_repository("sonatype-snapshots") do |sonatype|
|
134
|
+
sonatype.url "http://oss.sonatype.org/content/repositories/snapshots"
|
135
|
+
sonatype.releases(:enabled => false)
|
136
|
+
sonatype.snapshots(:enabled => true)
|
137
|
+
end
|
138
|
+
@project.repository("jboss-public-repository-group") do |jboss|
|
139
|
+
jboss.name "JBoss Public Maven Repository Group"
|
140
|
+
jboss.url "https://repository.jboss.org/nexus/content/groups/public-jboss/"
|
141
|
+
jboss.releases(:enabled => false, :updatePolicy => :never, :checksumPolicy => :strict)
|
142
|
+
jboss.snapshots(:enabled => true, :updatePolicy => :daily, :checksumPolicy => :ignore)
|
143
|
+
end
|
144
|
+
@project.to_xml.should == <<-XML
|
145
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
146
|
+
<modelVersion>4.0.0</modelVersion>
|
147
|
+
<groupId>test</groupId>
|
148
|
+
<artifactId>project</artifactId>
|
149
|
+
<version>0.0.0</version>
|
150
|
+
<repositories>
|
151
|
+
<repository>
|
152
|
+
<id>jboss-public-repository-group</id>
|
153
|
+
<name>JBoss Public Maven Repository Group</name>
|
154
|
+
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
155
|
+
<releases>
|
156
|
+
<checksumPolicy>strict</checksumPolicy>
|
157
|
+
<enabled>false</enabled>
|
158
|
+
<updatePolicy>never</updatePolicy>
|
159
|
+
</releases>
|
160
|
+
<snapshots>
|
161
|
+
<checksumPolicy>ignore</checksumPolicy>
|
162
|
+
<enabled>true</enabled>
|
163
|
+
<updatePolicy>daily</updatePolicy>
|
164
|
+
</snapshots>
|
165
|
+
</repository>
|
166
|
+
<repository>
|
167
|
+
<id>rubygems-releases</id>
|
168
|
+
<url>http://rubygems-proxy.torquebox.org/releases</url>
|
169
|
+
</repository>
|
170
|
+
</repositories>
|
171
|
+
<pluginRepositories>
|
172
|
+
<pluginRepository>
|
173
|
+
<id>sonatype-snapshots</id>
|
174
|
+
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
|
175
|
+
<releases>
|
176
|
+
<enabled>false</enabled>
|
177
|
+
</releases>
|
178
|
+
<snapshots>
|
179
|
+
<enabled>true</enabled>
|
180
|
+
</snapshots>
|
181
|
+
</pluginRepository>
|
182
|
+
</pluginRepositories>
|
183
|
+
</project>
|
184
|
+
XML
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should setup a project with properties' do
|
188
|
+
@project.properties["gem.home"] = "${project.build.directory}/rubygems"
|
189
|
+
@project.properties = { "gem.home" => "${user.home}/.gem/jruby/1.8" }
|
190
|
+
@project.properties["gem.path"] = "${project.build.directory}/rubygems"
|
191
|
+
@project.properties["jruby.plugins.version"] = "0.26.0-SNAPSHOT"
|
192
|
+
@project.properties["project.build.sourceEncoding"] = "UTF-8"
|
193
|
+
@project.properties.merge!({
|
194
|
+
"gem.path" => "${user.home}/.gem/jruby/1.8"
|
195
|
+
})
|
196
|
+
@project.to_xml.should == <<-XML
|
197
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
198
|
+
<modelVersion>4.0.0</modelVersion>
|
199
|
+
<groupId>test</groupId>
|
200
|
+
<artifactId>project</artifactId>
|
201
|
+
<version>0.0.0</version>
|
202
|
+
<properties>
|
203
|
+
<gem.home>${user.home}/.gem/jruby/1.8</gem.home>
|
204
|
+
<gem.path>${user.home}/.gem/jruby/1.8</gem.path>
|
205
|
+
<jruby.plugins.version>0.26.0-SNAPSHOT</jruby.plugins.version>
|
206
|
+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
207
|
+
</properties>
|
208
|
+
</project>
|
209
|
+
XML
|
210
|
+
end
|
211
|
+
|
212
|
+
it 'should setup a project with source control management' do
|
213
|
+
@project.source_control do |sc|
|
214
|
+
sc.connection 'scm:git:git://github.com/torquebox/maven-tools.git'
|
215
|
+
sc.developer_connection 'scm:git:ssh://git@github.com/torquebox/maven-tools.git'
|
216
|
+
sc.url 'http://github.com/torquebox/maven-tools'
|
217
|
+
end
|
218
|
+
@project.to_xml.should == <<-XML
|
219
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
220
|
+
<modelVersion>4.0.0</modelVersion>
|
221
|
+
<groupId>test</groupId>
|
222
|
+
<artifactId>project</artifactId>
|
223
|
+
<version>0.0.0</version>
|
224
|
+
<scm>
|
225
|
+
<connection>scm:git:git://github.com/torquebox/maven-tools.git</connection>
|
226
|
+
<developerConnection>scm:git:ssh://git@github.com/torquebox/maven-tools.git</developerConnection>
|
227
|
+
<url>http://github.com/torquebox/maven-tools</url>
|
228
|
+
</scm>
|
229
|
+
</project>
|
230
|
+
XML
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'should setup a project with dependencies and dependency_management' do
|
234
|
+
@project.dependency_management do |deps|
|
235
|
+
deps.gem "slf4r", "0.4.2"
|
236
|
+
deps.jar "org.slf4j:slf4j-simple", "1.6.2"
|
237
|
+
end
|
238
|
+
@project.dependency_management.gem "rspec", "2.4.1"
|
239
|
+
@project.dependencies do |d|
|
240
|
+
d.gem "rspec"
|
241
|
+
d.test_jar "org.slf4j:slf4j-noop", "1.6.2"
|
242
|
+
end
|
243
|
+
@project.gem "rspec"
|
244
|
+
@project.test_jar "org.slf4j:slf4j-noop", "1.6.2"
|
245
|
+
@project.to_xml.should == <<-XML
|
246
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
247
|
+
<modelVersion>4.0.0</modelVersion>
|
248
|
+
<groupId>test</groupId>
|
249
|
+
<artifactId>project</artifactId>
|
250
|
+
<version>0.0.0</version>
|
251
|
+
<dependencies>
|
252
|
+
<dependency>
|
253
|
+
<groupId>rubygems</groupId>
|
254
|
+
<artifactId>rspec</artifactId>
|
255
|
+
<version>[0,)</version>
|
256
|
+
<type>gem</type>
|
257
|
+
</dependency>
|
258
|
+
<dependency>
|
259
|
+
<groupId>org.slf4j</groupId>
|
260
|
+
<artifactId>slf4j-noop</artifactId>
|
261
|
+
<version>1.6.2</version>
|
262
|
+
<type>jar</type>
|
263
|
+
<scope>test</scope>
|
264
|
+
</dependency>
|
265
|
+
</dependencies>
|
266
|
+
<dependencyManagement>
|
267
|
+
<dependencies>
|
268
|
+
<dependency>
|
269
|
+
<groupId>rubygems</groupId>
|
270
|
+
<artifactId>slf4r</artifactId>
|
271
|
+
<version>0.4.2</version>
|
272
|
+
<type>gem</type>
|
273
|
+
</dependency>
|
274
|
+
<dependency>
|
275
|
+
<groupId>org.slf4j</groupId>
|
276
|
+
<artifactId>slf4j-simple</artifactId>
|
277
|
+
<version>1.6.2</version>
|
278
|
+
<type>jar</type>
|
279
|
+
</dependency>
|
280
|
+
<dependency>
|
281
|
+
<groupId>rubygems</groupId>
|
282
|
+
<artifactId>rspec</artifactId>
|
283
|
+
<version>2.4.1</version>
|
284
|
+
<type>gem</type>
|
285
|
+
</dependency>
|
286
|
+
</dependencies>
|
287
|
+
</dependencyManagement>
|
288
|
+
</project>
|
289
|
+
XML
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'should setup a project with dependency with exclusions' do
|
293
|
+
@project.jar 'org.xerial:sqlite-jdbc', '3.6.10' do |j|
|
294
|
+
j.exclude 'org.xerial.thirdparty:nestedvm'
|
295
|
+
end
|
296
|
+
@project.gem 'sqlite-jdbc', '3.6.10'
|
297
|
+
@project.gem('sqlite-jdbc').exclude 'nestedvm'
|
298
|
+
@project.to_xml.should == <<-XML
|
299
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
300
|
+
<modelVersion>4.0.0</modelVersion>
|
301
|
+
<groupId>test</groupId>
|
302
|
+
<artifactId>project</artifactId>
|
303
|
+
<version>0.0.0</version>
|
304
|
+
<dependencies>
|
305
|
+
<dependency>
|
306
|
+
<groupId>org.xerial</groupId>
|
307
|
+
<artifactId>sqlite-jdbc</artifactId>
|
308
|
+
<version>3.6.10</version>
|
309
|
+
<type>jar</type>
|
310
|
+
<exclusions>
|
311
|
+
<exclusion>
|
312
|
+
<groupId>org.xerial.thirdparty</groupId>
|
313
|
+
<artifactId>nestedvm</artifactId>
|
314
|
+
</exclusion>
|
315
|
+
</exclusions>
|
316
|
+
</dependency>
|
317
|
+
<dependency>
|
318
|
+
<groupId>rubygems</groupId>
|
319
|
+
<artifactId>sqlite-jdbc</artifactId>
|
320
|
+
<version>3.6.10</version>
|
321
|
+
<type>gem</type>
|
322
|
+
<exclusions>
|
323
|
+
<exclusion>
|
324
|
+
<groupId>rubygems</groupId>
|
325
|
+
<artifactId>nestedvm</artifactId>
|
326
|
+
</exclusion>
|
327
|
+
</exclusions>
|
328
|
+
</dependency>
|
329
|
+
</dependencies>
|
330
|
+
</project>
|
331
|
+
XML
|
332
|
+
end
|
333
|
+
|
334
|
+
it 'should allow to set maven core plugins directly in the project' do
|
335
|
+
@project.plugin 'release'
|
336
|
+
@project.plugin("clean", "2.4.1")
|
337
|
+
@project.plugin(:compile, "2.3.2").with :source => "1.5", :target => "1.5"
|
338
|
+
@project.to_xml.should == <<-XML
|
339
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
340
|
+
<modelVersion>4.0.0</modelVersion>
|
341
|
+
<groupId>test</groupId>
|
342
|
+
<artifactId>project</artifactId>
|
343
|
+
<version>0.0.0</version>
|
344
|
+
<build>
|
345
|
+
<plugins>
|
346
|
+
<plugin>
|
347
|
+
<artifactId>maven-clean-plugin</artifactId>
|
348
|
+
<version>2.4.1</version>
|
349
|
+
</plugin>
|
350
|
+
<plugin>
|
351
|
+
<artifactId>maven-compile-plugin</artifactId>
|
352
|
+
<version>2.3.2</version>
|
353
|
+
<configuration>
|
354
|
+
<source>1.5</source>
|
355
|
+
<target>1.5</target>
|
356
|
+
</configuration>
|
357
|
+
</plugin>
|
358
|
+
<plugin>
|
359
|
+
<artifactId>maven-release-plugin</artifactId>
|
360
|
+
</plugin>
|
361
|
+
</plugins>
|
362
|
+
</build>
|
363
|
+
</project>
|
364
|
+
XML
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'should allow to set jruby plugins directly in the project' do
|
368
|
+
@project.plugin(:gem).extensions true
|
369
|
+
@project.plugin(:gem).in_phase("pre-integration-test").execute_goal(:install)
|
370
|
+
@project.plugin(:cucumber).in_phase("integration-test").execute_goal(:test).with(:cucumberArgs => "--no-colors")
|
371
|
+
@project.to_xml.should == <<-XML
|
372
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
373
|
+
<modelVersion>4.0.0</modelVersion>
|
374
|
+
<groupId>test</groupId>
|
375
|
+
<artifactId>project</artifactId>
|
376
|
+
<version>0.0.0</version>
|
377
|
+
<build>
|
378
|
+
<plugins>
|
379
|
+
<plugin>
|
380
|
+
<groupId>de.saumya.mojo</groupId>
|
381
|
+
<artifactId>cucumber-maven-plugin</artifactId>
|
382
|
+
<executions>
|
383
|
+
<execution>
|
384
|
+
<id>in_phase_integration_test</id>
|
385
|
+
<phase>integration-test</phase>
|
386
|
+
<goals>
|
387
|
+
<goal>test</goal>
|
388
|
+
</goals>
|
389
|
+
<configuration>
|
390
|
+
<cucumberArgs>--no-colors</cucumberArgs>
|
391
|
+
</configuration>
|
392
|
+
</execution>
|
393
|
+
</executions>
|
394
|
+
</plugin>
|
395
|
+
<plugin>
|
396
|
+
<groupId>de.saumya.mojo</groupId>
|
397
|
+
<artifactId>gem-maven-plugin</artifactId>
|
398
|
+
<extensions>true</extensions>
|
399
|
+
<executions>
|
400
|
+
<execution>
|
401
|
+
<id>in_phase_pre_integration_test</id>
|
402
|
+
<phase>pre-integration-test</phase>
|
403
|
+
<goals>
|
404
|
+
<goal>install</goal>
|
405
|
+
</goals>
|
406
|
+
</execution>
|
407
|
+
</executions>
|
408
|
+
</plugin>
|
409
|
+
</plugins>
|
410
|
+
</build>
|
411
|
+
</project>
|
412
|
+
XML
|
413
|
+
end
|
414
|
+
|
415
|
+
it 'should allow to configure plugins in various ways' do
|
416
|
+
@project.plugin('org.codehaus.mojo:gwt-maven-plugin', '2.1.0') do |gwt|
|
417
|
+
gwt.with({ :extraJvmArgs => "-Xmx512m",
|
418
|
+
:runTarget => "example.html"
|
419
|
+
})
|
420
|
+
gwt.execution.goals << ["clean", "compile", "test"]
|
421
|
+
end
|
422
|
+
@project.plugin("org.mortbay.jetty:jetty-maven-plugin", "7.2.2.v20101205").with({
|
423
|
+
:connectors => <<-XML
|
424
|
+
|
425
|
+
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
426
|
+
<port>8080</port>
|
427
|
+
</connector>
|
428
|
+
<connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
|
429
|
+
<port>8443</port>
|
430
|
+
<keystore>${project.basedir}/src/test/resources/server.keystore</keystore>
|
431
|
+
<keyPassword>123456</keyPassword>
|
432
|
+
<password>123456</password>
|
433
|
+
</connector>
|
434
|
+
XML
|
435
|
+
})
|
436
|
+
@project.plugin(:war).with({
|
437
|
+
:webResources => Maven::Model::NamedArray.new(:resource) do |l|
|
438
|
+
l << { :directory => "public" }
|
439
|
+
l << {
|
440
|
+
:directory => ".",
|
441
|
+
:targetPath => "WEB-INF",
|
442
|
+
:includes => ['app/**', 'config/**', 'lib/**', 'vendor/**', 'Gemfile']
|
443
|
+
}
|
444
|
+
l << {
|
445
|
+
:directory => '${gem.path}',
|
446
|
+
:targetPath => 'WEB-INF/gems'
|
447
|
+
}
|
448
|
+
end
|
449
|
+
})
|
450
|
+
@project.to_xml.should == <<-XML
|
451
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
452
|
+
<modelVersion>4.0.0</modelVersion>
|
453
|
+
<groupId>test</groupId>
|
454
|
+
<artifactId>project</artifactId>
|
455
|
+
<version>0.0.0</version>
|
456
|
+
<build>
|
457
|
+
<plugins>
|
458
|
+
<plugin>
|
459
|
+
<artifactId>maven-war-plugin</artifactId>
|
460
|
+
<configuration>
|
461
|
+
<webResources>
|
462
|
+
<resource>
|
463
|
+
<directory>public</directory>
|
464
|
+
</resource>
|
465
|
+
<resource>
|
466
|
+
<directory>.</directory>
|
467
|
+
<includes>
|
468
|
+
<include>app/**</include>
|
469
|
+
<include>config/**</include>
|
470
|
+
<include>lib/**</include>
|
471
|
+
<include>vendor/**</include>
|
472
|
+
<include>Gemfile</include>
|
473
|
+
</includes>
|
474
|
+
<targetPath>WEB-INF</targetPath>
|
475
|
+
</resource>
|
476
|
+
<resource>
|
477
|
+
<directory>${gem.path}</directory>
|
478
|
+
<targetPath>WEB-INF/gems</targetPath>
|
479
|
+
</resource>
|
480
|
+
</webResources>
|
481
|
+
</configuration>
|
482
|
+
</plugin>
|
483
|
+
<plugin>
|
484
|
+
<groupId>org.codehaus.mojo</groupId>
|
485
|
+
<artifactId>gwt-maven-plugin</artifactId>
|
486
|
+
<version>2.1.0</version>
|
487
|
+
<configuration>
|
488
|
+
<extraJvmArgs>-Xmx512m</extraJvmArgs>
|
489
|
+
<runTarget>example.html</runTarget>
|
490
|
+
</configuration>
|
491
|
+
<executions>
|
492
|
+
<execution>
|
493
|
+
<goals>
|
494
|
+
<goal>clean</goal>
|
495
|
+
<goal>compile</goal>
|
496
|
+
<goal>test</goal>
|
497
|
+
</goals>
|
498
|
+
</execution>
|
499
|
+
</executions>
|
500
|
+
</plugin>
|
501
|
+
<plugin>
|
502
|
+
<groupId>org.mortbay.jetty</groupId>
|
503
|
+
<artifactId>jetty-maven-plugin</artifactId>
|
504
|
+
<version>7.2.2.v20101205</version>
|
505
|
+
<configuration>
|
506
|
+
<connectors>
|
507
|
+
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
|
508
|
+
<port>8080</port>
|
509
|
+
</connector>
|
510
|
+
<connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
|
511
|
+
<port>8443</port>
|
512
|
+
<keystore>${project.basedir}/src/test/resources/server.keystore</keystore>
|
513
|
+
<keyPassword>123456</keyPassword>
|
514
|
+
<password>123456</password>
|
515
|
+
</connector>
|
516
|
+
</connectors>
|
517
|
+
</configuration>
|
518
|
+
</plugin>
|
519
|
+
</plugins>
|
520
|
+
</build>
|
521
|
+
</project>
|
522
|
+
XML
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
describe Maven::Model::Build do
|
527
|
+
|
528
|
+
before :each do
|
529
|
+
@build = Maven::Model::Build.new
|
530
|
+
end
|
531
|
+
|
532
|
+
it 'should setup an empty build' do
|
533
|
+
@build.to_xml.should == ""
|
534
|
+
end
|
535
|
+
|
536
|
+
it 'should setup a build with final_name' do
|
537
|
+
@build.final_name "final"
|
538
|
+
@build.to_xml.should == <<-XML
|
539
|
+
<build>
|
540
|
+
<finalName>final</finalName>
|
541
|
+
</build>
|
542
|
+
XML
|
543
|
+
end
|
544
|
+
|
545
|
+
it 'should setup a build with resources' do
|
546
|
+
@build.resources.add do |r|
|
547
|
+
r.target_path "${project.basedir}"
|
548
|
+
r.filtering false
|
549
|
+
r.directory "${project.build.directory}/apache-maven-${maven.version}"
|
550
|
+
r.includes += ["**/*.rb", "*.java"]
|
551
|
+
r.excludes << 'test.rb'
|
552
|
+
end
|
553
|
+
@build.to_xml.should == <<-XML
|
554
|
+
<build>
|
555
|
+
<resources>
|
556
|
+
<resource>
|
557
|
+
<directory>${project.build.directory}/apache-maven-${maven.version}</directory>
|
558
|
+
<includes>
|
559
|
+
<include>**/*.rb</include>
|
560
|
+
<include>*.java</include>
|
561
|
+
</includes>
|
562
|
+
<excludes>
|
563
|
+
<exclude>test.rb</exclude>
|
564
|
+
</excludes>
|
565
|
+
<targetPath>${project.basedir}</targetPath>
|
566
|
+
</resource>
|
567
|
+
</resources>
|
568
|
+
</build>
|
569
|
+
XML
|
570
|
+
end
|
571
|
+
|
572
|
+
it 'should setup a build with test-resources' do
|
573
|
+
@build.test_resources do |res|
|
574
|
+
res.add do |r|
|
575
|
+
r.target_path "${project.basedir}"
|
576
|
+
r.directory "${project.build.directory}/apache-maven-${maven.version}"
|
577
|
+
r.filtering false
|
578
|
+
end
|
579
|
+
res.add do |r|
|
580
|
+
r.target_path "${project.basedir}"
|
581
|
+
r.directory "${project.build.directory}"
|
582
|
+
r.filtering true
|
583
|
+
end
|
584
|
+
end
|
585
|
+
@build.to_xml.should == <<-XML
|
586
|
+
<build>
|
587
|
+
<testResources>
|
588
|
+
<testResource>
|
589
|
+
<directory>${project.build.directory}/apache-maven-${maven.version}</directory>
|
590
|
+
<targetPath>${project.basedir}</targetPath>
|
591
|
+
</testResource>
|
592
|
+
<testResource>
|
593
|
+
<directory>${project.build.directory}</directory>
|
594
|
+
<targetPath>${project.basedir}</targetPath>
|
595
|
+
<filtering>true</filtering>
|
596
|
+
</testResource>
|
597
|
+
</testResources>
|
598
|
+
</build>
|
599
|
+
XML
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
describe Maven::Model::Profile do
|
604
|
+
|
605
|
+
before :each do
|
606
|
+
@profile = Maven::Model::Profile.new(:test)
|
607
|
+
end
|
608
|
+
|
609
|
+
it 'should setup an empty profile' do
|
610
|
+
@profile.to_xml.should == <<-XML
|
611
|
+
<profile>
|
612
|
+
<id>test</id>
|
613
|
+
</profile>
|
614
|
+
XML
|
615
|
+
end
|
616
|
+
it 'should setup a profile with activation by default' do
|
617
|
+
@profile.activation.by_default
|
618
|
+
@profile.to_xml.should == <<-XML
|
619
|
+
<profile>
|
620
|
+
<id>test</id>
|
621
|
+
<activation>
|
622
|
+
<activeByDefault>true</activeByDefault>
|
623
|
+
</activation>
|
624
|
+
</profile>
|
625
|
+
XML
|
626
|
+
end
|
627
|
+
it 'should setup a profile with activation by property' do
|
628
|
+
@profile.activation.property("rails.env", "test")
|
629
|
+
@profile.to_xml.should == <<-XML
|
630
|
+
<profile>
|
631
|
+
<id>test</id>
|
632
|
+
<activation>
|
633
|
+
<property>
|
634
|
+
<name>rails.env</name>
|
635
|
+
<value>test</value>
|
636
|
+
</property>
|
637
|
+
</activation>
|
638
|
+
</profile>
|
639
|
+
XML
|
640
|
+
end
|
641
|
+
it 'should setup a profile with activation by OS family' do
|
642
|
+
@profile.activation.os.family "mac"
|
643
|
+
@profile.to_xml.should == <<-XML
|
644
|
+
<profile>
|
645
|
+
<id>test</id>
|
646
|
+
<activation>
|
647
|
+
<os>
|
648
|
+
<family>mac</family>
|
649
|
+
</os>
|
650
|
+
</activation>
|
651
|
+
</profile>
|
652
|
+
XML
|
653
|
+
end
|
654
|
+
it 'should setup a profile with properties' do
|
655
|
+
@profile.properties.merge!({
|
656
|
+
"gem.home" => "${project.build.directory}/rubygems-production",
|
657
|
+
"gem.path" => "${project.build.directory}/rubygems-production"
|
658
|
+
})
|
659
|
+
@profile.to_xml.should == <<-XML
|
660
|
+
<profile>
|
661
|
+
<id>test</id>
|
662
|
+
<properties>
|
663
|
+
<gem.home>${project.build.directory}/rubygems-production</gem.home>
|
664
|
+
<gem.path>${project.build.directory}/rubygems-production</gem.path>
|
665
|
+
</properties>
|
666
|
+
</profile>
|
667
|
+
XML
|
668
|
+
end
|
669
|
+
it 'should setup a profile with plugins' do
|
670
|
+
@profile.plugin("org.mortbay.jetty:jetty-maven-plugin", "${jetty.version}")
|
671
|
+
@profile.to_xml.should == <<-XML
|
672
|
+
<profile>
|
673
|
+
<id>test</id>
|
674
|
+
<build>
|
675
|
+
<plugins>
|
676
|
+
<plugin>
|
677
|
+
<groupId>org.mortbay.jetty</groupId>
|
678
|
+
<artifactId>jetty-maven-plugin</artifactId>
|
679
|
+
<version>${jetty.version}</version>
|
680
|
+
</plugin>
|
681
|
+
</plugins>
|
682
|
+
</build>
|
683
|
+
</profile>
|
684
|
+
XML
|
685
|
+
end
|
686
|
+
it 'should setup a profile with gem dependency and dependency_management' do
|
687
|
+
@profile.gem "cucumber", nil
|
688
|
+
@profile.dependency_management.gem "cucumber", "0.9.4"
|
689
|
+
@profile.to_xml.should == <<-XML
|
690
|
+
<profile>
|
691
|
+
<id>test</id>
|
692
|
+
<dependencies>
|
693
|
+
<dependency>
|
694
|
+
<groupId>rubygems</groupId>
|
695
|
+
<artifactId>cucumber</artifactId>
|
696
|
+
<type>gem</type>
|
697
|
+
</dependency>
|
698
|
+
</dependencies>
|
699
|
+
<dependencyManagement>
|
700
|
+
<dependencies>
|
701
|
+
<dependency>
|
702
|
+
<groupId>rubygems</groupId>
|
703
|
+
<artifactId>cucumber</artifactId>
|
704
|
+
<version>0.9.4</version>
|
705
|
+
<type>gem</type>
|
706
|
+
</dependency>
|
707
|
+
</dependencies>
|
708
|
+
</dependencyManagement>
|
709
|
+
</profile>
|
710
|
+
XML
|
711
|
+
end
|
712
|
+
end
|
713
|
+
end
|