Class: Hako::CLI::Deploy
- Inherits:
-
Object
- Object
- Hako::CLI::Deploy
- Defined in:
- lib/hako/cli.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
20 minutes
1200
Instance Method Summary collapse
Instance Method Details
#parse!(argv) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/hako/cli.rb', line 74 def parse!(argv) @force = false @tag = 'latest' @dry_run = false @verbose = false @timeout = DEFAULT_TIMEOUT parser.parse!(argv) @yaml_path = argv.first if @yaml_path.nil? puts parser.help exit 1 end end |
#parser ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/hako/cli.rb', line 89 def parser @parser ||= OptionParser.new do |opts| opts. = 'hako deploy [OPTIONS] FILE' opts.version = VERSION opts.on('-f', '--force', 'Run deployment even if nothing is changed') { @force = true } opts.on('-t', '--tag=TAG', 'Specify tag (default: latest)') { |v| @tag = v } opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true } opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true } opts.on('--timeout=TIMEOUT_SEC', "Timeout deployment after TIMEOUT_SEC seconds (default: #{DEFAULT_TIMEOUT})") { |v| @timeout = v.to_i } end end |
#run(argv) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/hako/cli.rb', line 60 def run(argv) parse!(argv) require 'hako/application' require 'hako/commander' if @verbose Hako.logger.level = Logger::DEBUG end Commander.new(Application.new(@yaml_path)).deploy(force: @force, tag: @tag, dry_run: @dry_run, timeout: @timeout) end |