Top Level Namespace

Defined Under Namespace

Modules: ApplicationHelper, CloudCLI, CloudClient, ConversionHelper, Deltacloud, HardwareProfilesHelper, MethodSerializer, Mock, OCCIClient, Rack, RightAws, Sinatra Classes: BaseModel, GoGridClient, Image, Instance, InstanceProfile, Key, Realm, StorageSnapshot, StorageVolume, String

Constant Summary collapse

DRIVERS =
{
  :ec2 => { :name => "EC2" },
  :rackspace => { :name => "Rackspace" },
  :gogrid => { :name => "Gogrid" },
  :rhevm => { :name => "RHEVM" },
  :rimuhosting => { :name => "RimuHosting"},
  :opennebula => { :name => "Opennebula", :class => "OpennebulaDriver" },
  :terremark => { :name => "Terremark"},
  :mock => { :name => "Mock" }
}
DEFAULT_COLLECTIONS =
[
  :hardware_profiles,
  :images,
  :instances,
  :instance_states,
  :realms,
  :storage_volumes,
  :storage_snapshots
]
DRIVER =
ENV['API_DRIVER'] ? ENV['API_DRIVER'].to_sym : :mock

Instance Method Summary collapse

Instance Method Details

#driverObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/drivers.rb', line 41

def driver
  require driver_source_name
  #require 'deltacloud/base_driver/mock_driver.rb'

  if Sinatra::Application.environment.eql? :test
    require driver_mock_source_name if driver_mock_source_name
  end

  @driver ||= eval( driver_class_name ).new
end

#driver_class_nameObject



28
29
30
31
# File 'lib/drivers.rb', line 28

def driver_class_name
  basename = DRIVERS[DRIVER][:class] || "#{driver_name}Driver"
  "Deltacloud::Drivers::#{driver_name}::#{basename}"
end

#driver_mock_source_nameObject



37
38
39
# File 'lib/drivers.rb', line 37

def driver_mock_source_name
  return File.join('deltacloud', 'drivers', DRIVER.to_s, "#{DRIVER}_driver.rb") if driver_name.eql? 'Mock'
end

#driver_nameObject



24
25
26
# File 'lib/drivers.rb', line 24

def driver_name
  DRIVERS[DRIVER][:name]
end

#driver_source_nameObject



33
34
35
# File 'lib/drivers.rb', line 33

def driver_source_name
  File.join("deltacloud", "drivers", "#{DRIVER}", "#{DRIVER}_driver.rb")
end