2009-10-21 14:49:17 -07:00
|
|
|
require 'rubygems'
|
|
|
|
require 'base64'
|
|
|
|
require 'cgi'
|
2009-11-16 14:31:17 -08:00
|
|
|
require 'excon'
|
2010-02-14 14:34:33 -08:00
|
|
|
require 'formatador'
|
2009-11-02 18:47:24 -08:00
|
|
|
require 'time'
|
2010-12-06 19:58:02 -08:00
|
|
|
require 'named-parameters'
|
2009-10-21 14:49:17 -07:00
|
|
|
|
2009-09-13 21:24:22 -07:00
|
|
|
__DIR__ = File.dirname(__FILE__)
|
|
|
|
|
|
|
|
$LOAD_PATH.unshift __DIR__ unless
|
|
|
|
$LOAD_PATH.include?(__DIR__) ||
|
|
|
|
$LOAD_PATH.include?(File.expand_path(__DIR__))
|
|
|
|
|
2010-09-29 13:22:30 -07:00
|
|
|
require 'fog/core'
|
2010-05-01 22:10:11 -07:00
|
|
|
|
2009-08-07 00:28:53 -07:00
|
|
|
module Fog
|
|
|
|
|
2010-10-12 16:22:12 -07:00
|
|
|
@mocking = false
|
|
|
|
|
2010-05-03 17:25:59 -07:00
|
|
|
unless const_defined?(:VERSION)
|
2010-12-10 13:26:43 -08:00
|
|
|
VERSION = '0.3.31'
|
2010-04-29 23:30:49 -07:00
|
|
|
end
|
2010-04-20 20:23:24 -07:00
|
|
|
|
2010-04-08 15:39:25 -07:00
|
|
|
module Mock
|
2010-04-14 04:53:50 +08:00
|
|
|
@delay = 1
|
|
|
|
def self.delay
|
|
|
|
@delay
|
|
|
|
end
|
|
|
|
|
2010-04-13 14:06:12 -07:00
|
|
|
def self.delay=(new_delay)
|
|
|
|
raise ArgumentError, "delay must be non-negative" unless new_delay >= 0
|
|
|
|
@delay = new_delay
|
2010-04-14 04:53:50 +08:00
|
|
|
end
|
2010-05-26 17:38:23 -07:00
|
|
|
|
|
|
|
def self.not_implemented
|
|
|
|
raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
|
|
|
|
end
|
|
|
|
|
2010-04-08 15:39:25 -07:00
|
|
|
end
|
|
|
|
|
2010-09-02 13:39:01 -07:00
|
|
|
def self.bin
|
|
|
|
@bin ||= false
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.bin=(new_bin)
|
|
|
|
@bin = new_bin
|
|
|
|
end
|
|
|
|
|
2009-09-14 21:14:34 -07:00
|
|
|
def self.mock!
|
|
|
|
@mocking = true
|
2009-08-10 08:30:28 -07:00
|
|
|
end
|
|
|
|
|
2009-08-07 00:28:53 -07:00
|
|
|
def self.mocking?
|
2009-08-10 08:30:28 -07:00
|
|
|
!!@mocking
|
|
|
|
end
|
|
|
|
|
2010-07-21 19:18:34 -07:00
|
|
|
def self.wait_for(timeout=600, interval=1, &block)
|
2010-05-01 15:08:44 -07:00
|
|
|
duration = 0
|
|
|
|
start = Time.now
|
|
|
|
until yield || duration > timeout
|
2010-07-21 19:18:34 -07:00
|
|
|
sleep(interval)
|
2010-05-01 15:08:44 -07:00
|
|
|
duration = Time.now - start
|
|
|
|
end
|
|
|
|
if duration > timeout
|
|
|
|
false
|
|
|
|
else
|
|
|
|
{ :duration => duration }
|
|
|
|
end
|
|
|
|
end
|
2010-11-09 17:57:34 -08:00
|
|
|
|
2009-08-07 00:28:53 -07:00
|
|
|
end
|
2010-09-03 01:11:45 -07:00
|
|
|
|
|
|
|
require 'fog/aws'
|
|
|
|
require 'fog/bluebox'
|
2010-11-08 12:21:31 +00:00
|
|
|
require 'fog/brightbox'
|
2010-09-03 01:11:45 -07:00
|
|
|
require 'fog/go_grid'
|
|
|
|
require 'fog/linode'
|
|
|
|
require 'fog/local'
|
|
|
|
require 'fog/new_servers'
|
|
|
|
require 'fog/rackspace'
|
|
|
|
require 'fog/slicehost'
|
|
|
|
require 'fog/terremark'
|
|
|
|
require 'fog/vcloud'
|
2010-12-11 20:01:33 -05:00
|
|
|
require 'fog/zerigo'
|
2010-09-18 13:40:48 -04:00
|
|
|
require 'fog/google'
|