2010-09-21 14:11:15 -04:00
|
|
|
class Local < Fog::Bin
|
2010-05-02 01:10:11 -04:00
|
|
|
class << self
|
|
|
|
|
2010-12-06 22:49:58 -05:00
|
|
|
def class_for(key)
|
|
|
|
case key
|
|
|
|
when :files, :storage
|
|
|
|
Fog::Local::Storage
|
|
|
|
else
|
|
|
|
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
2010-12-06 22:49:58 -05:00
|
|
|
if key == :files
|
2010-09-21 14:11:15 -04:00
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] Local[:files] is deprecated, use Local[:storage] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
2010-05-02 01:10:11 -04:00
|
|
|
end
|
2010-12-06 22:49:58 -05:00
|
|
|
hash[key] = class_for(key).new
|
2010-05-02 01:10:11 -04:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
@@connections[service]
|
|
|
|
end
|
2010-05-02 01:10:11 -04:00
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def services
|
|
|
|
[:storage]
|
2010-05-02 01:10:11 -04:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
2010-05-02 01:10:11 -04:00
|
|
|
end
|
|
|
|
end
|