vivo/utilities/LoadTesting/scripts/_deploy
j2blake 4f085bcdfe Update the LoadTesting framework.
Permit use of Git while still supporting Subversion. Improve the script structure and reduce dependence on hard-coded paths.
2013-10-21 15:21:54 -04:00

43 lines
1.5 KiB
Ruby
Executable file

#! /usr/bin/ruby
=begin
--------------------------------------------------------------------------------
Build and deploy the currently selected version of VIVO.
Remove vivo from Tomcat, so we know we start with clean slate.
Create the deploy.properties file by substituting current values into the
template. Then run the build script.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
=end
require File.expand_path('subscripts/common', File.dirname(__FILE__))
require 'erb'
def process_template_file(source, target)
File.open(source) do |source_file|
File.open(target, 'w') do |target_file|
raw = source_file.read()
cooked = ERB.new(raw).result
target_file.write(cooked)
end
end
end
puts system("rm -r #{@home}/tomcat/webapps/vivo*")
puts system("rm -r #{@home}/tomcat/conf/Catalina/localhost/vivo*")
puts system("rm -r #{@home}/tomcat/work/Catalina/localhost/vivo*")
if (@is_git)
process_template_file(distro_file("build.properties.template"), distro_file("VIVO/build.properties"))
process_template_file(distro_file("runtime.properties.template"), version_file("data/runtime.properties"))
Dir.chdir(distro_file("VIVO")) { |path| system "ant clean deploy" }
else
process_template_file(distro_file("deploy.properties.template"), distro_file("vivo/deploy.properties"))
Dir.chdir(distro_file("vivo")) { |path| system "ant clean deploy" }
end