Class: Dployr::Commands::Base
- Inherits:
-
Object
- Object
- Dployr::Commands::Base
- Includes:
- Utils
- Defined in:
- lib/dployr/commands/base.rb
Direct Known Subclasses
Config, Execute, Info, ProvisionTest, Ssh, Start, StopDestroy
Instance Method Summary collapse
- #create ⇒ Object
- #create_compute_client ⇒ Object
- #get_region_config(options) ⇒ Object
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
Methods included from Utils
parse_attributes, parse_flags, parse_matrix
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dployr/commands/base.rb', line 14 def initialize() @options = @name = [:name] @log = Logger.new STDOUT @attrs = parse_attributes @options[:attributes] @options[:public_ip] = false if ![:public_ip] @provider = [:provider].upcase if [:provider] create get_config end |
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/dployr/commands/base.rb', line 25 def create begin @dployr = Dployr::Init.new @attrs @dployr.load_config @options[:file] rescue => e raise "Cannot load the config: #{e}" end end |
#create_compute_client ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/dployr/commands/base.rb', line 34 def create_compute_client begin Dployr::Compute.const_get(@provider.to_sym).new @regions rescue => e raise "Provider '#{@provider}' is not supported: #{e}" end end |
#get_region_config(options) ⇒ Object
42 43 44 |
# File 'lib/dployr/commands/base.rb', line 42 def get_region_config() @dployr.config.get_region [:name], [:provider], [:region] end |