Class: RGitHook::Plugin
- Includes:
- RGitHook
- Defined in:
- lib/rgithook/plugin.rb
Defined Under Namespace
Classes: NoOptionError, Option, OptionGroup
Constant Summary
Constants included from RGitHook
Class Method Summary collapse
-
.load! ⇒ Object
Initialize Plugin system by including each plugin modules to the Module It also load the defaults from a yaml file.
-
.options ⇒ Object
- ::nodoc
-
Return raw options.
-
.options_to_hash ⇒ Object
Return a hash with the default options.
Class Method Details
.load! ⇒ Object
Initialize Plugin system by including each plugin modules to the Module It also load the defaults from a yaml file. You can change the default yaml file to load another file
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rgithook/plugin.rb', line 48 def self.load! @@plugins ||=[] @@plugins.each do |plugin| if defined?(plugin::RunnerMethods) Runner.class_eval do include plugin::RunnerMethods end end if defined?(plugin::GritCommit) ::Grit::Commit.class_eval do include plugin::GritCommit end end end end |
.options ⇒ Object
- ::nodoc
-
Return raw options
41 42 43 |
# File 'lib/rgithook/plugin.rb', line 41 def self. @@options end |
.options_to_hash ⇒ Object
Return a hash with the default options
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rgithook/plugin.rb', line 67 def self. = {} @@options.each do |plugin,| plugin_opts = {} .each do |option| plugin_opts[option.name]=option.default.is_a?(OptionGroup) ? option.default. : option.default end [plugin]=plugin_opts end end |