Module: Installation::Console::Plugins

Extended by:
Yast::Logger
Defined in:
src/lib/installation/console/plugins.rb,
src/lib/installation/console/plugins/console_button.rb

Overview

helper module for loading the console plugins

Defined Under Namespace

Classes: ConsoleButton, ConsoleButtonPlugin

Class Method Summary collapse

Class Method Details

.load_pluginsObject

load all console plugins from lib/installation/console/plugins subdirectory


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'src/lib/installation/console/plugins.rb', line 24

def self.load_plugins
  # use Yast.y2paths to honor the Y2DIR setting
  plugin_paths = Yast.y2paths.map { |p| File.join(p, "lib/installation/console/plugins") }
  plugin_paths.select { |p| File.directory?(p) }

  plugins = plugin_paths.each_with_object([]) do |p, obj|
    # find all *.rb files
    obj.concat(Dir[File.join(p, "*.rb")])
  end

  log.debug "All found plugins: #{plugins.inspect}"

  # remove the duplicates, this ensures the Y2DIR precedence
  plugins.uniq! do |f|
    File.basename(f)
  end

  plugins.each do |p|
    log.info "Loading plugin #{p}"
    require p
  end
end