Permalink
Browse files

deprecate old initializers

  • Loading branch information...
1 parent 0a85cd8 commit bc25028c2f8873f66baa21949871a1ea08c85d15 @geemus geemus committed Jan 8, 2011
View
@@ -3,7 +3,7 @@ class CDN
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
- case provider = attributes.delete(:provider)
+ case provider = attributes[:provider] # attributes.delete(:provider)
when 'AWS'
require 'fog/cdn/aws'
Fog::AWS::CDN.new(attributes)
View
@@ -4,6 +4,7 @@ class CDN < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :version, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/cdn/models/aws'
@@ -34,6 +35,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::AWS::CDN.new is deprecated, use Fog::CDN.new(:provider => 'AWS') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'mime/types'
@aws_access_key_id = options[:aws_access_key_id]
@data = self.class.data[options[:region]][@aws_access_key_id]
@@ -64,6 +72,13 @@ class Real
# ==== Returns
# * cdn object with connection to aws.
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::AWS::CDN.new is deprecated, use Fog::CDN.new(:provider => 'AWS') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
View
@@ -4,6 +4,7 @@ class CDN < Fog::Service
requires :rackspace_api_key, :rackspace_username
recognizes :rackspace_auth_url, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/cdn/models/rackspace'
@@ -27,6 +28,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Rackspace::CDN.new is deprecated, use Fog::CDN.new(:provider => 'Rackspace') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@rackspace_username = options[:rackspace_username]
@data = self.class.data[@rackspace_username]
end
@@ -36,6 +44,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Rackspace::CDN.new is deprecated, use Fog::CDN.new(:provider => 'Rackspace') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'json'
credentials = Fog::Rackspace.authenticate(options)
@auth_token = credentials['X-Auth-Token']
View
@@ -3,7 +3,7 @@ class Compute
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
- case provider = attributes.delete(:provider)
+ case provider = attributes[:provider] # attributes.delete(:provider)
when 'AWS'
require 'fog/compute/aws'
Fog::AWS::Compute.new(attributes)
View
@@ -20,6 +20,7 @@ class Compute < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/aws'
model :address
@@ -145,6 +146,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::AWS::Compute.new is deprecated, use Fog::Compute.new(:provider => 'AWS') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@aws_access_key_id = options[:aws_access_key_id]
@region = options[:region] || 'us-east-1'
@data = self.class.data[@region][@aws_access_key_id]
@@ -174,6 +182,13 @@ class Real
# ==== Returns
# * EC2 object with connection to aws.
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::AWS::Compute.new is deprecated, use Fog::Compute.new(:provider => 'AWS') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@aws_access_key_id = options[:aws_access_key_id]
@aws_secret_access_key = options[:aws_secret_access_key]
@hmac = Fog::HMAC.new('sha256', @aws_secret_access_key)
View
@@ -4,6 +4,7 @@ class Compute < Fog::Service
requires :bluebox_api_key, :bluebox_customer_id
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/bluebox'
model :flavor
@@ -39,6 +40,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Bluebox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Bluebox') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@bluebox_api_key = options[:bluebox_api_key]
@data = self.class.data[@bluebox_api_key]
end
@@ -48,6 +56,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Bluebox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Bluebox') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'json'
@bluebox_api_key = options[:bluebox_api_key]
@bluebox_customer_id = options[:bluebox_customer_id]
@@ -6,6 +6,7 @@ class Compute < Fog::Service
requires :brightbox_client_id, :brightbox_secret
recognizes :brightbox_auth_url, :brightbox_api_url
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/brightbox'
model :account # Singular resource, no collection
@@ -73,6 +74,13 @@ class Compute < Fog::Service
class Mock
def initialize(options)
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Brightbox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Brightbox') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@brightbox_client_id = options[:brightbox_client_id] || Fog.credentials[:brightbox_client_id]
@brightbox_secret = options[:brightbox_secret] || Fog.credentials[:brightbox_secret]
end
@@ -85,6 +93,13 @@ def request(options)
class Real
def initialize(options)
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Brightbox::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Brightbox') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require "json"
# Currently authentication and api endpoints are the same but may change
@auth_url = options[:brightbox_auth_url] || Fog.credentials[:brightbox_auth_url] || API_URL
View
@@ -4,6 +4,7 @@ class Compute < Fog::Service
requires :go_grid_api_key, :go_grid_shared_secret
recognizes :host, :path, :port, :scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/go_grid'
model :image
@@ -38,6 +39,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::GoGrid::Compute.new is deprecated, use Fog::Compute.new(:provider => 'GoGrid') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@go_grid_api_key = options[:go_grid_api_key]
@go_grid_shared_secret = options[:go_grid_shared_secret]
@data = self.class.data[@go_grid_api_key]
@@ -48,6 +56,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::GoGrid::Compute.new is deprecated, use Fog::Compute.new(:provider => 'GoGrid') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'digest/md5'
require 'json'
@go_grid_api_key = options[:go_grid_api_key]
View
@@ -4,6 +4,7 @@ class Compute < Fog::Service
requires :linode_api_key
recognizes :port, :scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/linode'
@@ -37,6 +38,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Linode::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Linode') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@linode_api_key = options[:linode_api_key]
@data = self.class.data[@linode_api_key]
end
@@ -46,6 +54,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Linode::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Linode') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'json'
@linode_api_key = options[:linode_api_key]
@host = options[:host] || "api.linode.com"
@@ -6,6 +6,7 @@ class Compute < Fog::Service
requires :new_servers_password, :new_servers_username
recognizes :host, :port, :scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/new_servers'
@@ -33,6 +34,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::NewServers::Compute.new is deprecated, use Fog::Compute.new(:provider => 'NewServers') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@new_server_username = options[:new_servers_username]
@data = self.class.data[@new_server_username]
end
@@ -42,6 +50,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::NewServers::Compute.new is deprecated, use Fog::Compute.new(:provider => 'NewServers') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@new_servers_password = options[:new_servers_password]
@new_servers_username = options[:new_servers_username]
@host = options[:host] || "noc.newservers.com"
@@ -20,6 +20,7 @@ class Compute < Fog::Service
requires :rackspace_api_key, :rackspace_username
recognizes :rackspace_auth_url, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/rackspace'
model :flavor
@@ -75,6 +76,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Rackspace::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Rackspace') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@rackspace_username = options[:rackspace_username]
@data = self.class.data[@rackspace_username]
end
@@ -84,6 +92,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Rackspace::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Rackspace') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
require 'json'
credentials = Fog::Rackspace.authenticate(options)
@auth_token = credentials['X-Auth-Token']
@@ -4,6 +4,7 @@ class Compute < Fog::Service
requires :slicehost_password
recognizes :host, :port, :scheme, :persistent
+ recognizes :provider # remove post deprecation
model_path 'fog/compute/models/slicehost'
model :flavor
@@ -40,6 +41,13 @@ def self.reset_data(keys=data.keys)
end
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Slicehost::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Slicehost') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@slicehost_password = options[:slicehost_password]
@data = self.class.data[@slicehost_password]
end
@@ -49,6 +57,13 @@ def initialize(options={})
class Real
def initialize(options={})
+ unless options.delete(:provider)
+ location = caller.first
+ warning = "[yellow][WARN] Fog::Slicehost::Compute.new is deprecated, use Fog::Compute.new(:provider => 'Slicehost') instead[/]"
+ warning << " [light_black](" << location << ")[/] "
+ Formatador.display_line(warning)
+ end
+
@slicehost_password = options[:slicehost_password]
@host = options[:host] || "api.slicehost.com"
@port = options[:port] || 443
View
@@ -3,7 +3,7 @@ class DNS
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
- case provider = attributes.delete(:provider)
+ case provider = attributes[:provider] # attributes.delete(:provider)
when 'AWS'
require 'fog/dns/aws'
Fog::AWS::DNS.new(attributes)
Oops, something went wrong.

0 comments on commit bc25028

Please sign in to comment.