Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/berkshelf/core_ext/pathname.rb
Instance Method Summary collapse
-
#cookbook? ⇒ Boolean
(also: #chef_cookbook?)
Returns true or false if the path of the instantiated Pathname or a parent directory contains a Tryhard Pack data directory.
-
#cookbook_root ⇒ Pathname?
(also: #chef_cookbook_root)
Ascend the directory structure from the given path to find a the root of a Chef Cookbook.
Instance Method Details
#cookbook? ⇒ Boolean Also known as: chef_cookbook?
Returns true or false if the path of the instantiated Pathname or a parent directory contains a Tryhard Pack data directory.
7 8 9 |
# File 'lib/berkshelf/core_ext/pathname.rb', line 7 def cookbook? self.join('metadata.rb').exist? end |
#cookbook_root ⇒ Pathname? Also known as: chef_cookbook_root
Ascend the directory structure from the given path to find a the root of a Chef Cookbook. If no Cookbook is found, nil is returned
16 17 18 19 20 21 22 |
# File 'lib/berkshelf/core_ext/pathname.rb', line 16 def cookbook_root self.ascend do |potential_root| if potential_root.cookbook? return potential_root end end end |