2009-10-21 21:49:17 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'base64'
|
|
|
|
require 'cgi'
|
|
|
|
require 'digest/md5'
|
2009-11-16 22:31:17 +00:00
|
|
|
require 'excon'
|
2010-02-14 22:34:33 +00:00
|
|
|
require 'formatador'
|
2009-10-21 21:49:17 +00:00
|
|
|
require 'json'
|
|
|
|
require 'mime/types'
|
2010-04-15 03:32:56 +00:00
|
|
|
require 'net/ssh'
|
2009-11-03 02:47:24 +00:00
|
|
|
require 'nokogiri'
|
|
|
|
require 'time'
|
2009-10-21 21:49:17 +00:00
|
|
|
|
2009-09-14 04:24:22 +00:00
|
|
|
__DIR__ = File.dirname(__FILE__)
|
|
|
|
|
|
|
|
$LOAD_PATH.unshift __DIR__ unless
|
|
|
|
$LOAD_PATH.include?(__DIR__) ||
|
|
|
|
$LOAD_PATH.include?(File.expand_path(__DIR__))
|
|
|
|
|
2010-06-07 15:59:17 +00:00
|
|
|
require 'fog/attributes'
|
2010-03-26 18:15:27 +00:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/connection'
|
2010-04-23 22:20:37 +00:00
|
|
|
require 'fog/deprecation'
|
2010-06-11 02:04:06 +00:00
|
|
|
require 'fog/errors'
|
2010-06-16 04:04:16 +00:00
|
|
|
require 'fog/hmac'
|
2010-03-26 18:15:27 +00:00
|
|
|
require 'fog/model'
|
|
|
|
require 'fog/parser'
|
2010-06-12 18:13:49 +00:00
|
|
|
require 'fog/service'
|
2010-04-15 03:32:56 +00:00
|
|
|
require 'fog/ssh'
|
2010-05-02 05:10:11 +00:00
|
|
|
|
2010-03-26 18:15:27 +00:00
|
|
|
require 'fog/aws'
|
2010-06-02 04:40:46 +00:00
|
|
|
require 'fog/bluebox'
|
2010-05-02 05:10:11 +00:00
|
|
|
require 'fog/local'
|
2010-03-26 18:15:27 +00:00
|
|
|
require 'fog/rackspace'
|
|
|
|
require 'fog/slicehost'
|
|
|
|
require 'fog/terremark'
|
2010-05-03 04:46:43 +00:00
|
|
|
require 'fog/vcloud'
|
2010-03-26 18:15:27 +00:00
|
|
|
|
2009-08-07 07:28:53 +00:00
|
|
|
module Fog
|
|
|
|
|
2010-05-04 00:25:59 +00:00
|
|
|
unless const_defined?(:VERSION)
|
2010-06-18 21:27:16 +00:00
|
|
|
VERSION = '0.1.10'
|
2010-04-30 06:30:49 +00:00
|
|
|
end
|
2010-04-21 03:23:24 +00:00
|
|
|
|
2010-04-08 22:39:25 +00:00
|
|
|
module Mock
|
2010-04-13 20:53:50 +00:00
|
|
|
@delay = 1
|
|
|
|
def self.delay
|
|
|
|
@delay
|
|
|
|
end
|
|
|
|
|
2010-04-13 21:06:12 +00:00
|
|
|
def self.delay=(new_delay)
|
|
|
|
raise ArgumentError, "delay must be non-negative" unless new_delay >= 0
|
|
|
|
@delay = new_delay
|
2010-04-13 20:53:50 +00:00
|
|
|
end
|
2010-05-27 00:38:23 +00:00
|
|
|
|
|
|
|
def self.not_implemented
|
|
|
|
raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
|
|
|
|
end
|
|
|
|
|
2010-04-08 22:39:25 +00:00
|
|
|
end
|
|
|
|
|
2009-09-15 04:14:34 +00:00
|
|
|
def self.mock!
|
|
|
|
@mocking = true
|
2009-08-10 15:30:28 +00:00
|
|
|
end
|
|
|
|
|
2009-08-07 07:28:53 +00:00
|
|
|
def self.mocking?
|
2009-08-10 15:30:28 +00:00
|
|
|
!!@mocking
|
|
|
|
end
|
|
|
|
|
2010-05-01 22:08:44 +00:00
|
|
|
def self.wait_for(timeout = 600, &block)
|
|
|
|
duration = 0
|
|
|
|
start = Time.now
|
|
|
|
until yield || duration > timeout
|
|
|
|
sleep(1)
|
|
|
|
duration = Time.now - start
|
|
|
|
end
|
|
|
|
if duration > timeout
|
|
|
|
false
|
|
|
|
else
|
|
|
|
{ :duration => duration }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-08-07 07:28:53 +00:00
|
|
|
end
|