Class: RightScaleCLI::Configure
- Inherits:
-
Thor
- Object
- Thor
- RightScaleCLI::Configure
- Defined in:
- lib/rightscale_cli/configure.rb
Class Method Summary collapse
-
.banner(task, namespace = true, subcommand = false) ⇒ Object
default_task :all.
Instance Method Summary collapse
- #account ⇒ Object
- #all ⇒ Object
- #api ⇒ Object
-
#initialize(*args) ⇒ Configure
constructor
A new instance of Configure.
- #oauth ⇒ Object
- #password ⇒ Object
- #refresh ⇒ Object
- #shard ⇒ Object
- #show ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(*args) ⇒ Configure
Returns a new instance of Configure.
31 32 33 34 35 36 |
# File 'lib/rightscale_cli/configure.rb', line 31 def initialize(*args) super @logger = RightScaleCLI::Logger.new() @config = RightScaleCLI::Config.new @directives = @config.directives end |
Class Method Details
.banner(task, namespace = true, subcommand = false) ⇒ Object
default_task :all
114 115 116 |
# File 'lib/rightscale_cli/configure.rb', line 114 def self.(task, namespace = true, subcommand = false) "#{basename} #{task.formatted_usage(self, true, subcommand)}" end |
Instance Method Details
#account ⇒ Object
45 46 47 48 |
# File 'lib/rightscale_cli/configure.rb', line 45 def account() @directives.merge!( { :account_id => ask("RightScale account ID (e.g. 1337):")}) update_conf end |
#all ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/rightscale_cli/configure.rb', line 93 def all() # currently this is the lazy way, each is written sequentially account user password # do not ask for the api access token as we'll generate this from the refresh token # oauth refresh shard api puts 'Configuration saved.' if @directives[:refresh_token] puts 'Refresh API token now? (y/n):' if yesno system 'rs refresh token' end end end |
#api ⇒ Object
75 76 77 78 |
# File 'lib/rightscale_cli/configure.rb', line 75 def api() @directives.merge!( { :api_version => ask("RightScale API version (e.g. 1.5):") }) update_conf end |
#oauth ⇒ Object
63 64 65 66 |
# File 'lib/rightscale_cli/configure.rb', line 63 def oauth() @directives.merge!( { :access_token => ask("RightScale API access token:") }) update_conf end |
#password ⇒ Object
57 58 59 60 |
# File 'lib/rightscale_cli/configure.rb', line 57 def password() @directives.merge!( { :password_base64 => Base64.encode64(ask_pass).strip }) update_conf end |
#refresh ⇒ Object
69 70 71 72 |
# File 'lib/rightscale_cli/configure.rb', line 69 def refresh() @directives.merge!( { :refresh_token => ask('RightScale API refresh token:') }) update_conf end |
#shard ⇒ Object
81 82 83 84 85 |
# File 'lib/rightscale_cli/configure.rb', line 81 def shard() shard = ask("RightScale shard (e.g. us-4.rightscale.com):") @directives.merge!( { :api_url => "https://#{shard}", :token_endpoint => "https://#{shard}/api/oauth2" }) update_conf end |
#show ⇒ Object
88 89 90 |
# File 'lib/rightscale_cli/configure.rb', line 88 def show() puts @directives end |
#user ⇒ Object
51 52 53 54 |
# File 'lib/rightscale_cli/configure.rb', line 51 def user() @directives.merge!( { :email => ask("RightScale username (e.g. [email protected]):") }) update_conf end |