Class: Rncher::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/rncher/cli.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rncher/cli.rb', line 15

def setup
  if !Credential.exists?
    Credential.set_credentials({})
  end
  content = Credential.load_credentials
  content[options[:name].to_sym] = {
    access_key: options[:access_key],
    secret_key: options[:secret_key],
    host: options[:host],
    env: options[:env]
  }
  content[:default] = {
    access_key: options[:access_key],
    secret_key: options[:secret_key],
    host: options[:host],
    env: options[:env]
  } if options[:default]==true
  Credential.set_credentials(content)
  puts 'Done!'
end

#switch(name) ⇒ Object



37
38
39
40
41
# File 'lib/rncher/cli.rb', line 37

def switch name
  content = Credential.load_credentials
  content[:default] = content[name]
  Credential.set_credentials(content)
end