2009-10-21 14:49:17 -07:00
|
|
|
require 'rubygems'
|
|
|
|
require 'base64'
|
|
|
|
require 'cgi'
|
|
|
|
require 'digest/md5'
|
2009-11-16 14:31:17 -08:00
|
|
|
require 'excon'
|
2010-02-14 14:34:33 -08:00
|
|
|
require 'formatador'
|
2009-10-21 14:49:17 -07:00
|
|
|
require 'hmac-sha1'
|
|
|
|
require 'hmac-sha2'
|
|
|
|
require 'json'
|
|
|
|
require 'mime/types'
|
2010-04-14 20:32:56 -07:00
|
|
|
require 'net/ssh'
|
2009-11-02 18:47:24 -08:00
|
|
|
require 'nokogiri'
|
|
|
|
require 'time'
|
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-06-07 08:59:17 -07:00
|
|
|
require 'fog/attributes'
|
2010-03-26 11:15:27 -07:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/connection'
|
2010-04-23 15:20:37 -07:00
|
|
|
require 'fog/deprecation'
|
2010-03-26 11:15:27 -07:00
|
|
|
require 'fog/model'
|
|
|
|
require 'fog/parser'
|
2010-04-14 20:32:56 -07:00
|
|
|
require 'fog/ssh'
|
2010-05-01 22:10:11 -07:00
|
|
|
|
2010-05-25 22:26:20 -07:00
|
|
|
module Fog
|
2010-05-26 17:27:17 -07:00
|
|
|
module Errors
|
2010-05-26 17:37:27 -07:00
|
|
|
|
2010-06-09 17:53:54 -07:00
|
|
|
class Error < StandardError
|
|
|
|
attr_accessor :verbose
|
|
|
|
end
|
2010-05-26 17:37:27 -07:00
|
|
|
|
|
|
|
class MockNotImplemented < Fog::Errors::Error; end
|
|
|
|
|
2010-05-26 17:27:17 -07:00
|
|
|
class NotFound < Fog::Errors::Error; end
|
2010-05-26 17:37:27 -07:00
|
|
|
|
2010-05-26 17:27:17 -07:00
|
|
|
end
|
2010-05-25 22:26:20 -07:00
|
|
|
end
|
|
|
|
|
2010-03-26 11:15:27 -07:00
|
|
|
require 'fog/aws'
|
2010-06-01 21:40:46 -07:00
|
|
|
require 'fog/bluebox'
|
2010-05-01 22:10:11 -07:00
|
|
|
require 'fog/local'
|
2010-03-26 11:15:27 -07:00
|
|
|
require 'fog/rackspace'
|
|
|
|
require 'fog/slicehost'
|
|
|
|
require 'fog/terremark'
|
2010-05-02 21:46:43 -07:00
|
|
|
require 'fog/vcloud'
|
2010-03-26 11:15:27 -07:00
|
|
|
|
2009-08-07 00:28:53 -07:00
|
|
|
module Fog
|
|
|
|
|
2010-05-03 17:25:59 -07:00
|
|
|
unless const_defined?(:VERSION)
|
2010-06-07 23:42:55 -07:00
|
|
|
VERSION = '0.1.8'
|
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
|
|
|
|
|
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-05-01 15:08:44 -07: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 00:28:53 -07:00
|
|
|
end
|