From 2c29c9c328cdabd7d61b913546f3f79c80b10f53 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sun, 17 Aug 2008 13:27:37 +0200 Subject: [PATCH] GitWebPlugin: reload Git constant on 'reload' --- plugins/gitweb.rb | 9 +++++++++ test/gitweb/plugin.rb | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/plugins/gitweb.rb b/plugins/gitweb.rb index 798dcb6..f7c9c24 100644 --- a/plugins/gitweb.rb +++ b/plugins/gitweb.rb @@ -2,6 +2,15 @@ class Gitweb < PluginBase + # Remove the "Git" constant and reload them + def before_reload + Object.class_eval do + remove_const "Git" + end + $".delete_if { |x| x =~ /^git/} + require 'git.rb' + end + def initialize(*args) $config.merge( 'plugins' => { diff --git a/test/gitweb/plugin.rb b/test/gitweb/plugin.rb index 1e4fe87..cab58a5 100644 --- a/test/gitweb/plugin.rb +++ b/test/gitweb/plugin.rb @@ -105,4 +105,16 @@ def test_accessible_local_repo assert(@irc.message) assert_equal("[tmptestgitdir HEAD]: -- First commit", @irc.message) end + + def test_reload_Git + class <