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-5.6.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.6.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.5.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.4.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.3.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.2.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.1.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.3.5 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.3.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.3.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.3.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.3.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.2.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.2.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.2.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.2.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.1.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.1.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-4.0.1 lib/berkshelf/core_ext/pathname.rb