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