Module: EacLauncher::Git::Base::ClassMethods
- Included in:
- EacLauncher::Git::Base
- Defined in:
- lib/eac_launcher/git/base/class_methods.rb
Instance Method Summary collapse
- #by_root(search_base_path) ⇒ EacLauncher::Git::Base
-
#find_root(search_base_path) ⇒ Pathname
Searches the root path for the Git repository which includes
search_base_path
.
Instance Method Details
#by_root(search_base_path) ⇒ EacLauncher::Git::Base
8 9 10 |
# File 'lib/eac_launcher/git/base/class_methods.rb', line 8 def by_root(search_base_path) new(find_root(search_base_path).to_path) end |
#find_root(search_base_path) ⇒ Pathname
Searches the root path for the Git repository which includes search_base_path
.
14 15 16 17 18 19 20 21 22 |
# File 'lib/eac_launcher/git/base/class_methods.rb', line 14 def find_root(search_base_path) path = search_base_path.to_pathname. loop do return path if path.join('.git').exist? raise "\".git\" not found for \"#{search_base_path}\"" if path.parent.root? path = path.parent end end |