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/vcloud/extension.rb
freeformz 30446e5ac1 Servicify & Hashify & more requests
Many changes:

-Become more of a proper Fog Service.
-Drop most of the Collection/Model customizations.
-Add a hook for services to do something after #new with the instance
-Move to the ToHashDocument parser ... so no more having to actually
make parsers.
-Fog::Vcloud::Extension is kind of like Fog::Service, but for writing
extension modules to Fog::Vcloud.
-Fix up existing specs/mocks (they're not complete atm, but the existing
ones are up to date).
-Fog::Vcloud::Terremark::Ecloud gets almost all extensions implemented
(almost).
-Fog::Vcloud::Terremark::Ecloud bumped to working with the current TMRK
API release.
-Factor out some TMRK/ecloud specifc mock data into the ecloud module.
-Probably forgetting something.
2010-06-28 02:10:27 +08:00

44 lines
1 KiB
Ruby

module Fog
module Vcloud
module Extension
include Fog::Service
@versions = []
def self.extended(other)
other.module_eval <<-EOS,__FILE__,__LINE__
module #{other}::Real
extend Fog::Vcloud::Generators
end
module #{other}::Mock
end
module #{other}::Versions
SUPPORTED = @versions
end
def self.extended(klass)
unless @required
models.each do |model|
require File.join(@model_path, model.to_s)
end
requests.each do |request|
require File.join(@request_path, request.to_s)
end
@required = true
end
if Fog.mocking?
klass.extend #{other}::Real
klass.extend #{other}::Mock
else
klass.extend #{other}::Real
end
end
EOS
end
def versions(*args)
@versions = args
end
end
end
end