1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/bin.rb

99 lines
2.4 KiB
Ruby
Raw Normal View History

require 'fog/core/credentials'
2010-06-23 20:22:44 -04:00
module Fog
class << self
def available_providers
Kernel.const_get('Ninefold')
@available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort
end
def registered_providers
@registered_providers ||= Fog.providers.values.sort
end
end
class Bin
class << self
def available?
availability = true
for service in services
begin
service = self.class_for(service)
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
rescue ArgumentError => e
Fog::Logger.warning(e.message)
availability = false
rescue => e
availability = false
end
end
if availability
for service in services
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
end
end
end
availability
end
def collections
services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
end
end
end
end
require 'fog/bin/atmos'
2011-01-07 18:41:51 -05:00
require 'fog/bin/aws'
require 'fog/bin/bluebox'
require 'fog/bin/brightbox'
require 'fog/bin/cloudstack'
2011-09-30 17:46:05 -04:00
require 'fog/bin/clodo'
require 'fog/bin/digitalocean'
require 'fog/bin/dnsimple'
require 'fog/bin/dnsmadeeasy'
2012-03-10 17:02:28 -05:00
require 'fog/bin/dreamhost'
require 'fog/bin/dynect'
require 'fog/bin/ecloud'
require 'fog/bin/glesys'
2011-01-07 18:41:51 -05:00
require 'fog/bin/go_grid'
require 'fog/bin/google'
require 'fog/bin/hp'
2011-12-02 13:27:44 -05:00
require 'fog/bin/ibm'
require 'fog/bin/internet_archive'
require 'fog/bin/joyent'
require 'fog/bin/libvirt'
2011-01-07 18:41:51 -05:00
require 'fog/bin/linode'
require 'fog/bin/local'
require 'fog/bin/bare_metal_cloud'
require 'fog/bin/ninefold'
2011-01-07 18:41:51 -05:00
require 'fog/bin/rackspace'
2012-03-28 17:34:50 -04:00
require 'fog/bin/riakcs'
require 'fog/bin/openstack'
require 'fog/bin/ovirt'
require 'fog/bin/serverlove'
require 'fog/bin/stormondemand'
2011-01-07 18:41:51 -05:00
require 'fog/bin/terremark'
require 'fog/bin/vcloud'
require 'fog/bin/vmfusion'
require 'fog/bin/vsphere'
require 'fog/bin/voxel'
2012-04-02 07:25:03 -04:00
require 'fog/bin/xenserver'
2011-01-07 18:41:51 -05:00
require 'fog/bin/zerigo'
require 'fog/bin/cloudsigma'
2013-05-27 13:26:47 -04:00
require 'fog/bin/openvz'