diff --git a/lib/fog/aws/models/s3/directory.rb b/lib/fog/aws/models/s3/directory.rb index 124f459e8..751cab23c 100644 --- a/lib/fog/aws/models/s3/directory.rb +++ b/lib/fog/aws/models/s3/directory.rb @@ -8,8 +8,9 @@ module Fog class Directory < Fog::Model extend Fog::Deprecation deprecate(:name, :key) + deprecate(:name=, :key=) - identity :key, ['Name', 'name', :name] + identity :key, ['Name', 'name'] attribute :creation_date, 'CreationDate' diff --git a/lib/fog/deprecation.rb b/lib/fog/deprecation.rb index 38ad3b9f9..110d0111c 100644 --- a/lib/fog/deprecation.rb +++ b/lib/fog/deprecation.rb @@ -8,7 +8,7 @@ module Fog warning = "[yellow][WARN] #{self} => ##{older} is deprecated, use ##{newer} instead[/]" warning << " [light_black](" << location << ")[/] " Formatador.display_line(warning) - #{newer}(*args) + send(:#{newer}, *args) end EOS end diff --git a/lib/fog/local/models/directories.rb b/lib/fog/local/models/directories.rb index 528df7804..18ad0a279 100644 --- a/lib/fog/local/models/directories.rb +++ b/lib/fog/local/models/directories.rb @@ -24,14 +24,14 @@ module Fog data = Dir.entries(connection.local_root).select do |entry| entry[0...1] != '.' && ::File.directory?(connection.path_to(entry)) end.map do |entry| - {:name => entry} + {:key => entry} end load(data) end - def get(name) - if ::File.directory?(connection.path_to(name)) - new(:name => name) + def get(key) + if ::File.directory?(connection.path_to(key)) + new(:key => key) else nil end diff --git a/lib/fog/local/models/directory.rb b/lib/fog/local/models/directory.rb index bee6efc22..668189ebe 100644 --- a/lib/fog/local/models/directory.rb +++ b/lib/fog/local/models/directory.rb @@ -5,11 +5,14 @@ module Fog module Local class Directory < Fog::Model + extend Fog::Deprecation + deprecate(:name, :key) + deprecate(:name=, :key=) - identity :name + identity :key def destroy - requires :name + requires :key if ::File.directory?(path) Dir.rmdir(path) @@ -29,7 +32,7 @@ module Fog end def save - requires :name + requires :key Dir.mkdir(path) true @@ -38,7 +41,7 @@ module Fog private def path - connection.path_to(name) + connection.path_to(key) end end diff --git a/lib/fog/local/models/file.rb b/lib/fog/local/models/file.rb index 6443818b7..f2a5510b6 100644 --- a/lib/fog/local/models/file.rb +++ b/lib/fog/local/models/file.rb @@ -49,7 +49,7 @@ module Fog end def path - connection.path_to(::File.join(directory.name, key)) + connection.path_to(::File.join(directory.key, key)) end end diff --git a/lib/fog/local/models/files.rb b/lib/fog/local/models/files.rb index cd2ab9cfd..cf6c52111 100644 --- a/lib/fog/local/models/files.rb +++ b/lib/fog/local/models/files.rb @@ -9,8 +9,8 @@ module Fog model Fog::Local::File def all - if directory.collection.get(directory.name) - data = Dir.entries(connection.path_to(directory.name)).select do |key| + if directory.collection.get(directory.key) + data = Dir.entries(connection.path_to(directory.key)).select do |key| key[0...1] != '.' && !::File.directory?(connection.path_to(key)) end.map do |key| path = file_path(key) @@ -66,7 +66,7 @@ module Fog end def file_path(key) - connection.path_to(::File.join(directory.name, key)) + connection.path_to(::File.join(directory.key, key)) end end diff --git a/lib/fog/rackspace/models/files/directory.rb b/lib/fog/rackspace/models/files/directory.rb index 5d9f94793..44517b571 100644 --- a/lib/fog/rackspace/models/files/directory.rb +++ b/lib/fog/rackspace/models/files/directory.rb @@ -8,8 +8,9 @@ module Fog class Directory < Fog::Model extend Fog::Deprecation deprecate(:name, :key) + deprecate(:name=, :key=) - identity :key, ['name', :name] + identity :key, ['name'] attribute :bytes attribute :count