2010-06-23 20:22:44 -04:00
|
|
|
require 'fog/credentials'
|
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
module Fog
|
|
|
|
class << self
|
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def providers
|
2010-09-03 18:32:30 -04:00
|
|
|
[
|
|
|
|
::AWS,
|
2010-09-14 13:40:02 -04:00
|
|
|
::Bluebox,
|
2010-09-03 18:32:30 -04:00
|
|
|
::GoGrid,
|
2010-09-18 13:40:48 -04:00
|
|
|
::Google,
|
2010-09-03 18:32:30 -04:00
|
|
|
::Linode,
|
|
|
|
::Local,
|
|
|
|
::NewServers,
|
|
|
|
::Rackspace,
|
|
|
|
::Slicehost,
|
2010-09-21 14:11:15 -04:00
|
|
|
::Terremark
|
|
|
|
].select {|provider| provider.available?}
|
|
|
|
end
|
|
|
|
|
|
|
|
def modules
|
|
|
|
[
|
2010-09-14 13:40:02 -04:00
|
|
|
::Vcloud
|
2010-09-03 18:32:30 -04:00
|
|
|
].select {|_module_| _module_.initialized?}
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
|
|
|
class Bin
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def available?
|
|
|
|
availability = true
|
|
|
|
for service in services
|
|
|
|
begin
|
|
|
|
service = eval(self[service].class.to_s.split('::')[0...-1].join('::'))
|
|
|
|
availability &&= service.requirements.all? {|requirement| Fog.credentials.include?(requirement)}
|
|
|
|
rescue
|
|
|
|
availability = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if availability
|
|
|
|
for service in services
|
|
|
|
for collection in self[service].collections
|
2010-09-21 18:57:27 -04:00
|
|
|
unless self.respond_to?(collection)
|
|
|
|
self.class_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def self.#{collection}
|
|
|
|
self[:#{service}].#{collection}
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
availability
|
|
|
|
end
|
|
|
|
|
|
|
|
def collections
|
|
|
|
services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-04-03 03:29:42 -04:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
|
|
|
require 'fog/aws/bin'
|
|
|
|
require 'fog/bluebox/bin'
|
|
|
|
require 'fog/go_grid/bin'
|
2010-09-18 13:40:48 -04:00
|
|
|
require 'fog/google/bin'
|
2010-09-21 14:11:15 -04:00
|
|
|
require 'fog/linode/bin'
|
|
|
|
require 'fog/local/bin'
|
|
|
|
require 'fog/new_servers/bin'
|
|
|
|
require 'fog/rackspace/bin'
|
|
|
|
require 'fog/slicehost/bin'
|
|
|
|
require 'fog/terremark/bin'
|
|
|
|
require 'fog/vcloud/bin'
|