2010-02-11 21:41:37 -08:00
|
|
|
module Slicehost
|
|
|
|
class << self
|
|
|
|
if Fog.credentials[:slicehost_password]
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
|
|
|
when :slices
|
2010-09-02 13:39:01 -07:00
|
|
|
Fog::Slicehost.new
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
2010-09-02 16:01:19 -07:00
|
|
|
for collection in Fog::Slicehost.collections
|
|
|
|
module_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def #{collection}
|
|
|
|
self[:slices].#{collection}
|
|
|
|
end
|
|
|
|
EOS
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|