module Shard::ShardDirectory
Public Instance Methods
create_shard_dir(ref)
click to toggle source
#
Module Methods #
#
# File lib/shard/shard_directory.rb, line 11 def create_shard_dir(ref) dir = directory(ref) unless shard_dir_exists?(ref) FileUtils.mkpath(dir) end end
directory(ref)
click to toggle source
# File lib/shard/shard_directory.rb, line 23 def directory(ref) File.join(root_path, ref.user, ref.name, ref.version) end
file_path(ref, filename, options = {})
click to toggle source
# File lib/shard/shard_directory.rb, line 31 def file_path(ref, filename, options = {}) File.join( directory(ref), filename ) end
find_file_path(ref, filename, options = {})
click to toggle source
# File lib/shard/shard_directory.rb, line 35 def find_file_path(ref, filename, options = {}) find_file_paths(ref, filename).first end
find_file_paths(ref, *filenames)
click to toggle source
# File lib/shard/shard_directory.rb, line 39 def find_file_paths(ref, *filenames) full_names = filenames.map do |filename| File.join( directory(ref), filename) end Dir[ *full_names ] end
root_path()
click to toggle source
# File lib/shard/shard_directory.rb, line 27 def root_path File.join(Dir.home, '.shard') end
shard_dir_exists?(ref)
click to toggle source
# File lib/shard/shard_directory.rb, line 19 def shard_dir_exists?(ref) Dir.exists? directory(ref) end