Harbor::FileStore::Local
Attributes
Public Class Methods
Public Instance Methods
delete(path)
# File lib/harbor/file_store/local.rb, line 32 32: def delete(path) 33: path = strip_leading_slash(path) 34: ::FileUtils.rm(@root + path) 35: Harbor::File.rmdir_p((@root + path).parent.to_s) 36: end
exists?(path)
# File lib/harbor/file_store/local.rb, line 38 38: def exists?(path) 39: path = strip_leading_slash(path) 40: (@root + path).exist? 41: end
get(path)
# File lib/harbor/file_store/local.rb, line 16 16: def get(path) 17: path = strip_leading_slash(path) 18: Harbor::FileStore::File.new(self, path) 19: end
open(path, mode = "r", &block)
# File lib/harbor/file_store/local.rb, line 43 43: def open(path, mode = "r", &block) 44: path = strip_leading_slash(path) 45: ::FileUtils.mkdir_p((@root + path).parent.to_s) unless (@root + path).parent.exist? 46: ::File.open(@root + path, mode, &block) 47: end
put(path, absolute_path)
# File lib/harbor/file_store/local.rb, line 21 21: def put(path, absolute_path) 22: raise ArgumentError.new("Harbor::FileStore::Local#put[absolute_path] should be a path but was an IO") if absolute_path.is_a?(IO) 23: path = strip_leading_slash(path) 24: file = Harbor::FileStore::File.new(self, path) 25: 26: ::FileUtils.mkdir_p((@root + path).parent.to_s) unless (@root + path).parent.exist? 27: 28: ::FileUtils::cp(absolute_path, file.absolute_path) 29: file 30: end