module Dradis::Plugins
Public Class Methods
Source
# File lib/dradis/plugins.rb, line 19 def clear_enabled_list @@enabled_list = nil end
Source
# File lib/dradis/plugins.rb, line 15 def enabled_list @@enabled_list ||= @@extensions.select(&:enabled?) end
Returns an array of modules representing currently enabled engines
Source
# File lib/dradis/plugins/gem_version.rb, line 4 def self.gem_version Gem::Version.new VERSION::STRING end
Returns the version of the currently loaded Frontend as a Gem::Version
Source
Source
# File lib/dradis/plugins.rb, line 36 def register(const) return if registered?(const) validate_plugin!(const) @@extensions << const end
Register a plugin with the framework
Example:
Dradis::Core::Plugins.register(Dradis::Core)
Source
# File lib/dradis/plugins.rb, line 56 def registered?(const) @@extensions.include?(const) end
Returns true if a plugin is currently registered with the framework
Example:
Dradis::Core::Plugins.registered?(Dradis::Core)
Source
# File lib/dradis/plugins.rb, line 48 def unregister(const) @@extensions.delete(const) end
Unregister a plugin from the framework
Example:
Dradis::Core::Plugins.unregister(Dradis::Core)
Source
# File lib/dradis/plugins.rb, line 60 def upload_integration_names_and_modules with_feature(:upload).each_with_object({}) do |integration, integrations_hash| integration_name = integration.plugin_name.to_s integration_module = integration.module_parent integrations_hash[integration_name] = integration_module end end
Source
# File lib/dradis/plugins/version.rb, line 7 def self.version gem_version end
Returns the version of the currently loaded Action Mailer as a Gem::Version
.
Source
# File lib/dradis/plugins.rb, line 25 def with_feature(feature) enabled_list.select do |plugin| # engine = "#{plugin}::Engine".constantize plugin.provides?(feature) end end
Filters the list of plugins and only returns those that provide the requested feature and enabled
Private Class Methods
Source
# File lib/dradis/plugins.rb, line 72 def validate_plugin!(const) # unless const.respond_to?(:root) && const.root.is_a?(Pathname) # raise InvalidEngineError, "Engine must define a root accessor that returns a pathname to its root" # end end
Use this to ensure the Extension conforms with some expected interface