Class: Befog::Commands::Configure

Inherits:
Object
  • Object
show all
Includes:
Mixins::Command, Mixins::Configurable, Mixins::Help, Mixins::Safely, Mixins::Scope
Defined in:
lib/befog/commands/configure.rb

Instance Attribute Summary

Attributes included from Mixins::Command

#options

Instance Method Summary collapse

Methods included from Mixins::Help

included

Methods included from Mixins::Safely

#safely

Methods included from Mixins::Scope

#_bank, #account_key, #account_secret, #bank, #bank?, #bank_name, #banks, #compute, #flavor, #flavor?, #get_server, #image, #image?, #keypair, #keypair?, #price, #provider, #provider?, #provider_name, #providers, #region, #region?, #security_group, #security_group?, #servers, #servers=

Methods included from Mixins::Configurable

#_configuration, #configuration, #configuration_name, #configuration_path, included, #save

Methods included from Mixins::Command

#command, #error, included, #initialize, #log, #process_options, #usage

Instance Method Details

#runObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/befog/commands/configure.rb', line 59

def run
  safely do
    %w( key secret ).each do |key|
      _key = key.to_sym
      provider[key] = options[_key] if options[_key]
    end
    %w( region image keypair group type price ).each do |key|
      _key = key.to_sym
      bank[key] = options[_key] if options[_key]
    end          
    if options[:bank] and options[:provider]
      bank["provider"] = options[:provider]
    end
    save
  end
end