mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[local] rename files to storage for consistency
This commit is contained in:
parent
a637504d18
commit
24897e9c1e
11 changed files with 294 additions and 266 deletions
60
lib/fog/local/storage.rb
Normal file
60
lib/fog/local/storage.rb
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
module Fog
|
||||
module Local
|
||||
class Storage < Fog::Service
|
||||
|
||||
requires :local_root
|
||||
|
||||
model_path 'fog/local/models/storage'
|
||||
collection :directories
|
||||
model :directory
|
||||
model :file
|
||||
collection :files
|
||||
|
||||
class Mock
|
||||
include Collections
|
||||
|
||||
def self.data
|
||||
@data ||= Hash.new do |hash, key|
|
||||
hash[key] = {}
|
||||
end
|
||||
end
|
||||
|
||||
def self.reset_data(keys=data.keys)
|
||||
for key in [*keys]
|
||||
data.delete(key)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(options={})
|
||||
@local_root = ::File.expand_path(options[:local_root])
|
||||
@data = self.class.data[@local_root]
|
||||
end
|
||||
|
||||
def local_root
|
||||
@local_root
|
||||
end
|
||||
|
||||
def path(partial)
|
||||
partial
|
||||
end
|
||||
end
|
||||
|
||||
class Real
|
||||
include Collections
|
||||
|
||||
def initialize(options={})
|
||||
@local_root = ::File.expand_path(options[:local_root])
|
||||
end
|
||||
|
||||
def local_root
|
||||
@local_root
|
||||
end
|
||||
|
||||
def path_to(partial)
|
||||
::File.join(@local_root, partial)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue