Class: Jara::Cli
- Inherits:
-
Object
- Object
- Jara::Cli
- Defined in:
- lib/jara/cli.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Cli
constructor
A new instance of Cli.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Cli
Returns a new instance of Cli.
8 9 10 11 |
# File 'lib/jara/cli.rb', line 8 def initialize(argv) @command = argv.first @argv = argv.drop(1) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jara/cli.rb', line 13 def run parse_argv(@argv) = {} [:archiver] = @archiver if @archiver [:build_command] = @build_command if @build_command [:branch] = @branch if @branch releaser = Jara::Releaser.new(@environment, @bucket, ) case @command when /help|-h/ $stderr.puts(option_parser) when 'release' releaser.release when 'build' releaser.build_artifact else $stderr.puts('Unknown command "%s", expected "build" or "release"' % @command) exit(1) end rescue OptionParser::ParseError => e $stderr.puts(option_parser) exit(1) rescue JaraError => e $stderr.puts(sprintf('Could not %s artifact: %s', @command, e.)) exit(1) end |