lib/cloud_crowd/command_line.rb in cloud-crowd-0.2.2 vs lib/cloud_crowd/command_line.rb in cloud-crowd-0.2.3
- old
+ new
@@ -39,11 +39,11 @@
case command
when 'console' then run_console
when 'server' then run_server(subcommand)
when 'node' then run_node(subcommand)
when 'load_schema' then run_load_schema
- when 'install' then run_install
+ when 'install' then run_install(subcommand)
else usage
end
end
# Spin up an IRB session with the CloudCrowd code loaded in, and a database
@@ -137,13 +137,13 @@
require 'cloud_crowd/schema.rb'
end
# Install the required CloudCrowd configuration files into the specified
# directory, or the current one.
- def run_install
+ def run_install(install_path)
require 'fileutils'
- install_path = ARGV.shift || '.'
+ install_path ||= '.'
FileUtils.mkdir_p install_path unless File.exists?(install_path)
install_file "#{CC_ROOT}/config/config.example.yml", "#{install_path}/config.yml"
install_file "#{CC_ROOT}/config/config.example.ru", "#{install_path}/config.ru"
install_file "#{CC_ROOT}/config/database.example.yml", "#{install_path}/database.yml"
install_file "#{CC_ROOT}/actions", "#{install_path}/actions", true
@@ -222,10 +222,10 @@
if File.exists?(dest)
print "#{dest} already exists. Overwrite it? (yes/no) "
return unless ['y', 'yes', 'ok'].include? gets.chomp.downcase
end
is_dir ? FileUtils.cp_r(source, dest) : FileUtils.cp(source, dest)
- puts "installed #{dest}"
+ puts "installed #{dest}" unless ENV['RACK_ENV'] == 'test'
end
end
end
\ No newline at end of file