2010-09-29 16:22:30 -04:00
|
|
|
require 'fog/core/credentials'
|
2010-06-23 20:22:44 -04:00
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
module Fog
|
|
|
|
class << self
|
|
|
|
|
2011-05-24 20:31:05 -04:00
|
|
|
def available_providers
|
|
|
|
@providers.select {|provider| Kernel.const_get(provider).available?}
|
2011-02-09 19:39:37 -05:00
|
|
|
end
|
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
|
|
|
class Bin
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def available?
|
|
|
|
availability = true
|
|
|
|
for service in services
|
|
|
|
begin
|
2010-12-06 22:49:58 -05: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 14:11:15 -04:00
|
|
|
availability = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if availability
|
|
|
|
for service in services
|
2010-12-06 22:49:58 -05:00
|
|
|
for collection in self.class_for(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
|
|
|
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/aws'
|
|
|
|
require 'fog/bin/bluebox'
|
|
|
|
require 'fog/bin/brightbox'
|
2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/bin/dnsimple'
|
2011-05-29 19:41:27 -04:00
|
|
|
require 'fog/bin/dnsmadeeasy'
|
2011-02-17 13:44:46 -05:00
|
|
|
require 'fog/bin/ecloud'
|
2011-01-07 18:41:51 -05:00
|
|
|
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'
|
2011-04-27 21:49:56 -04:00
|
|
|
require 'fog/bin/stormondemand'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/terremark'
|
2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/bin/virtual_box'
|
2011-01-19 15:47:35 -05:00
|
|
|
require 'fog/bin/voxel'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/zerigo'
|