Skip to content

Commit e521d2d

Browse files
committed
Cleanup test harness auto-installation of jars.
1 parent 0c4b40a commit e521d2d

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

spec/spec_helper.rb

+35-28
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
config.include RequestsHelper
2626

27+
should_build_and_install_on_vagrant = true
28+
has_built_and_installed_on_vagrant = false
29+
2730
config.before :all do
2831
root_project_path = File.expand_path('../../', __FILE__)
2932
vagrant_path = File.join(root_project_path, 'vagrant', 'tomcat-redis-example')
@@ -32,35 +35,39 @@
3235
# raise "Expected vagrant to be running."
3336
#end
3437

35-
# build manager
36-
build_manager_command = <<-eos
37-
cd #{root_project_path} \
38-
&& gradle clean \
39-
&& gradle build
40-
eos
41-
`#{build_manager_command}`
38+
if should_build_and_install_on_vagrant && !has_built_and_installed_on_vagrant
39+
# build manager
40+
build_manager_command = <<-eos
41+
cd #{root_project_path} \
42+
&& gradle clean \
43+
&& gradle build
44+
eos
45+
`#{build_manager_command}`
46+
47+
# build example app
48+
build_example_app_command = <<-eos
49+
cd #{example_app_path} \
50+
&& gradle clean \
51+
&& gradle war
52+
eos
53+
`#{build_example_app_command}`
4254

43-
# build example app
44-
build_example_app_command = <<-eos
45-
cd #{example_app_path} \
46-
&& gradle clean \
47-
&& gradle war
48-
eos
49-
`#{build_example_app_command}`
55+
deploy_command = <<-eos
56+
cd #{vagrant_path} \
57+
&& vagrant ssh -c "\
58+
sudo service tomcat7 stop \
59+
&& sudo mkdir -p /var/lib/tomcat7/lib \
60+
&& sudo rm -rf /var/lib/tomcat7/lib/tomcat-redis-session-manager* \
61+
&& sudo cp /opt/tomcat-redis-session-manager/build/libs/tomcat-redis-session-manager*.jar /var/lib/tomcat7/lib/ \
62+
&& sudo rm -rf /var/lib/tomcat7/webapps/example* \
63+
&& sudo cp /opt/tomcat-redis-session-manager/example-app/build/libs/example-app*.war /var/lib/tomcat7/webapps/example.war \
64+
&& sudo rm -f /var/log/tomcat7/* \
65+
&& sudo service tomcat7 start \
66+
"
67+
eos
68+
`#{deploy_command}`
5069

51-
deploy_command = <<-eos
52-
cd #{vagrant_path} \
53-
&& vagrant ssh -c "\
54-
sudo service tomcat7 stop \
55-
&& sudo mkdir -p /var/lib/tomcat7/lib \
56-
&& sudo rm -rf /var/lib/tomcat7/lib/tomcat-redis-session-manager* \
57-
&& sudo cp /opt/tomcat-redis-session-manager/build/libs/tomcat-redis-session-manager*.jar /var/lib/tomcat7/lib/ \
58-
&& sudo rm -rf /var/lib/tomcat7/webapps/example* \
59-
&& sudo cp /opt/tomcat-redis-session-manager/example-app/build/libs/example-app*.war /var/lib/tomcat7/webapps/example.war \
60-
&& sudo rm -f /var/log/tomcat7/* \
61-
&& sudo service tomcat7 start \
62-
"
63-
eos
64-
`#{deploy_command}`
70+
has_built_and_installed_on_vagrant = true
71+
end
6572
end
6673
end

0 commit comments

Comments
 (0)