Sha256: d83d3510a0d66ff7b1a3ebdbf21099b262a84e2e8cfec3bf2b74a0d47f5fdab9

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

require 'hanzo/modules/deploy'
require 'hanzo/modules/install'
require 'hanzo/modules/config'

module Hanzo
 class CLI < Base
    def run
      @options.parse!(@args) if @opts.respond_to? :parse!
      puts @options unless @options.to_s == "Usage: hanzo [options]\n"
    end

  protected

    def initialize_variables
      @app = extract_argument(0)
    end

    def initialize_cli
      initialize_help and return if @app.nil?

      begin
        @options = Hanzo.const_get(@app.capitalize).new(@args).options
      rescue NameError
        initialize_help
      end
    end

    def initialize_help
      @options.banner = <<-BANNER.unindent
        Usage: hanzo action [options]

        Available actions:
           deploy - Deploy a branch or a tag
          install - Install Hanzo configuration
           config - Manage Heroku configuration variables

        Options:
      BANNER
      @options.on('-h', '--help', 'You\'re looking at it.') { puts @options }
      @options.on('-v', '--version', 'Print version') { puts "Hanzo #{Hanzo::VERSION}" }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanzo-0.4.2 lib/hanzo/cli.rb
hanzo-0.4.1 lib/hanzo/cli.rb
hanzo-0.4 lib/hanzo/cli.rb
hanzo-0.3.1 lib/hanzo/cli.rb
hanzo-0.3 lib/hanzo/cli.rb