vivo/legacy/utilities/LoadTesting/scripts/_deploy

44 lines
1.5 KiB
Text
Raw Normal View History

#! /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