Class: Rdm::Packages::Locator
- Inherits:
-
Object
- Object
- Rdm::Packages::Locator
- Defined in:
- lib/rdm/packages/locator.rb
Class Method Summary collapse
- .locate(path) ⇒ Object
- .package_present?(path) ⇒ Boolean
- .root_reached?(path) ⇒ Boolean
- .source_present?(path) ⇒ Boolean
Class Method Details
.locate(path) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/rdm/packages/locator.rb', line 3 def locate(path) raise Rdm::Errors::PackageFileDoesNotFound, path if source_present?(path) raise Rdm::Errors::SourceFileDoesNotExist, path if root_reached?(path) return path if package_present?(path) locate(File.dirname(path)) end |
.package_present?(path) ⇒ Boolean
22 23 24 25 26 |
# File 'lib/rdm/packages/locator.rb', line 22 def package_present?(path) expected_package_file = File.join(path, Rdm::PACKAGE_FILENAME) File.exist?(expected_package_file) end |
.root_reached?(path) ⇒ Boolean
12 13 14 |
# File 'lib/rdm/packages/locator.rb', line 12 def root_reached?(path) File.(path) == '/' end |
.source_present?(path) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/rdm/packages/locator.rb', line 16 def source_present?(path) expected_source_file = File.join(path, Rdm::SOURCE_FILENAME) File.exist?(expected_source_file) end |