mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[bin] update to non-deprecated initializers
This commit is contained in:
parent
7d9b122b94
commit
d881ee6006
12 changed files with 96 additions and 27 deletions
|
@ -27,24 +27,37 @@ class AWS < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
klazz = class_for(key)
|
||||
hash[key] = case key
|
||||
hash[key] = case service
|
||||
when :cdn
|
||||
Fog::CDN.new(:provider => 'AWS')
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'AWS')
|
||||
when :dns
|
||||
Fog::DNS.new(:provider => 'AWS')
|
||||
when :ec2
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] AWS[:ec2] is deprecated, use AWS[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
klazz.new
|
||||
Fog::Compute.new(:provider => 'AWS')
|
||||
when :elb
|
||||
Fog::AWS::ELB.new
|
||||
when :iam
|
||||
Fog::AWS::IAM.new
|
||||
when :eu_storage
|
||||
klazz.new(:region => 'eu-west-1')
|
||||
Fog::Storage.new(:provider => 'AWS', :region => 'eu-west-1')
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new
|
||||
when :s3
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] AWS[:s3] is deprecated, use AWS[:storage] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
klazz.new
|
||||
Fog::Storage.new(:provider => 'AWS')
|
||||
when :storage
|
||||
Fog::Storage.new(:provider => 'AWS')
|
||||
else
|
||||
klazz.new
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
|
|
|
@ -12,13 +12,18 @@ class Bluebox < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
if key == :blocks
|
||||
hash[key] = case service
|
||||
when :blocks
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Bluebox[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
Fog::Compute.new(:provider => 'Brightbox')
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'Brightbox')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,7 +12,12 @@ class Brightbox < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = class_for(key).new
|
||||
hash[key] = case service
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'Brightbox')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,13 +12,18 @@ class GoGrid < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
if key == :servers
|
||||
hash[key] = case service
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'GoGrid')
|
||||
when :servers
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] GoGrid[:servers] is deprecated, use GoGrid[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
Fog::Compute.new(:provider => 'GoGrid')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,7 +12,12 @@ class Google < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = class_for(key).new
|
||||
hash[key] = case service
|
||||
when :storage
|
||||
Fog::Storage.new(:provider => 'Google')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -14,13 +14,20 @@ class Linode < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
if key == :linode
|
||||
hash[key] = case service
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'Linode')
|
||||
when :dns
|
||||
Fog::DNS.new(:provider => 'Linode')
|
||||
when :linode
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Linode[:linode] is deprecated, use Linode[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
Fog::Compute.new(:provider => 'Linode')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,13 +12,18 @@ class Local < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
if key == :files
|
||||
hash[key] = case service
|
||||
when :files
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Local[:files] is deprecated, use Local[:storage] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
Fog::Storage.new(:provider => 'Local')
|
||||
when :storage
|
||||
Fog::Storage.new(:provider => 'Local')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,13 +12,18 @@ class NewServers < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
if key == :new_servers
|
||||
hash[key] = case service
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'NewServers')
|
||||
when :new_servers
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] NewServers[:servers] is deprecated, use NewServers[:compute] instead[/]"
|
||||
warning = "[yellow][WARN] NewServers[:new_servers] is deprecated, use NewServers[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
Fog::Compute.new(:provider => 'NewServers')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -16,22 +16,29 @@ class Rackspace < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
klazz = class_for(key)
|
||||
hash[key] = case key
|
||||
hash[key] = case service
|
||||
when :cdn
|
||||
Fog::CDN.new(:provider => 'Rackspace')
|
||||
when :compute
|
||||
Fog::Compute.new(:provider => 'Rackspace')
|
||||
when :dns
|
||||
Fog::DNS.new(:provider => 'Rackspace')
|
||||
when :files
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Rackspace[:files] is deprecated, use Rackspace[:storage] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
klazz.new
|
||||
Fog::Storage.new(:provider => 'Rackspace')
|
||||
when :servers
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Rackspace[:servers] is deprecated, use Rackspace[:compute] instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
klazz.new
|
||||
Fog::Compute.new(:provider => Rackspace)
|
||||
when :storage
|
||||
Fog::Storage.new(:provider => 'Rackspace')
|
||||
else
|
||||
klazz.new
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
|
|
|
@ -20,7 +20,14 @@ class Slicehost < Fog::Bin
|
|||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
end
|
||||
hash[key] = class_for(key).new
|
||||
hash[key] = case service
|
||||
when :compute, :slices
|
||||
Fog::Compute.new(:provider => 'Slicehost')
|
||||
when :dns
|
||||
Fog::DNS.new(:provider => 'Slicehost')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -12,7 +12,12 @@ class Zerigo < Fog::Bin
|
|||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = class_for(key).new
|
||||
hash[key] = case service
|
||||
when :dns
|
||||
Fog::DNS.new(:provider => 'Zerigo')
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{service}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
|
|
@ -79,7 +79,7 @@ module Fog
|
|||
def initialize(options={})
|
||||
unless options.delete(:provider)
|
||||
location = caller.first
|
||||
warning = "[yellow][WARN] Fog::AWS::DNS.new is deprecated, use Fog::Storage.new(:provider => 'DNS') instead[/]"
|
||||
warning = "[yellow][WARN] Fog::AWS::DNS.new is deprecated, use Fog::DNS.new(:provider => 'DNS') instead[/]"
|
||||
warning << " [light_black](" << location << ")[/] "
|
||||
Formatador.display_line(warning)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue