Class: Rdm::Git::RepositoryLocator
- Inherits:
-
Object
- Object
- Rdm::Git::RepositoryLocator
- Defined in:
- lib/rdm/git/repository_locator.rb
Constant Summary collapse
- GIT_FOLDER =
'.git'
Class Method Summary collapse
Class Method Details
.git_present?(path) ⇒ Boolean
17 18 19 20 21 |
# File 'lib/rdm/git/repository_locator.rb', line 17 def git_present?(path) expected_source_file = File.join(path, GIT_FOLDER) File.exist?(expected_source_file) end |
.locate(path) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rdm/git/repository_locator.rb', line 5 def locate(path) raise Rdm::Errors::GitRepositoryNotInitialized, path if root_reached?(path) return path if git_present?(path) locate(File.dirname(path)) end |
.root_reached?(path) ⇒ Boolean
13 14 15 |
# File 'lib/rdm/git/repository_locator.rb', line 13 def root_reached?(path) File.(path) == '/' end |