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-4.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.3.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.2.4 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.2.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.2.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.2.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.2.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.5 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.4 lib/berkshelf/core_ext/pathname.rb
berkshelf-2.0.18 lib/berkshelf/core_ext/pathname.rb
berkshelf-2.0.17 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.3 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.2 lib/berkshelf/core_ext/pathname.rb
berkshelf-2.0.16 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.1.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.1 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0 lib/berkshelf/core_ext/pathname.rb
berkshelf-2.0.15 lib/berkshelf/core_ext/pathname.rb
berkshelf-3.0.0.rc1 lib/berkshelf/core_ext/pathname.rb