class Arcanus::Repo
Exposes information about the current git repository.
Public Instance Methods
arcanus_dir()
click to toggle source
# File lib/arcanus/repo.rb, line 32 def arcanus_dir File.join(root, '.arcanus') end
chest_file_path()
click to toggle source
# File lib/arcanus/repo.rb, line 40 def chest_file_path File.join(root, CHEST_FILE_PATH) end
gitignore_file_path()
click to toggle source
# File lib/arcanus/repo.rb, line 36 def gitignore_file_path File.join(arcanus_dir, '.gitignore') end
has_chest_file?()
click to toggle source
# File lib/arcanus/repo.rb, line 44 def has_chest_file? File.exist?(chest_file_path) end
has_locked_key?()
click to toggle source
# File lib/arcanus/repo.rb, line 52 def has_locked_key? File.exist?(locked_key_path) end
has_unlocked_key?()
click to toggle source
# File lib/arcanus/repo.rb, line 60 def has_unlocked_key? File.exist?(unlocked_key_path) end
locked_key_path()
click to toggle source
# File lib/arcanus/repo.rb, line 48 def locked_key_path File.join(root, LOCKED_KEY_PATH) end
root()
click to toggle source
Returns the absolute path to the root of the current repository the current working directory resides within.
@return [String] @raise [Arcanus::Errors::InvalidArcanusRepoError] if the current directory
doesn't reside within a git repository
# File lib/arcanus/repo.rb, line 12 def root @root ||= begin arc_dir = Pathname.new(File.expand_path('.')) .enum_for(:ascend) .find do |path| # We check for .arcanus first since most repos will have that but # not necessarily have .git. However, when running `arcanus setup`, # the .arcanus directory won't exist yet, so check for .git (path + '.arcanus').exist? || (path + '.git').exist? end unless arc_dir raise Errors::InvalidArcanusRepoError, 'no .arcanus directory found' end arc_dir.to_s end end
unlocked_key_path()
click to toggle source
# File lib/arcanus/repo.rb, line 56 def unlocked_key_path File.join(root, UNLOCKED_KEY_PATH) end