Sha256: c424b671adeab4d30c08029a1cc29ef7b6c415b40d5f03deaab94c0154d4de78

Contents?: true

Size: 620 Bytes

Versions: 86

Compression:

Stored size: 620 Bytes

Contents

class Pathname
  # Returns true or false if the path contains a "metadata.json" or a "metadata.rb" file.
  #
  # @return [Boolean]
  def cookbook?
    join("metadata.json").exist? || join("metadata.rb").exist?
  end
  alias_method :chef_cookbook?, :cookbook?

  # Ascend the directory structure from the given path to find  the root of a
  # Cookbook. If no Cookbook is found, nil is returned.
  #
  # @return [Pathname, nil]
  def cookbook_root
    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

86 entries across 86 versions & 1 rubygems

Version Path
berkshelf-3.0.0.beta9 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0.beta8 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0.beta7 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0.beta6 lib/berkshelf/core_ext/pathname.rb
berkshelf-2.0.14 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0.beta5 lib/berkshelf/core_ext/pathname.rb