class Dir

Public Class Methods

has_chef_metadata?(path) click to toggle source

Check if the given directory contains a Chef metadata file

@param [#to_s] path

the directory path

@return [Boolean]

# File lib/mb/core_ext/dir.rb, line 32
def has_chef_metadata?(path)
  File.exist?(File.join(path, MB::CookbookMetadata::RUBY_FILENAME)) ||
    File.exist?(File.join(path, MB::CookbookMetadata::JSON_FILENAME))
end
has_mb_file?(path) click to toggle source

Check if the given directory contains a motherbrain plugin file

@param [#to_s] path

the directory path

@return [Boolean]

# File lib/mb/core_ext/dir.rb, line 22
def has_mb_file?(path)
  File.exist?(File.join(path, MB::Plugin::PLUGIN_FILENAME))
end
has_mb_plugin?(path) click to toggle source

Check if the given directory contains a cookbook with a motherbrain plugin

@param [#to_s] path

the directory path

@return [Boolean]

# File lib/mb/core_ext/dir.rb, line 9
def has_mb_plugin?(path)
  return false unless exists?(path)
  return false unless has_mb_file?(path)
  return false unless has_chef_metadata?(path)
  true
end