Class: Norn::PluginLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/norn/plugin_loader.rb

Class Method Summary collapse

Class Method Details

.load_allObject

Scans the top-level plugins/ directory for subdirectories and requires their plugin.rb entrypoint.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/norn/plugin_loader.rb', line 5

def load_all
  plugins_dir = File.expand_path("../../plugins", __dir__)
  return unless Dir.exist?(plugins_dir)

  # Iterate over all entries in the plugins folder
  Dir.glob(File.join(plugins_dir, "*")).each do |path|
    next unless File.directory?(path)

    plugin_entry = File.join(path, "plugin.rb")
    if File.exist?(plugin_entry)
      require plugin_entry
    end
  end
end