Class: StackFu::Commands::ConfigCommand

Inherits:
Command
  • Object
show all
Includes:
ApiHooks, ProvidersCredentials
Defined in:
lib/stackfu/commands/config_command.rb

Constant Summary

Constants included from Rendering

Rendering::LEFT_MARGIN

Constants included from OperatingSystems

OperatingSystems::FriendlyNames, OperatingSystems::OperatingSystems

Instance Attribute Summary

Attributes inherited from Command

#errors, #options, #parameters, #subcommand

Instance Method Summary collapse

Methods included from ProvidersCredentials

#add_slicehost_credentials, #add_webbynode_credentials

Methods included from ApiHooks

#initialize_api

Methods inherited from Command

#command, command_for, create, inherited, #initialize, #params?, #run, #valid?

Methods included from Rendering

#done, #error, #fill_values_from_options, #menu_for, #render_target, #spinner, #table, #warning

Methods included from OperatingSystems

#convert_os, #os_name

Constructor Details

This class inherits a constructor from StackFu::Commands::Command

Instance Method Details

#default(parameters, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/stackfu/commands/config_command.rb', line 6

def default(parameters, options)
  while true
     = options[:login] || ask("StackFu Login: ")
    token = options[:token] || ask("StackFu Token: ")
  
    break if options[:login] and options[:token]
    
    puts ""
    break if agree("Is this information correct? ", true)
    puts ""
    puts "OK, let's try it again"
    puts ""
  end

  puts ""
  puts "Configuration saved to #{ENV['HOME']}/.stackfu"
  save_config(, token)
end

#slicehost(parameters, options) ⇒ Object



30
31
32
33
# File 'lib/stackfu/commands/config_command.rb', line 30

def slicehost(parameters, options)
  user = spinner { User.find(:all).first }
  add_slicehost_credentials(user)
end

#webbynode(parameters, options) ⇒ Object



25
26
27
28
# File 'lib/stackfu/commands/config_command.rb', line 25

def webbynode(parameters, options)
  user = spinner { User.find(:all).first }
  add_webbynode_credentials(user)
end