Class: Pagoda::Command::Tunnel
- Defined in:
- lib/pagoda/cli/helpers/tunnel.rb
Constant Summary
Constants included from Helpers
Instance Attribute Summary
Attributes inherited from Base
#args, #client, #globals, #options
Instance Method Summary collapse
Methods inherited from Base
#app, ask_for_credentials, #branch, #commit, #extract_app_from_git_config, #extract_app_from_remote, #extract_git_clone_url, #find_branch, #find_commit, #git_remotes, #home_dir, #initialize, #locate_app_root, #loop_transaction, #password, #remote, #shell, #user
Methods included from Helpers
#build_indent, #confirm, #create_git_remote, #display, #display_name, #error, #format_date, #git, #has_git?, #home_directory, #remove_app, #remove_git_remote, #running_on_a_mac?, #running_on_windows?
Constructor Details
This class inherits a constructor from Pagoda::Command::Base
Instance Method Details
#output_error ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/pagoda/cli/helpers/tunnel.rb', line 32 def output_error errors = [] errors << "Input unrecoginized" errors << "try: pagoda -a [appname] tunnel [component]" errors << "ie. (pagoda -a app tunnel db1)" error errors end |
#run ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/pagoda/cli/helpers/tunnel.rb', line 6 def run user_input = [:component] || args.first component = {} begin if user_input =~ /^(web\d*)|(db\d*)|(cache\d*)|(worker\d*)$/ components = client.component_list(app) components.delete_if {|x| x[:cuid] != user_input } component = components[0] else component = client.component_info(app, user_input) end rescue output_error end output_error unless component if component[:tunnelable] type = component[:_type] component_id = component[:_id] app_id = component[:app_id] Pagoda::Tunnel.new(type, user, password, app_id, component_id).start else error "Either the component is not tunnelable or you do not have access" end end |