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-6.3.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.4 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.3.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.3.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.3.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.2.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.2.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.2.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.1.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.1.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.0.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.6.5 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.6.4 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.6.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-5.6.2 lib/berkshelf/core_ext/pathname.rb