CF-29: add vcap_components from command line if present

Change-Id: I0b85e3f5fd16a4697239bff65a2da3c68788b618
This commit is contained in:
Dave Syer 2012-05-04 12:13:57 +01:00
Родитель 6db0bbc943
Коммит 678790a0c3
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -32,8 +32,10 @@ else
puts "Targeting default deployment \"#{options["name"]}\""
end
if ARGV[0].nil? || !%w[start stop restart tail status].include?(ARGV[0].downcase)
STDERR.puts "Usage: #{$0} [-n deployment_name] [-d cloudfoundry_home_dir] [start|stop|restart|tail|status]"
command = ARGV[0] ? ARGV.shift.downcase : nil
if command.nil? || !%w[start stop restart tail status].include?(command)
STDERR.puts "Usage: #{$0} [-n deployment_name] [-d cloudfoundry_home_dir] [start|stop|restart|tail|status] [COMPONENT]"
exit 1
end
@ -47,6 +49,13 @@ rescue => e
exit 1
end
# select only those components that are on the command line (if any)
if !ARGV.empty? and (vcap_components["components"] & ARGV).empty?
STDERR.puts "The component(s) specified on the command line are unknown.\nPlease specify one or more of (#{vcap_components['components'].join(' ')})"
exit 1
end
vcap_components["components"] &= ARGV unless ARGV.empty?
unless File.exists?(File.join(deployment_info["cloudfoundry_path"], "bin", "vcap"))
puts "Cannot find vcap repo. Please specify the deployment name or the deployment home directory where to find the config file"
exit 1
@ -88,4 +97,4 @@ vcap_path = File.join(deployment_info["cloudfoundry_path"], "bin")
vcap_launch = File.join(script_dir, "vcap")
puts "Using cloudfoundry config from #{deployment_config_path}"
exec_cmd("#{ruby_binary} #{vcap_launch} #{ARGV[0].downcase} #{vcap_components["components"].join(" ")} -c #{deployment_config_path} -v #{vcap_path} -l #{deployment_info["deployment_log_path"]}")
exec_cmd("#{ruby_binary} #{vcap_launch} #{command} #{vcap_components["components"].join(" ")} -c #{deployment_config_path} -v #{vcap_path} -l #{deployment_info["deployment_log_path"]}")