Sha256: 43cc9648be863dd18a64ebd9207ce9a1d22a8aa029462bff8f020c1dfd46a65d

Contents?: true

Size: 652 Bytes

Versions: 27

Compression:

Stored size: 652 Bytes

Contents

class Pathname
  # Returns true or false if the path of the instantiated 
  # Pathname or a parent directory contains a Tryhard Pack 
  # data directory.
  #
  # @return [Boolean]
  def cookbook?
    self.join('metadata.rb').exist?
  end
  alias_method :chef_cookbook?, :cookbook?

  # 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
  #
  # @return [Pathname, nil]
  def cookbook_root
    self.ascend do |potential_root|
      if potential_root.cookbook?
        return potential_root
      end
    end
  end
  alias_method :chef_cookbook_root, :cookbook_root
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
berkshelf-1.0.0.rc1 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.6.0.beta4 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.6.0.beta3 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.6.0.beta2 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.6.0.beta1 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.0.rc4 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.0.rc3 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.0.rc2 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.5.0.rc1 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.4.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.4.0.rc4 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.4.0.rc3 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.4.0.rc2 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.4.0.rc1 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.3.7 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.3.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.3.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-0.3.1 lib/berkshelf/core_ext/pathname.rb