2010-09-29 13:22:30 -07:00
|
|
|
require 'fog/core/credentials'
|
2010-06-23 17:22:44 -07:00
|
|
|
|
2010-02-11 21:41:37 -08:00
|
|
|
module Fog
|
|
|
|
class << self
|
|
|
|
|
2010-09-21 11:11:15 -07:00
|
|
|
def providers
|
2010-09-03 15:32:30 -07:00
|
|
|
[
|
|
|
|
::AWS,
|
2010-09-14 10:40:02 -07:00
|
|
|
::Bluebox,
|
2010-11-08 12:21:31 +00:00
|
|
|
::Brightbox,
|
2010-09-03 15:32:30 -07:00
|
|
|
::GoGrid,
|
2010-09-18 13:40:48 -04:00
|
|
|
::Google,
|
2010-09-03 15:32:30 -07:00
|
|
|
::Linode,
|
|
|
|
::Local,
|
|
|
|
::NewServers,
|
|
|
|
::Rackspace,
|
|
|
|
::Slicehost,
|
2010-12-15 14:56:46 -08:00
|
|
|
::Terremark,
|
2011-01-08 23:53:54 -04:00
|
|
|
::TerremarkEcloud,
|
2010-12-15 14:56:46 -08:00
|
|
|
::Zerigo
|
2010-09-21 11:11:15 -07:00
|
|
|
].select {|provider| provider.available?}
|
|
|
|
end
|
|
|
|
|
|
|
|
def modules
|
|
|
|
[
|
2010-09-14 10:40:02 -07:00
|
|
|
::Vcloud
|
2010-09-03 15:32:30 -07:00
|
|
|
].select {|_module_| _module_.initialized?}
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
|
|
|
|
class Bin
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def available?
|
|
|
|
availability = true
|
|
|
|
for service in services
|
|
|
|
begin
|
2010-12-06 19:49:58 -08:00
|
|
|
service = self.class_for(service)
|
|
|
|
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
|
|
|
|
rescue ArgumentError => e
|
|
|
|
warning = "[yellow][WARN] #{e.message}[/]"
|
|
|
|
Formatador.display_line(warning)
|
|
|
|
availability = false
|
|
|
|
rescue => e
|
2010-09-21 11:11:15 -07:00
|
|
|
availability = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if availability
|
|
|
|
for service in services
|
2010-12-06 19:49:58 -08:00
|
|
|
for collection in self.class_for(service).collections
|
2010-09-21 15:57:27 -07:00
|
|
|
unless self.respond_to?(collection)
|
|
|
|
self.class_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def self.#{collection}
|
|
|
|
self[:#{service}].#{collection}
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
end
|
2010-09-21 11:11:15 -07: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 00:29:42 -07:00
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
|
2011-01-07 15:41:51 -08:00
|
|
|
require 'fog/bin/aws'
|
|
|
|
require 'fog/bin/bluebox'
|
|
|
|
require 'fog/bin/brightbox'
|
|
|
|
require 'fog/bin/go_grid'
|
|
|
|
require 'fog/bin/google'
|
|
|
|
require 'fog/bin/linode'
|
|
|
|
require 'fog/bin/local'
|
|
|
|
require 'fog/bin/new_servers'
|
|
|
|
require 'fog/bin/rackspace'
|
|
|
|
require 'fog/bin/slicehost'
|
|
|
|
require 'fog/bin/terremark'
|
2011-01-08 23:53:54 -04:00
|
|
|
require 'fog/bin/terremark_ecloud'
|
2011-01-07 15:41:51 -08:00
|
|
|
require 'fog/bin/vcloud'
|
|
|
|
require 'fog/bin/zerigo'
|