Sha256: 84251b67575eef12b3a0c90552b4125c91c29a0e0684b5b5eacc8b581e4154e4

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

require 'itamae'
require 'thor'

module Itamae
  class CLI < Thor
    class_option :log_level, type: :string, aliases: ['-l'], default: 'info'

    def initialize(*args)
      super

      Itamae::Logger.level = ::Logger.const_get(options[:log_level].upcase)
    end

    desc "local RECIPE [RECIPE...]", "Run Itamae locally"
    option :node_json, type: :string, aliases: ['-j']
    option :dry_run, type: :string, aliases: ['-n']
    option :ohai, type: :boolean, default: false
    def local(*recipe_files)
      Runner.run(recipe_files, :local, options)
    end

    desc "ssh RECIPE [RECIPE...]", "Run Itamae via ssh"
    option :node_json, type: :string, aliases: ['-j']
    option :dry_run, type: :string, aliases: ['-n']
    option :host, required: true, type: :string, aliases: ['-h']
    option :user, type: :string, aliases: ['-u']
    option :key, type: :string, aliases: ['-i']
    option :port, type: :numeric, aliases: ['-p']
    option :ohai, type: :boolean, default: false
    def ssh(*recipe_files)
      Runner.run(recipe_files, :ssh, options)
    end

    desc "version", "Print version"
    def version
      puts "Itamae v#{Itamae::VERSION}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
itamae-1.0.0.beta13 lib/itamae/cli.rb
itamae-1.0.0.beta12 lib/itamae/cli.rb
itamae-1.0.0.beta11 lib/itamae/cli.rb
itamae-1.0.0.beta10 lib/itamae/cli.rb