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/virtual_box/compute.rb
geemus b2c8ff0388 [core] work toward separate requires
Should facilitate the following:

    require 'fog/aws'
    require 'fog/compute'
    require 'fog/aws/compute'

I think once you `require 'rubygems'` those should work.

further cleanup should reduce common requires (ie nokogiri)
2011-08-31 15:52:53 -05:00

49 lines
1.1 KiB
Ruby

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'virtual_box'))
require 'fog/compute'
module Fog
module Compute
class VirtualBox < Fog::Service
model_path 'fog/virtual_box/models/compute'
model :medium
collection :mediums
model :medium_format
model :nat_engine
model :nat_redirect
collection :nat_redirects
model :network_adapter
collection :network_adapters
model :server
collection :servers
model :storage_controller
collection :storage_controllers
class Mock
def initialize(options={})
Fog::Mock.not_implemented
end
end
class Real
def initialize(options={})
require 'virtualbox'
@connection = ::VirtualBox::Global.global.lib.virtualbox
end
# hack to provide 'requests'
def method_missing(method_sym, *arguments, &block)
if @connection.respond_to?(method_sym)
@connection.send(method_sym, *arguments)
else
super
end
end
end
end
end
end