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