Module: Sensu::Extensions
- Defined in:
- lib/sensu/extensions.rb,
lib/sensu/extensions/loader.rb,
lib/sensu/extensions/constants.rb
Defined Under Namespace
Classes: Loader
Constant Summary collapse
- GEM_PREFIX =
Sensu Extension Rubygem prefix.
"sensu-extensions-".freeze
Class Method Summary collapse
-
.get(options = {}) ⇒ Loader
Retrieve the current loaded extensions loader or load one up if there isn’t one.
-
.load(options = {}) ⇒ Loader
Load Sensu extensions.
Class Method Details
.get(options = {}) ⇒ Loader
Retrieve the current loaded extensions loader or load one up if there isn’t one. Note: We may need to add a mutex for thread safety.
43 44 45 |
# File 'lib/sensu/extensions.rb', line 43 def get(={}) @loader || load() end |
.load(options = {}) ⇒ Loader
Load Sensu extensions.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/sensu/extensions.rb', line 14 def load(={}) @loader = Loader.new if [:extension_file] @loader.load_file([:extension_file]) end if [:extension_dir] @loader.load_directory([:extension_dir]) end if [:extension_dirs] [:extension_dirs].each do |directory| @loader.load_directory(directory) end end if [:extensions] [:extensions].each do |name, details| gem_name = details[:gem] || "#{GEM_PREFIX}#{name}" @loader.load_gem(gem_name, details[:version]) end end @loader.load_instances @loader end |