Module: EDB::Storage::Filesystem

Defined in:
lib/edb/storage/filesystem.rb

Class Method Summary collapse

Class Method Details

.upload(source) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/edb/storage/filesystem.rb', line 30

def upload(source)
  filesystem = ::EDB.opts[:STORAGE][:Filesystem]

  path   = File.expand_path(filesystem[:path])
  folder = source.split('/')[0..-2].join('/')
  path   = File.join(path, folder)
  ::EDB::Logger.log(:info, "Copying #{source} to #{path}...")

  FileUtils.mkdir_p(path) unless Dir.exists?(path)

  source = File.join('./', source)
  FileUtils.cp_r(source, path)
end