Class: Fog::Bin

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/bin.rb

Direct Known Subclasses

AWS, Atmos, BareMetalCloud, Bluebox, Brightbox, Clodo, CloudSigma, Cloudstack, DNSMadeEasy, DNSimple, DigitalOcean, Dreamhost, Dynect, Ecloud, Fogdocker, Glesys, GoGrid, HP, IBM, InternetArchive, Joyent, Linode, Local, Ninefold, OpenStack, Openvz, Ovirt, Rackspace, Rage4, RiakCS, Serverlove, Softlayer, StormOnDemand, Terremark, Vcloud, VcloudDirector, Voxel, Vsphere, XenServer, Zerigo

Class Method Summary (collapse)

Class Method Details

+ (Boolean) available?

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/bin.rb', line 16

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
        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

+ (Object) collections



47
48
49
# File 'lib/fog/bin.rb', line 47

def collections
  services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
end