Class: File

Inherits:
Object
  • Object
show all
Defined in:
lib/mb/core_ext/file.rb

Class Method Summary collapse

Class Method Details

.is_chef_metadata?(filepath) ⇒ Boolean

Determine if the given filepath points to a Chef metadata file

Parameters:

  • filepath (#to_s)

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/mb/core_ext/file.rb', line 8

def is_chef_metadata?(filepath)
  return false unless exists?(filepath)
  filename = basename(filepath)
  filename == MB::CookbookMetadata::RUBY_FILENAME || filename == MB::CookbookMetadata::JSON_FILENAME
end

.is_mb_plugin?(filepath) ⇒ Boolean

Determine if the given filepath points to a motherbrain plugin file

Parameters:

  • filepath (#to_s)

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/mb/core_ext/file.rb', line 19

def is_mb_plugin?(filepath)
  return false unless exists?(filepath)
  basename(filepath) == MB::Plugin::PLUGIN_FILENAME
end