Module: RightPublish::LocalStorage

Defined in:
lib/right_publish/stores/local.rb

Constant Summary collapse

DEFAULT_LOCAL_CACHEDIR =
File.expand_path('~/.right_publish/cache')
STORAGE_KEY =
:local_storage
STORAGE_OPTIONS =
{ :cache_dir=>DEFAULT_LOCAL_CACHEDIR }

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_directoriesObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/right_publish/stores/local.rb', line 50

def self.get_directories()
  Profile.log("Connecting to local cache.", :debug)
  conn = Fog::Storage.new(
    :provider=>"Local",
    :local_root=>Profile.config[STORAGE_KEY][:cache_dir] )

    Profile.log("Attaching to local cache: [#{Profile.config[STORAGE_KEY][:cache_dir]}].", :debug)
    conn.directories.create(:key=>'.') unless File.exists? Profile.config[STORAGE_KEY][:cache_dir]
    local_dir = conn.directories.get('.')
    local_dir.extend(LocalStorage)
    local_dir
end

Instance Method Details

#compute_md5(file) ⇒ Object



46
47
48
# File 'lib/right_publish/stores/local.rb', line 46

def compute_md5(file)
  Digest::MD5.file(File.join(service.path_to(self.key), file.key)).hexdigest
end