[Jifty-commit] r2783 - in jifty/branches/virtual-models: . lib/Jifty lib/Jifty/Record t/TestApp-DatabaseBackedModels/lib/TestApp/DatabaseBackedModels

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Feb 10 20:22:46 EST 2007


Author: jesse
Date: Sat Feb 10 20:22:46 2007
New Revision: 2783

Modified:
   jifty/branches/virtual-models/   (props changed)
   jifty/branches/virtual-models/Makefile.PL
   jifty/branches/virtual-models/lib/Jifty.pm
   jifty/branches/virtual-models/lib/Jifty/Record/Versioned.pm
   jifty/branches/virtual-models/lib/Jifty/Test.pm
   jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/lib/TestApp/DatabaseBackedModels/Bootstrap.pm

Log:
 r21981 at hualien:  jesse | 2007-02-10 20:21:28 -0500
 * Load the logger as soon as possible.
 * Require the required version of YAML
 * Refactor Jifty->new () a bit to isolate loading of things better


Modified: jifty/branches/virtual-models/Makefile.PL
==============================================================================
--- jifty/branches/virtual-models/Makefile.PL	(original)
+++ jifty/branches/virtual-models/Makefile.PL	Sat Feb 10 20:22:46 2007
@@ -72,11 +72,11 @@
 
 if (can_cc()) {
     # Always require the Syck bindings if a C compiler is available
-    requires('YAML::Syck' => 0.71);
+    requires('YAML::Syck' => 0.82);
     requires('JSON::Syck' => 0.15);
 }
 else {
-    requires('YAML' => 0.35) unless can_use('YAML::Syck' => 0.71);
+    requires('YAML' => 0.60) unless can_use('YAML::Syck' => 0.82);
     requires('JSON' => 0.01) unless can_use('JSON::Syck' => 0.15);
 }
 

Modified: jifty/branches/virtual-models/lib/Jifty.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty.pm	Sat Feb 10 20:22:46 2007
@@ -116,6 +116,9 @@
     # Load the configuration. stash it in ->config
     Jifty->config( Jifty::Config->new() );
 
+    # Turn on logging as soon as we possibly can.
+    Jifty->logger( Jifty::Logger->new( $args{'logger_component'} ) );
+
     # Create the Jifty classloader
     Jifty::ClassLoader->new( base => 'Jifty' );
 
@@ -128,17 +131,8 @@
     Jifty::Util->require( $record_base_class );
     push @Jifty::Record::ISA, $record_base_class unless $record_base_class eq 'Jifty::Record';
 
-    Jifty->logger( Jifty::Logger->new( $args{'logger_component'} ) );
-
     # Set up plugins
-    my @plugins;
-    for my $plugin (@{Jifty->config->framework('Plugins')}) {
-        my $class = "Jifty::Plugin::".(keys %{$plugin})[0];
-        my %options = %{ $plugin->{(keys %{$plugin})[0]} };
-        Jifty::Util->require($class);
-        Jifty::ClassLoader->new(base => $class)->require;
-        push @plugins, $class->new(%options);
-    }
+    my @plugins = Jifty->_load_plugins();
 
     Jifty->plugins(@plugins);
 
@@ -153,10 +147,8 @@
 
     Jifty->class_loader($class_loader);
     Jifty->class_loader->require;
-
     Jifty->handler(Jifty::Handler->new());
     Jifty->api(Jifty::API->new());
-
     # Let's get the database rocking and rolling
     Jifty->setup_database_connection(%args);
     Jifty->class_loader->require_classes_from_database() if (Jifty->handle() and not $args{'no_handle'});
@@ -166,7 +158,6 @@
     my $app = Jifty->app_class;
     
     $app->start() if $app->can('start');
-    
 }
 
 =head2 config
@@ -306,6 +297,18 @@
 
 =cut
 
+sub _load_plugins {
+    my @plugins;
+    for my $plugin (@{Jifty->config->framework('Plugins')}) {
+        my $class = "Jifty::Plugin::".(keys %{$plugin})[0];
+        my %options = %{ $plugin->{(keys %{$plugin})[0]} };
+        Jifty::Util->require($class);
+        Jifty::ClassLoader->new(base => $class)->require;
+        push @plugins, $class->new(%options);
+    }
+}
+
+
 sub plugins {
     my $class = shift;
     @PLUGINS = @_ if @_;

Modified: jifty/branches/virtual-models/lib/Jifty/Record/Versioned.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Record/Versioned.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Record/Versioned.pm	Sat Feb 10 20:22:46 2007
@@ -54,7 +54,7 @@
     $uri =~ s{^|\\}{/}g if ($^O eq 'MSWin32');
     $uri = "file://$uri";
 
-    print STDERR "*** Created Subversion Repository:\n    $uri\n\n";
+    $self->log->info( "*** Created Subversion Repository: $uri");
 
     $fs = $repos->fs;
 

Modified: jifty/branches/virtual-models/lib/Jifty/Test.pm
==============================================================================
--- jifty/branches/virtual-models/lib/Jifty/Test.pm	(original)
+++ jifty/branches/virtual-models/lib/Jifty/Test.pm	Sat Feb 10 20:22:46 2007
@@ -141,13 +141,11 @@
     rmtree([ File::Spec->canonpath("$root/var/mason") ], 0, 1);
 
     Jifty->new( no_handle => 1 );
-
     my $schema = Jifty::Script::Schema->new;
     $schema->{drop_database} =
       $schema->{create_database} =
         $schema->{create_all_tables} = 1;
     $schema->run;
-
     Jifty->new();
     $class->setup_mailbox;
 }

Modified: jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/lib/TestApp/DatabaseBackedModels/Bootstrap.pm
==============================================================================
--- jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/lib/TestApp/DatabaseBackedModels/Bootstrap.pm	(original)
+++ jifty/branches/virtual-models/t/TestApp-DatabaseBackedModels/lib/TestApp/DatabaseBackedModels/Bootstrap.pm	Sat Feb 10 20:22:46 2007
@@ -4,7 +4,6 @@
 use base 'Jifty::Bootstrap';
 
 sub run { 
-
     my $user = TestApp::DatabaseBackedModels::CurrentUser->new( _bootstrap => 1);
     my $modelclass = Jifty::Model::ModelClass->new(current_user => $user);
     $modelclass->create( name => 'Widget');


More information about the Jifty-commit mailing list