blob: 670d6134b06e194b60258c8992efe1a38351bff9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#
# Ensure that the needed fog gems are installed
#
module LeapCli
class Cloud
SUPPORTED = {
'aws' => {require: 'fog/aws', gem: 'fog-aws'}
}.freeze
def self.check_dependencies!(config)
required_gem = map_api_to_gem(config['api'])
if required_gem.nil?
Util.bail! do
Util.log :error, "The API '#{config['api']}' specified in cloud.json is not one that I know how to speak. Try one of #{supported_list}."
end
end
begin
require required_gem[:require]
rescue LoadError
Util.bail! do
Util.log :error, "The 'vm' command requires the gem '#{required_gem[:gem]}'. Please run `gem install #{required_gem[:gem]}` and try again."
Util.log "(make sure you install the gem in the ruby #{RUBY_VERSION} environment)"
end
end
end
def self.supported_list
SUPPORTED.keys.join(', ')
end
def self.map_api_to_gem(api)
SUPPORTED[api]
end
end
end
|