2010-09-21 11:11:15 -07:00
|
|
|
class Bluebox < Fog::Bin
|
2010-05-24 10:29:01 -07:00
|
|
|
class << self
|
2010-05-24 11:03:52 -07:00
|
|
|
|
2010-12-06 19:49:58 -08:00
|
|
|
def class_for(key)
|
|
|
|
case key
|
|
|
|
when :blocks, :compute
|
|
|
|
Fog::Bluebox::Compute
|
|
|
|
else
|
|
|
|
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
2010-12-06 19:49:58 -08:00
|
|
|
end
|
2010-05-24 10:29:01 -07:00
|
|
|
|
2010-12-06 19:49:58 -08:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
2011-01-14 10:41:12 -08:00
|
|
|
hash[key] = case key
|
2011-01-12 17:55:24 -08:00
|
|
|
when :blocks
|
2010-12-06 19:49:58 -08:00
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] Bluebox[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
2011-01-14 10:51:41 -08:00
|
|
|
Fog::Compute.new(:provider => 'Bluebox')
|
2011-01-12 17:55:24 -08:00
|
|
|
when :compute
|
2011-01-14 10:51:41 -08:00
|
|
|
Fog::Compute.new(:provider => 'Bluebox')
|
2011-01-12 17:55:24 -08:00
|
|
|
else
|
|
|
|
raise ArgumentError, "Unrecognized service: #{service}"
|
2010-12-06 19:49:58 -08:00
|
|
|
end
|
2010-09-03 15:32:30 -07:00
|
|
|
end
|
2010-12-06 19:49:58 -08:00
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
|
|
|
def services
|
|
|
|
[:compute]
|
|
|
|
end
|
2010-09-03 15:32:30 -07:00
|
|
|
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
|
|
|
end
|