2010-05-24 17:29:01 +00:00
|
|
|
module Bluebox
|
|
|
|
class << self
|
2010-05-24 18:03:52 +00:00
|
|
|
|
2010-05-24 17:29:01 +00:00
|
|
|
if Fog.credentials[:bluebox_api_key]
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
2010-09-08 21:00:43 +00:00
|
|
|
when :blocks
|
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] Bluebox[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
|
|
|
Fog::Bluebox::Compute.new
|
2010-09-08 19:07:45 +00:00
|
|
|
when :compute
|
|
|
|
Fog::Bluebox::Compute.new
|
2010-05-24 17:29:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
2010-09-03 22:32:30 +00:00
|
|
|
def services
|
2010-09-08 19:07:45 +00:00
|
|
|
[:compute]
|
2010-09-03 22:32:30 +00:00
|
|
|
end
|
|
|
|
|
2010-09-08 19:07:45 +00:00
|
|
|
for collection in Fog::Bluebox::Compute.collections
|
2010-09-02 23:01:19 +00:00
|
|
|
module_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def #{collection}
|
2010-09-08 19:07:45 +00:00
|
|
|
self[:compute].#{collection}
|
2010-09-02 23:01:19 +00:00
|
|
|
end
|
|
|
|
EOS
|
2010-05-24 17:29:01 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|