Sha256: eda06b6ec6087737f6490984b61fce10218c4786575b5260c05d30bd0cc2752b

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

# frozen_string_literal: true
require 'thor'

module Hako
  class CLI < Thor
    desc 'deploy FILE', 'Run deployment'
    option :force, aliases: %w[-f], type: :boolean, default: false, desc: 'Run deployment even if nothing is changed'
    option :tag, aliases: %w[-t], type: :string, default: 'latest', desc: 'Specify tag (default: latest)'
    option :dry_run, aliases: %w[-n], type: :boolean, default: false, desc: 'Enable dry-run mode'
    def deploy(yaml_path)
      require 'hako/application'
      require 'hako/commander'
      Commander.new(Application.new(yaml_path)).deploy(force: options[:force], tag: options[:tag], dry_run: options[:dry_run])
    end

    desc 'oneshot FILE COMMAND ARG...', 'Run oneshot task'
    option :tag, aliases: %w[-t], type: :string, default: 'latest', desc: 'Specify tag (default: latest)'
    def oneshot(yaml_path, command, *args)
      require 'hako/application'
      require 'hako/commander'
      Commander.new(Application.new(yaml_path)).oneshot([command, *args], tag: options[:tag])
    end

    desc 'show-yaml FILE', 'Show expanded YAML'
    def show_yaml(yaml_path)
      require 'hako/yaml_loader'
      puts YamlLoader.new.load(Pathname.new(yaml_path)).to_yaml
    end

    desc 'status FILE', 'Show deployment status'
    def status(yaml_path)
      require 'hako/application'
      require 'hako/commander'
      Commander.new(Application.new(yaml_path)).status
    end

    desc 'remove FILE', 'Destroy the application'
    def remove(yaml_path)
      require 'hako/application'
      require 'hako/commander'
      Commander.new(Application.new(yaml_path)).remove
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hako-0.7.4 lib/hako/cli.rb
hako-0.7.3 lib/hako/cli.rb
hako-0.7.2 lib/hako/cli.rb