/
Mavenfile
80 lines (66 loc) · 2.47 KB
/
Mavenfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#-*- mode: ruby -*-
# it is war-file
packaging 'war'
# get jruby dependencies
properties( 'jruby.version' => '@project.version@',
'jruby.plugins.version' => '1.0.7',
'project.build.sourceEncoding' => 'utf-8',
'public.dir' => '${basedir}/public' )
pom( 'org.jruby:jruby', '${jruby.version}' )
jar( 'org.jruby.rack:jruby-rack', '1.1.18',
:exclusions => [ 'org.jruby:jruby-complete' ] )
# ruby-maven will dump an equivalent pom.xml
properties[ 'tesla.dump.pom' ] = 'pom.xml'
# a gem to be used
gem 'flickraw', '0.9.7'
repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'rubygems-releases' )
jruby_plugin :gem, :includeRubygemsInResources => true, :includeLibDirectoryInResources => true do
execute_goal :initialize
end
# not really needed but for completeness:
# pack the war with that ruby-like directory layout
plugin( :war, '2.2',
:warSourceDirectory => '${public.dir}' )
resource :directory => '${basedir}', :includes => [ 'config.ru', '.jrubydir' ]
# start jetty for the tests
plugin( 'org.eclipse.jetty:jetty-maven-plugin', '9.1.3.v20140225',
:path => '/',
:webAppSourceDirectory => '${public.dir}',
:stopPort => 9999,
:stopKey => 'foo' ) do
execute_goal( 'start', :id => 'start jetty', :phase => 'pre-integration-test', :daemon => true )
execute_goal( 'stop', :id => 'stop jetty', :phase => 'post-integration-test' )
end
# download files during the tests
result = nil
execute 'download', :phase => 'integration-test' do
require 'open-uri'
result = open( 'http://localhost:8080' ).string
puts result
end
# verify the downloads
execute 'check download', :phase => :verify do
expected = 'hello world:'
unless result.match( /^#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'self: uri:classloader://config.ru'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'PWD: uri:classloader://'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
expected = 'Gem.path: ."uri:classloader://",'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
# TODO get rid off this over normalization
expected = 'uri:classloader:/gems/flickraw-0.9.7'
unless result.match( /#{expected}/ )
raise "missed expected string in download: #{expected}"
end
end
# vim: syntax=Ruby