Class: RGitHook::Plugin

Inherits:
Object show all
Includes:
RGitHook
Defined in:
lib/rgithook/plugin.rb

Direct Known Subclasses

CommitDB, Custom, Email, Rake, TestSuite, Temp, Twitter

Defined Under Namespace

Classes: NoOptionError, Option, OptionGroup

Constant Summary

Constants included from RGitHook

HOOKS

Class Method Summary collapse

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

.optionsObject

::nodoc

Return raw options



41
42
43
# File 'lib/rgithook/plugin.rb', line 41

def self.options
   @@options
end

.options_to_hashObject

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_to_hash
   options = {}
   @@options.each do |plugin,plugin_options|
      plugin_opts = {}
      plugin_options.each do |option|
         plugin_opts[option.name]=option.default.is_a?(OptionGroup) ? option.default.options_to_hash : option.default
      end
      options[plugin]=plugin_opts
   end
   options
end