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-8.0.15 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.13 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.12 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.9 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.7 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.5 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-8.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.2.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.2.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.2.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.1.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.10 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.9 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.8 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.7 lib/berkshelf/core_ext/pathname.rb
berkshelf-6.3.4 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.6 lib/berkshelf/core_ext/pathname.rb
berkshelf-7.0.5 lib/berkshelf/core_ext/pathname.rb