Class: RHC::Commands::Env
Constant Summary
Constants included from Helpers
Helpers::BOUND_WARNING, Helpers::PREFIX, Helpers::ROLES
Instance Method Summary collapse
Methods inherited from Base
Methods included from RHC::ContextHelpers
#find_app, #find_domain, #find_membership_container, #find_team, #from_local_git, included, #namespace_context, #server_context
Methods included from GitHelpers
#git_clone_application, #git_clone_deploy_hooks, #git_clone_repo, #git_cmd, #git_config_get, #git_config_set, #git_remote_add, #git_version, #has_git?
Methods included from Helpers
#agree, #certificate_file, #client_from_options, #collect_env_vars, #color, #confirm_action, #date, #datetime_rfc3339, #debug, #debug?, #debug_error, #decode_json, #deprecated, #deprecated_command, #disable_deprecated?, #distance_of_time_in_words, #env_var_regex_pattern, #error, #exec, #host_exists?, #hosts_file_contains?, #human_size, #info, #interactive?, #jruby?, #mac?, #openshift_online_server?, #openshift_rest_endpoint, #openshift_server, #openshift_url, #pluralize, #results, #role_name, #run_with_tee, #ssh_string, #ssh_string_parts, #ssl_options, #success, #system_path, #table_heading, #to_host, #to_uri, #token_for_user, #unix?, #user_agent, #warn, #windows?, #with_tolerant_encoding
Methods included from OutputHelpers
#default_display_env_var, #display_app, #display_app_configurations, #display_authorization, #display_cart, #display_cart_storage_info, #display_cart_storage_list, #display_deployment, #display_deployment_list, #display_domain, #display_env_var_list, #display_key, #display_team, #format_cart_gears, #format_cart_header, #format_gear_info, #format_key_header, #format_scaling_info, #format_usage_message
Constructor Details
This class inherits a constructor from RHC::Commands::Base
Instance Method Details
#list(app) ⇒ Object
112 113 114 115 116 117 118 119 120 121 |
# File 'lib/rhc/commands/env.rb', line 112 def list(app) rest_app = find_app rest_env_vars = rest_app.environment_variables pager display_env_var_list(rest_env_vars, { :table => .table, :quotes => .quotes }) 0 end |
#set(env) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rhc/commands/env.rb', line 45 def set(env) rest_app = find_app with_file = env.index {|item| File.file? item} env_vars = [] env.each {|item| env_vars.concat(collect_env_vars(item))} raise RHC::EnvironmentVariableNotProvidedException.new( (with_file ? "Environment variable(s) not found in the provided file(s).\n" : "Environment variable(s) not provided.\n") << "Please provide at least one environment variable using the syntax VARIABLE=VALUE. VARIABLE can only contain letters, digits and underscore ('_') and can't begin with a digit.") if env_vars.empty? if with_file env_vars.each {|item| default_display_env_var(item.name, item.value)} confirm_action "Do you want to set these environment variables on '#{rest_app.name}?" end say 'Setting environment variable(s) ... ' rest_app.set_environment_variables(env_vars) success 'done' 0 end |
#show(env) ⇒ Object
129 130 131 132 133 134 135 136 137 138 |
# File 'lib/rhc/commands/env.rb', line 129 def show(env) rest_app = find_app rest_env_vars = rest_app.find_environment_variables(env) pager display_env_var_list(rest_env_vars, { :table => .table, :quotes => .quotes }) 0 end |
#unset(env) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/rhc/commands/env.rb', line 84 def unset(env) rest_app = find_app warn 'Removing environment variables is a destructive operation that may result in loss of data.' env.each do |e| default_display_env_var(e) end confirm_action "Are you sure you wish to remove the environment variable(s) above from application '#{rest_app.name}'?" say 'Removing environment variable(s) ... ' rest_app.unset_environment_variables(env) success 'removed' 0 end |