Class: Arcanus::Repo
- Inherits:
-
Object
- Object
- Arcanus::Repo
- Defined in:
- lib/arcanus/repo.rb
Overview
Exposes information about the current git repository.
Instance Method Summary collapse
- #arcanus_dir ⇒ Object
- #chest_file_path ⇒ Object
- #gitignore_file_path ⇒ Object
- #has_chest_file? ⇒ Boolean
- #has_locked_key? ⇒ Boolean
- #has_unlocked_key? ⇒ Boolean
- #locked_key_path ⇒ Object
-
#root ⇒ String
Returns the absolute path to the root of the current repository the current working directory resides within.
- #unlocked_key_path ⇒ Object
Instance Method Details
#arcanus_dir ⇒ Object
32 33 34 |
# File 'lib/arcanus/repo.rb', line 32 def arcanus_dir File.join(root, '.arcanus') end |
#chest_file_path ⇒ Object
40 41 42 |
# File 'lib/arcanus/repo.rb', line 40 def chest_file_path File.join(root, CHEST_FILE_PATH) end |
#gitignore_file_path ⇒ Object
36 37 38 |
# File 'lib/arcanus/repo.rb', line 36 def gitignore_file_path File.join(arcanus_dir, '.gitignore') end |
#has_chest_file? ⇒ Boolean
44 45 46 |
# File 'lib/arcanus/repo.rb', line 44 def has_chest_file? File.exist?(chest_file_path) end |
#has_locked_key? ⇒ Boolean
52 53 54 |
# File 'lib/arcanus/repo.rb', line 52 def has_locked_key? File.exist?(locked_key_path) end |
#has_unlocked_key? ⇒ Boolean
60 61 62 |
# File 'lib/arcanus/repo.rb', line 60 def has_unlocked_key? File.exist?(unlocked_key_path) end |
#locked_key_path ⇒ Object
48 49 50 |
# File 'lib/arcanus/repo.rb', line 48 def locked_key_path File.join(root, LOCKED_KEY_PATH) end |
#root ⇒ String
Returns the absolute path to the root of the current repository the current working directory resides within.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/arcanus/repo.rb', line 12 def root @root ||= begin arc_dir = Pathname.new(File.('.')) .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 ⇒ Object
56 57 58 |
# File 'lib/arcanus/repo.rb', line 56 def unlocked_key_path File.join(root, UNLOCKED_KEY_PATH) end |