1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[local|storage] Updates reference to service

This commit is contained in:
Paul Thornthwaite 2012-12-22 23:25:11 +00:00
parent 43d1700ccb
commit fbc5c52194
4 changed files with 13 additions and 13 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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