lib/devinstall/cli.rb in devinstall-0.2.3 vs lib/devinstall/cli.rb in devinstall-0.2.5

- old
+ new

@@ -18,17 +18,22 @@ begin @opt = Getopt::Long.getopts( ['--package', '-p', Getopt::REQUIRED], ['--config', '-c', Getopt::REQUIRED], ['--type', '-t', Getopt::REQUIRED], - ['--env', '-e', Getopt::REQUIRED], + ['--env','-e', Getopt::REQUIRED], + ['--verbose', '-v'], + ['--dry-run', '-d'], ) rescue puts 'Invalid option in command line' help exit! 1 end + #verbose and dry-run + $verbose ||= @opt['verbose'] + $dry ||= @opt['dry-run'] # get config file unless get_config(["./devinstall.yml"]) puts 'You must specify the config file' exit! 1 # Exit end @@ -48,11 +53,11 @@ end def version puts "devinstall version #{Devinstall::VERSION}" puts "pkg-tool version #{Devinstall::VERSION}" - exit(0) + exit! 0 end def help puts 'Usage:' puts 'pkg-install command --config|-c <file> --package|-p <package> --type|-t <package_type> --env|-e <environment>' @@ -63,21 +68,21 @@ def build @package.build(@opt['type'].to_sym) end def install - package.build(@opt['type'].to_sym) - package.install(@opt['env'].to_sym) + @package.build(@opt['type'].to_sym) + @package.install(@opt['env'].to_sym) end def upload - package.build(@opt['type'].to_sym) - package.run_tests(@opt['env'].to_sym) - package.upload(@opt['env'].to_sym) + @package.build(@opt['type'].to_sym) + @package.run_tests(@opt['env'].to_sym) + @package.upload(@opt['env'].to_sym) end def test - package.run_tests(@opt['env'].to_sym) + @package.run_tests(@opt['env'].to_sym) end end end