[Rt-commit] rt branch, runtime-plugin, updated. rt-3.9.4-162-g97d3b2e
Chia-liang Kao
clkao at bestpractical.com
Mon Oct 18 08:46:07 EDT 2010
The branch, runtime-plugin has been updated
via 97d3b2e50f358156b6dc2f9a8f1cf92b7630c30a (commit)
from d8846f9b889d6b61117624ed0db50a08c1b85bac (commit)
Summary of changes:
lib/RT/Plugin.pm | 6 +++++-
t/plugins/api.t | 8 +++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit 97d3b2e50f358156b6dc2f9a8f1cf92b7630c30a
Author: Chia-liang Kao <clkao at bestpractical.com>
Date: Mon Oct 18 21:44:35 2010 +0900
inc path maintenance
diff --git a/lib/RT/Plugin.pm b/lib/RT/Plugin.pm
index 410d8fa..d0f6fba 100644
--- a/lib/RT/Plugin.pm
+++ b/lib/RT/Plugin.pm
@@ -80,13 +80,17 @@ sub new {
else {
push @INC, $add;
}
+ $self->{_added_inc_path} = $add;
return $self;
}
sub DESTROY {
my $self = shift;
-
+ my $inc_path = first_index { Cwd::realpath($_) eq $self->{_added_inc_path} } @INC;
+ if ($inc_path >= 0 ) {
+ splice(@INC, $inc_path, 1);
+ }
}
=head2 Name
diff --git a/t/plugins/api.t b/t/plugins/api.t
index b97940d..f666ee5 100644
--- a/t/plugins/api.t
+++ b/t/plugins/api.t
@@ -5,7 +5,7 @@ use File::Basename qw(basename dirname);
require RT;
$RT::PluginPath = abs_path(dirname($0)).'/_plugins';
-use RT::Test nodb => 1, tests => 5;
+use RT::Test nodb => 1, tests => 7;
is_deeply([RT->PluginDirs('lib')], []);
ok(!grep { $_ eq "$RT::PluginPath/Hello/lib" } @INC);;
@@ -20,3 +20,9 @@ require RT::Interface::Web::Handler;
is_deeply({RT::Interface::Web::Handler->DefaultHandlerArgs}->{comp_root}[1],
['plugin-Hello', $RT::PluginPath.'/Hello/html']);
+
+# reset
+RT->Config->Set('Plugins',qw());
+RT->InitPluginPaths;
+ok(!grep { $_ eq "$RT::PluginPath/Hello/lib" } @INC);
+is({RT::Interface::Web::Handler->DefaultHandlerArgs}->{comp_root}[1][0],'standard');
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list