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

[misc] provide #providers for shared services

This commit is contained in:
geemus 2011-07-27 09:30:49 -05:00
parent 368ce6ab0f
commit 87b07ba117
6 changed files with 27 additions and 4 deletions

View file

@ -19,5 +19,9 @@ module Fog
end end
end end
def self.providers
Fog.services[:cdn]
end
end end
end end

View file

@ -55,9 +55,13 @@ module Fog
end end
end end
def self.providers
Fog.services[:compute]
end
def self.servers def self.servers
servers = [] servers = []
for provider in [:aws, :bluebox, :brightbox, :ecloud, :gogrid, :linode, :newservers, :ninefold, :rackspace, :slicehost, :stormondemand, :virtualbox, :voxel] for provider in self.providers
begin begin
servers.concat(self[provider].servers) servers.concat(self[provider].servers)
rescue # ignore any missing credentials/etc rescue # ignore any missing credentials/etc

View file

@ -6,7 +6,9 @@ module Fog
end end
def service(new_service, path) def service(new_service, path)
services << new_service Fog.services[new_service] ||= []
Fog.services[new_service] << self.to_s.split('::').last.downcase.to_sym
self.services << new_service
require File.join('fog', path) require File.join('fog', path)
end end

View file

@ -1,4 +1,9 @@
module Fog module Fog
def self.services
@services ||= {}
end
class Service class Service
class Error < Fog::Errors::Error; end class Error < Fog::Errors::Error; end

View file

@ -34,9 +34,13 @@ module Fog
end end
end end
def self.providers
Fog.services[:dns]
end
def self.zones def self.zones
zones = [] zones = []
for provider in [:aws, :bluebox, :dnsimple, :dnsmadeeasy, :linode, :slicehost, :zerigo] for provider in self.providers
begin begin
zones.concat(self[provider].zones) zones.concat(self[provider].zones)
rescue # ignore any missing credentials/etc rescue # ignore any missing credentials/etc

View file

@ -30,7 +30,7 @@ module Fog
def self.directories def self.directories
directories = [] directories = []
for provider in [:aws, :google, :local, :ninefold, :rackspace] for provider in self.providers
begin begin
directories.concat(self[provider].directories) directories.concat(self[provider].directories)
rescue # ignore any missing credentials/etc rescue # ignore any missing credentials/etc
@ -73,5 +73,9 @@ module Fog
metadata metadata
end end
def self.providers
Fog.services[:storage]
end
end end
end end