Class: RightScaleCLI::Configure

Inherits:
Thor
  • Object
show all
Defined in:
lib/rightscale_cli/configure.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Configure

Returns a new instance of Configure.



30
31
32
33
34
35
# File 'lib/rightscale_cli/configure.rb', line 30

def initialize(*args)
  super
  @logger = RightScaleCLI::Logger.new()
  @config = RightScaleCLI::Config.new
  @directives = @config.directives
end

Class Method Details

default_task :all



91
92
93
# File 'lib/rightscale_cli/configure.rb', line 91

def self.banner(task, namespace = true, subcommand = false)
  "#{basename} #{task.formatted_usage(self, true, subcommand)}"
end

Instance Method Details

#accountObject



44
45
46
47
# File 'lib/rightscale_cli/configure.rb', line 44

def ()
  @directives.merge!( { :account_id => ask("RightScale account ID (e.g. 1337):")})
  update_conf
end

#allObject



79
80
81
82
83
84
85
86
87
# File 'lib/rightscale_cli/configure.rb', line 79

def all()
  # currently this is the lazy way, each is written sequentially
  
  user
  password
  shard
  api
  puts 'Configuration saved.'
end

#apiObject



62
63
64
65
# File 'lib/rightscale_cli/configure.rb', line 62

def api()
  @directives.merge!( { :api_version => ask("RightScale API version (e.g. 1.5):") })
  update_conf
end

#passwordObject



56
57
58
59
# File 'lib/rightscale_cli/configure.rb', line 56

def password()
  @directives.merge!( { :password_base64 => Base64.encode64(ask_pass).strip })
  update_conf
end

#shardObject



68
69
70
71
# File 'lib/rightscale_cli/configure.rb', line 68

def shard()
  @directives.merge!( { :api_url => "https://#{ask("RightScale shard (e.g. us-4.rightscale.com):")}" })
  update_conf
end

#showObject



74
75
76
# File 'lib/rightscale_cli/configure.rb', line 74

def show()
  puts @directives
end

#userObject



50
51
52
53
# File 'lib/rightscale_cli/configure.rb', line 50

def user()
  @directives.merge!( { :email => ask("RightScale username (e.g. [email protected]):") })
  update_conf
end