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