class Hanzo::CLI

Public Instance Methods

run() click to toggle source
# File lib/hanzo/cli.rb, line 9
def run
  @options.parse!(@args) if @opts.respond_to? :parse!
  puts @options unless @options.to_s == "Usage: hanzo [options]\n"
end

Protected Instance Methods

initialize_cli() click to toggle source
# File lib/hanzo/cli.rb, line 20
def initialize_cli
  initialize_help && return if @app.nil?

  begin
    @options = Hanzo.const_get(@app.capitalize).new(@args).options
  rescue NameError
    initialize_help
  end
end
initialize_help() click to toggle source
# File lib/hanzo/cli.rb, line 30
    def initialize_help
      @options.banner = <<-BANNER.unindent
        Usage: hanzo action [options]

        Available actions:
           deploy - Deploy a branch or a tag
             diff - Show the diff between HEAD and the current release
          install - Install Hanzo configuration
           config - Manage Heroku configuration variables
          console - Run a console command

        Options:
      BANNER
      @options.on('-h', '--help', 'You\'re looking at it.') { puts @options }
      @options.on('-v', '--version', 'Print version') { puts "Hanzo #{Hanzo::VERSION}" }
    end
initialize_variables() click to toggle source
# File lib/hanzo/cli.rb, line 16
def initialize_variables
  @app = extract_argument(0)
end