class Hanzo::Console
Constants
- UninstalledEnvironment
- UnknownCommand
- UnknownEnvironment
Classes
Public Instance Methods
console()
click to toggle source
# File lib/hanzo/modules/console.rb, line 27 def console command = Hanzo.config['console'] raise UnknownCommand unless command Hanzo.run "heroku run --remote #{@env} #{command}" end
initialize_cli()
click to toggle source
# File lib/hanzo/modules/console.rb, line 12 def initialize_cli initialize_help && return if @env.nil? validate_environment_existence! console rescue UnknownCommand Hanzo.unindent_print 'A “console” command is needed in `.hanzo.yml`', :red rescue UnknownEnvironment Hanzo.unindent_print "Environment `#{@env}` doesn't exist. Add it to .hanzo.yml and run:\n hanzo install remotes", :red Hanzo.unindent_print "\nFor more information, read https://github.com/mirego/hanzo#remotes", :red rescue UninstalledEnvironment Hanzo.unindent_print "Environment `#{@env}` has been found in your .hanzo.yml file. Before using it, you must install it:\n hanzo install remotes", :red end
initialize_variables()
click to toggle source
# File lib/hanzo/modules/console.rb, line 8 def initialize_variables @env = extract_argument(1) end
Protected Instance Methods
fetcher()
click to toggle source
# File lib/hanzo/modules/console.rb, line 53 def fetcher @fetcher ||= Hanzo::Fetchers::Environment.new(@env) end
initialize_help()
click to toggle source
# File lib/hanzo/modules/console.rb, line 36 def initialize_help @options.banner = <<-BANNER.unindent Usage: hanzo console ENVIRONMENT Available environments BANNER Hanzo::Installers::Remotes.environments.each do |env| @options.banner << " - #{env.first}\n" end end
validate_environment_existence!()
click to toggle source
# File lib/hanzo/modules/console.rb, line 48 def validate_environment_existence! raise UnknownEnvironment unless fetcher.exist? raise UninstalledEnvironment unless fetcher.installed? end