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.rb

86 lines
1.4 KiB
Ruby
Raw Normal View History

2009-10-21 17:49:17 -04:00
require 'rubygems'
require 'base64'
require 'cgi'
2009-11-16 17:31:17 -05:00
require 'excon'
require 'formatador'
This is a combination of 23 commits (included merges from upstream); this commit(s) include changes to enforces recognizes/requires parameters for all supported services. Comments from the included commits follow: - Added google_storage_* keys - Fixed indentations. - Factored out requires and recognizes method implementation (now relies on the requires and recognizes clause from the NamedParameters module) - Added dependency to named-parameters gem. - Added recognizes declaration to classes for all supported services to enforce parameter name checks - - passing an unrecognized key when instantiating a service object will now cause an ArgumentError to be raised. - Added NOTE - comment added - check/filter-out keys from credentials that are not required by the class being instantiated - [local|storage] properly write out file contents - Added google_storage_* keys - Fixed indentations. - added put_object_acl request (ref: https://github.com/geemus/fog/issues#issue/74) - Release 0.3.24 - remove tracker reference from README - issues is now the goto for bugs/todo - notify and gracefully skip credential-less testsa - [rackspace|storage] fixes for directory/files - [local|storage] CGI.escape file names - Release 0.3.25 - updated deps; recognized_parameters -> declared_parameters; restored options filtering if Fog.bin - Added requires/recognizes to Fog::Terremark::Ecloud - Updted to use latest named-parameters gem. - Filter out unwanted parameters when Fog.bin - Updated to latest named-parameters gem - commented out unnecessary code - fix missing "volume" parameter error when setting Fog::AWS::Volume#server to nil (in order to detach it) - documentation update for key_pairs and helper - [aws|compute] commented/documented flavors/volumes - Fixes for issue 38 and 39 Closes #96
2010-11-21 05:56:41 -05:00
require 'named-parameters'
require 'time'
2009-10-21 17:49:17 -04:00
__DIR__ = File.dirname(__FILE__)
$LOAD_PATH.unshift __DIR__ unless
$LOAD_PATH.include?(__DIR__) ||
$LOAD_PATH.include?(File.expand_path(__DIR__))
require 'fog/core'
2009-08-07 03:28:53 -04:00
module Fog
2010-10-12 19:22:12 -04:00
@mocking = false
2010-05-03 20:25:59 -04:00
unless const_defined?(:VERSION)
2010-12-06 20:56:21 -05:00
VERSION = '0.3.29'
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
@delay = 1
def self.delay
@delay
end
def self.delay=(new_delay)
raise ArgumentError, "delay must be non-negative" unless new_delay >= 0
@delay = new_delay
end
def self.not_implemented
raise Fog::Errors::MockNotImplemented.new("Contributions welcome!")
end
2010-04-08 18:39:25 -04:00
end
def self.bin
@bin ||= false
end
def self.bin=(new_bin)
@bin = new_bin
end
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-07-21 22:18:34 -04:00
def self.wait_for(timeout=600, interval=1, &block)
duration = 0
start = Time.now
until yield || duration > timeout
2010-07-21 22:18:34 -04:00
sleep(interval)
duration = Time.now - start
end
if duration > timeout
false
else
{ :duration => duration }
end
end
2009-08-07 03:28:53 -04:00
end
require 'fog/aws'
require 'fog/bluebox'
require 'fog/brightbox'
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'
require 'fog/google'