Class: Dployr::Commands::Base
- Inherits:
-
Object
- Object
- Dployr::Commands::Base
show all
- Includes:
- Utils
- Defined in:
- lib/dployr/commands/base.rb
Instance Method Summary
collapse
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)
@options = options
@name = options[:name]
@log = Logger.new STDOUT
@attrs = parse_attributes @options[:attributes]
@options[:public_ip] = false if !options[:public_ip]
@provider = options[:provider].upcase if options[: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_config ⇒ Object
42
43
44
45
|
# File 'lib/dployr/commands/base.rb', line 42
def get_config
@config = get_region_config @options
@p_attrs = @config[:attributes]
end
|
#get_region_config(options) ⇒ Object
47
48
49
|
# File 'lib/dployr/commands/base.rb', line 47
def get_region_config(options)
@dployr.config.get_region options[:name], options[:provider], options[:region]
end
|