diff --git a/lib/fog/local/models/storage/directories.rb b/lib/fog/local/models/storage/directories.rb index cf0725718..e80876647 100644 --- a/lib/fog/local/models/storage/directories.rb +++ b/lib/fog/local/models/storage/directories.rb @@ -10,8 +10,8 @@ module Fog model Fog::Storage::Local::Directory def all - data = Dir.entries(connection.local_root).select do |entry| - entry[0...1] != '.' && ::File.directory?(connection.path_to(entry)) + data = Dir.entries(service.local_root).select do |entry| + entry[0...1] != '.' && ::File.directory?(service.path_to(entry)) end.map do |entry| {:key => entry} end @@ -19,7 +19,7 @@ module Fog end def get(key) - if ::File.directory?(connection.path_to(key)) + if ::File.directory?(service.path_to(key)) new(:key => key) else nil diff --git a/lib/fog/local/models/storage/directory.rb b/lib/fog/local/models/storage/directory.rb index 7e22ae678..4ce8e3fd0 100644 --- a/lib/fog/local/models/storage/directory.rb +++ b/lib/fog/local/models/storage/directory.rb @@ -24,7 +24,7 @@ module Fog @files ||= begin Fog::Storage::Local::Files.new( :directory => self, - :connection => connection + :service => service ) end end @@ -47,7 +47,7 @@ module Fog private def path - connection.path_to(key) + service.path_to(key) end end diff --git a/lib/fog/local/models/storage/file.rb b/lib/fog/local/models/storage/file.rb index 3140f72b0..cbad0231e 100644 --- a/lib/fog/local/models/storage/file.rb +++ b/lib/fog/local/models/storage/file.rb @@ -40,8 +40,8 @@ module Fog def copy(target_directory_key, target_file_key, options={}) requires :directory, :key - connection.copy_object(directory.key, key, target_directory_key, target_file_key) - target_directory = connection.directories.new(:key => target_directory_key) + service.copy_object(directory.key, key, target_directory_key, target_file_key) + target_directory = service.directories.new(:key => target_directory_key) target_directory.files.get(target_file_key) end @@ -55,7 +55,7 @@ module Fog next end # don't delete the containing directory or higher - if dir_path == connection.path_to(directory.key) + if dir_path == service.path_to(directory.key) break end pwd = Dir.pwd @@ -77,11 +77,11 @@ module Fog def public_url requires :directory, :key - if connection.endpoint + if service.endpoint escaped_directory = URI.escape(directory.key) escaped_key = URI.escape(key) - ::File.join(connection.endpoint, escaped_directory, escaped_key) + ::File.join(service.endpoint, escaped_directory, escaped_key) else nil end @@ -121,7 +121,7 @@ module Fog end def path - connection.path_to(::File.join(directory.key, key)) + service.path_to(::File.join(directory.key, key)) end end diff --git a/lib/fog/local/models/storage/files.rb b/lib/fog/local/models/storage/files.rb index f3543a204..a2871e441 100644 --- a/lib/fog/local/models/storage/files.rb +++ b/lib/fog/local/models/storage/files.rb @@ -15,7 +15,7 @@ module Fog requires :directory if directory.collection.get(directory.key) pwd = Dir.pwd - Dir.chdir(connection.path_to(directory.key)) + Dir.chdir(service.path_to(directory.key)) data = Dir.glob('**/*').reject do |file| ::File.directory?(file) end.map do |key| @@ -78,7 +78,7 @@ module Fog private def file_path(key) - connection.path_to(::File.join(directory.key, key)) + service.path_to(::File.join(directory.key, key)) end end