oss...@gmail.com
unread,Nov 20, 2009, 7:12:36 AM11/20/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tmcode...@googlegroups.com
Author: richard
Date: Fri Nov 20 04:12:36 2009
New Revision: 301
Log:
Small changes to support plugin loading outside of spine startup.
Modified:
spine/branches/spine_2_2-devel/lib/Spine/Registry.pm
Modified: spine/branches/spine_2_2-devel/lib/Spine/Registry.pm
==============================================================================
--- spine/branches/spine_2_2-devel/lib/Spine/Registry.pm Tue Nov 17 16:06:13 2009 (r300)
+++ spine/branches/spine_2_2-devel/lib/Spine/Registry.pm Fri Nov 20 04:12:36 2009 (r301)
@@ -410,13 +410,16 @@
return push @{ $self->{parameters} }, @_;
}
-
+# Wil normally register all plugins hooks based on profile.
+# if a plugin name is passed then it will register it's hooks
sub register_hooks
{
my $self = shift;
+ # optinal
+ my $plugin = shift;
my $registry = Spine::Registry->instance();
- unless ($self->{registered} == SPINE_NOTRUN) {
+ unless ($self->{registered} == SPINE_NOTRUN || defined $plugin) {
return $self->{registered};
}
@@ -425,13 +428,18 @@
# If we've already loaded our plugin lists, make sure we add populate
# this hook point's children
my $c = $registry->{CONFIG};
- # make sure there is something defined in the config, if not it's
- # not really an error just means ther user doesn't want anythign run
- unless (exists $c->{$c->{spine}->{Profile}}->{$self->{name}}) {
- return SPINE_SUCCESS;
+ my @modules;
+ if (defined $plugin) {
+ @modules = ($registry->find_plugin($plugin));
+ } else {
+ # make sure there is something defined in the config, if not it's
+ # not really an error just means ther user doesn't want anythign run
+ unless (exists $c->{$c->{spine}->{Profile}}->{$self->{name}}) {
+ return SPINE_SUCCESS;
+ }
+ @modules = $registry->find_plugin(split(/(?:\s*,?\s+)/,
+ $c->{$c->{spine}->{Profile}}->{$self->{name}}));
}
- my @modules = $registry->find_plugin(split(/(?:\s*,?\s+)/,
- $c->{$c->{spine}->{Profile}}->{$self->{name}}));
foreach my $module (@modules) {
unless ($self->install_hook($module, $registry->{PLUGINS}->{$module})) {