1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

feature #450: help and warning message for install_gems

This commit is contained in:
Javi Fontan 2011-07-12 16:07:40 +02:00
parent 77264fea32
commit 0cac34ce8f

View File

@ -21,6 +21,29 @@ def try_library(name, error_message)
end
end
def install_warning(packages)
puts "Use -h for help"
puts
puts "About to install the gems for these components:"
puts "* "<<packages.join("\n* ")
puts
puts "Are you sure you want to continue? (YES/no)"
yes=STDIN.readline
if yes.strip!="YES"
puts "Installation aborted"
exit(0)
end
end
def help
puts "Specify the package dependencies from this list:"
puts "* "<<PACKAGES.join("\n* ")
puts
puts "If no parameters are specified then this list will be used:"
puts DEFAULT.join(' ')
end
try_library :rubygems, <<-EOT.unindent
rubygems required to use this tool
@ -46,6 +69,10 @@ try_library :bundler, <<-EOT.unindent
[sudo] gem install bundler
EOT
if ARGV.include?('-h')
help
exit(0)
end
if ARGV.length>0
packages=ARGV
@ -58,8 +85,10 @@ no_packages<<'dummy'
without="--without #{no_packages.join(' ')}"
command_string = "bundle #{without}"
command_string = "bundle install #{without}"
install_warning(packages)
puts command_string
#system command_string
system command_string