Class: Ohai::Loader::PluginFile

Inherits:
Struct
  • Object
show all
Defined in:
lib/ohai/loader.rb

Overview

Simple struct like objects to track the path of a plugin and the root directory of plugins in which we found it. We don't care about the relative paths of v7 plugins, but in v6 plugins, dependencies are specified by calling `require_plugin` with a relative path. To manage this, we track the path and root of each file as we discover them so we can feed this into the v6 “dependency solver” as we load them.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#pathObject

Returns the value of attribute path


37
38
39
# File 'lib/ohai/loader.rb', line 37

def path
  @path
end

#plugin_rootObject

Returns the value of attribute plugin_root


37
38
39
# File 'lib/ohai/loader.rb', line 37

def plugin_root
  @plugin_root
end

Class Method Details

.find_all_in(plugin_dir) ⇒ Object

Finds all the *.rb files under the configured paths in :plugin_path


40
41
42
43
44
# File 'lib/ohai/loader.rb', line 40

def self.find_all_in(plugin_dir)
  Dir[File.join(plugin_dir, "**", "*.rb")].map do |file|
    new(file, plugin_dir)
  end
end