Class: GitCommands::Repository
- Inherits:
-
Object
- Object
- GitCommands::Repository
- Defined in:
- lib/git_commands/repository.rb
Defined Under Namespace
Classes: InvalidError
Constant Summary collapse
- LOCKING_FILES =
%w(rebase-merge rebase-apply)
Instance Method Summary collapse
-
#initialize(path) ⇒ Repository
constructor
A new instance of Repository.
- #locked? ⇒ Boolean
- #to_path ⇒ Object
Constructor Details
#initialize(path) ⇒ Repository
Returns a new instance of Repository.
9 10 11 12 |
# File 'lib/git_commands/repository.rb', line 9 def initialize(path) @path = Pathname::new(path.to_s) fail InvalidError, "'#{path}' is not a valid GIT repository!" unless valid? end |
Instance Method Details
#locked? ⇒ Boolean
18 19 20 21 22 |
# File 'lib/git_commands/repository.rb', line 18 def locked? LOCKING_FILES.any? do |name| File.exists?(@path.join(".git", name)) end end |
#to_path ⇒ Object
14 15 16 |
# File 'lib/git_commands/repository.rb', line 14 def to_path @path.to_s end |