Class: App42::Command::Info
Instance Method Summary collapse
-
#activities ⇒ Object
will return details of user activities like operation, status, date etc.
-
#get_activities ⇒ Object
return user activities.
-
#info ⇒ Object
show detailed app information.
-
#logs ⇒ Object
Returns the log URLs for the application.
-
#releases ⇒ Object
list releases.
-
#state ⇒ Object
show app status information.
Methods inherited from Base
#app_information, #app_operation, #app_url_availability, #assign_release_static_ip, #cloudapi_operation, #collect_app_source, #create_cloud_setup, #create_gpaas_setup, #create_infrastructure, #create_service, #create_service_tunnel, #create_wordpress_setup, #custom_url_information, #custom_url_operation, #delete_cloudapi, #delete_gpaas, #delete_service, #delete_service_tunnel, #delete_wordpress, #get_app_name, #get_app_name_and_check_app_url_availability, #get_app_source, #get_custom_url, #get_framework, #get_iaas_providers, #get_instance, #get_kontena, #get_os_for_app, #get_os_for_service, #get_runtime, #get_setup_name, #get_setup_name_and_check_setup_url_availability, #get_subscription, #get_vm_types, #get_vmconfig, #get_webserver, #get_wordpress_name, #get_wordpress_name_and_check_wordpress_url_availability, #gpaas_operation, #initialize, #interactive_get, #reset_password, #scale_or_descale_app, #service_name_availability, #service_operation, #setup_url_availability, #update_binary, #update_gpaas_dashboard, #upgrade_or_downgrade_cloudapi, #upgrade_or_downgrade_gpaas, #upgrade_or_downgrade_wordpress, #upload_binary, #upload_service_backup, #vscale_or_vdescale_app, #vscale_or_vdescale_service, #wordpress_operation, #wordpress_url_availability
Methods included from Base::HttpHelper
#build_delete_request, #build_get_request, #build_post_request, #build_put_request, #delete_request, #get_request, #post_request, #put_request
Methods included from Base::Util
#app42_client_info, #ask_app_name, #camel_case_to_whitespace, #check_transaction_status, #check_transaction_status_of_setup, #escape_path, #get_flavour_for_upgrade_or_downgrade, #get_instance_config_for_upgrade_or_downgrade, #input, #ip_address_valid?, #is_app_exist?, #is_service_exist?, #is_setup_name_exist?, #is_static_ip_assigned?, #json_parse, #message, #number_valid?, #numeric?, #numeric_including_zero?, #params, #parse_error_message, #print_new_line, #request_failed?, #resource_url, #show_wait_spinner, #signature, #status_call, #time_valid?, #util_base, #validate_app_and_service_name, #validate_database_name, #validate_git_url, #validate_setup_name, #validate_upload_backup_path, #validate_url, #validate_vm_config
Methods included from UserToken
#check_key_file?, #config_path, #ensure_config_dir, #ensure_key_file, #get_keys, #key_path, #local_app42_key, #remove_key_file
Constructor Details
This class inherits a constructor from App42::Command::Base
Instance Method Details
#activities ⇒ Object
will return details of user activities like operation, status, date etc.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/app42/command/info.rb', line 80 def activities rows, rows_header_final, rows_header = [], [], nil user_activities = get_activities if user_activities['success'] && user_activities['activities'] user_activities['activities'].each do |each_activity| rows_header = each_activity.keys rows << each_activity.values end rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) } table = Terminal::Table.new :title => Paint["=== User Activities ===", :green], :headings => rows_header_final, :rows => rows puts table end end |
#get_activities ⇒ Object
return user activities
11 12 13 |
# File 'lib/app42/command/info.rb', line 11 def get_activities build_get_request params, 'info', 'activities' end |
#info ⇒ Object
show detailed app information
Examples:
$ app42 info –app APP
Demo info
Memory 512 Framework rails Runtime ruby20 Domain demo.app42paas.com User jon Status running
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/app42/command/info.rb', line 30 def info @options[:name] = get_app_name if @options[:name].nil? rows, rows_header_final, rows_header = [], [], nil app_info = app_information 'app', @options[:name] if app_info && app_info['appInfo'] rows_header = app_info['appInfo'].keys rows << app_info['appInfo'].values rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) } table = Terminal::Table.new :title => Paint["=== #{@options[:name]} Info ===", :green], :headings => rows_header_final, :rows => rows puts table end end |
#logs ⇒ Object
Returns the log URLs for the application
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/app42/command/info.rb', line 66 def logs @options[:name] = get_app_name if @options[:name].nil? app_logs = app_information 'app/logs', @options[:name] if is_app_exist? @options[:name] rows, rows_header = [], nil rows_header = 'Log URL(s)' app_logs['logUrls'].each do |log| rows << Array(log) end "#{Message::LOG_MESSAGE}", true, 'green' table = Terminal::Table.new :title => rows_header, :rows => rows puts table end |
#releases ⇒ Object
list releases
Examples:
$ app42 releases –app APP
Demo releases
Version v1
Email [email protected]
Date 20/02/2010
TODO , NEED TO SYNC WITH SERVICE
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/app42/command/info.rb', line 109 def releases @options[:name] = get_app_name if @options[:name].nil? app_releases = app_information 'releases', @options[:name] puts Paint["=== #{@options[:name]} releases ===", :green] app_releases['releaseInfo'].each do |release| release.each_pair do |key, value| print Paint["#{key.capitalize}", :bright] print Paint[" #{value}\n", :bright] end end if app_releases['releaseInfo'] print_new_line end |
#state ⇒ Object
show app status information
Examples:
$ app42 status –app APP
Demo status
running
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/app42/command/info.rb', line 53 def state @options[:name] = get_app_name if @options[:name].nil? rows = [] rows_header = nil app_status = app_information 'app', @options[:name] rows_header = Array('State') rows << Array(app_status['appInfo']['appStatus']) table = Terminal::Table.new :title => Paint["=== #{@options[:name]} State ===", :green], :rows => rows puts table end |