2 # This script generates webapp/META-INF/context.xml
\r
3 # > ruby generateContext.rb (template file) (path to the config file) (docBase) (application path)
\r
5 templateFile = ARGV[0]
\r
6 configFile = ARGV[1] || "ModernSCMD.config"
\r
7 docBase = ARGV[2] || "ModernSCMD.war"
\r
8 applicationPath = ARGV[3] || "/ModernSCMD"
\r
11 if !(File.file? templateFile)
\r
12 puts "#{templateFile} doesn't exist"
\r
17 [/\$\{docbase\}/i, docBase],
\r
18 [/\$\{application\.path\}/i, applicationPath],
\r
19 [/\$\{config\.file\}/i, configFile]
\r
22 open(templateFile, 'r').each { |l|
\r
23 replacement.each { |pattern, var|
\r
24 l.gsub!(pattern, var)
\r