[Jifty-commit] r914 - in jifty/branches/jifty-jsan: . doc lib/Jifty/Manual

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Apr 24 15:35:54 EDT 2006


Author: trs
Date: Mon Apr 24 15:35:53 2006
New Revision: 914

Added:
   jifty/branches/jifty-jsan/doc/building_a_par
Modified:
   jifty/branches/jifty-jsan/   (props changed)
   jifty/branches/jifty-jsan/lib/Jifty/Logger.pm
   jifty/branches/jifty-jsan/lib/Jifty/Manual/Tutorial.pod
   jifty/branches/jifty-jsan/lib/Jifty/Notification.pm
   jifty/branches/jifty-jsan/lib/Jifty/Test.pm

Log:
 r9991 at zot (orig r906):  jesse | 2006-04-23 22:16:32 -0400
  r11799 at hualien:  jesse | 2006-04-23 14:26:36 -0400
  * Typo
 
 r9992 at zot (orig r907):  jesse | 2006-04-23 22:16:51 -0400
  r11820 at hualien:  jesse | 2006-04-23 22:15:51 -0400
  Jifty::Notification refactoring to not try to send mail to undef
 
 r9996 at zot (orig r911):  jesse | 2006-04-24 13:21:01 -0400
  r11828 at hualien:  jesse | 2006-04-23 23:47:28 -0400
  * Only blow away the database on test pass if we set one up in the first place
 
 r9997 at zot (orig r912):  jesse | 2006-04-24 13:21:37 -0400
  r11851 at hualien:  jesse | 2006-04-24 13:20:29 -0400
  * POD Updates from Eric Wilhelm
 
 r9998 at zot (orig r913):  jesse | 2006-04-24 13:30:26 -0400
  r11854 at hualien:  jesse | 2006-04-24 13:30:07 -0400
  * notes on making a par. they don't work yet
 


Added: jifty/branches/jifty-jsan/doc/building_a_par
==============================================================================
--- (empty file)
+++ jifty/branches/jifty-jsan/doc/building_a_par	Mon Apr 24 15:35:53 2006
@@ -0,0 +1,93 @@
+Incomplete instructions
+
+ $ pp `find lib/ -name \*pm |perl -ne '$_ =~ s/.pm$//;print "-M ". join("::",grep { ! /(?:lib|\-)/ } split("/",$_)) '`  -I lib bin/jifty
+use warnings;
+use strict;
+use Cwd qw(cwd);
+use Module::CoreList;
+use File::Copy;
+use File::Path qw(mkpath);
+use File::Spec::Functions qw(splitdir catfile catdir);
+use CPAN;
+use CPAN::Config;
+use YAML;
+use Time::Local;
+
+ at INC = grep {! /local/} @INC; # don't want cpan.pm to make decisions based locally installed modules;
+use vars qw/$INSTALLED $FAILED $SKIP_DEPS_FOR/;
+$INSTALLED     = {};
+$FAILED        = {};
+$SKIP_DEPS_FOR = { };
+process_cpan();
+
+sub process_cpan {
+
+    #    my $self = shift;
+    my $path = cwd();
+    my @modules = @ARGV;
+
+    # We install Scalar::Util first to break a scary dependency loop.
+    mkdir "$path/.cpan";
+    mkdir "$path/.cpan/build";
+    print join "\n", @modules, "\n";
+
+    unshift @INC, '$path/lib';
+    $ENV{'PERL5LIB'} = "$path/lib";
+
+    $CPAN::Config->{build_dir}            = "$path/.cpan/build";
+    $CPAN::Config->{cpan_home}            = "$path/.cpan/build";
+    $CPAN::Config->{histfile}             = "$path/.cpan/histfile;";
+    $CPAN::Config->{keep_source_where}    = "$path/.cpan/sources";
+    $CPAN::Config->{prerequisites_policy} = "follow";
+    $CPAN::Config->{makepl_arg}
+        = "PREFIX=$path PERL5LIB=$path/lib LIB=$path/lib INSTALLMAN1DIR=$path/man/man1 INSTALLMAN3DIR=$path/man/man3 INSTALLBIN=$path/bin INSTALLSCRIPT=$path/bin";
+    $CPAN::Config->{make_install_arg} =~ s/UNINST=1//;
+
+    my @objs = map { CPAN::Shell->expand( 'Module', $_ ) } @modules;
+    for my $i ( 0 .. $#objs ) {
+        delete $objs[$i]
+            if grep { $_->{RO}->{CPAN_FILE} eq $objs[$i]->{RO}->{CPAN_FILE} }
+            @objs[ $i + 1 .. $#objs ];
+    }
+
+    foreach my $mod (@modules) {
+
+        #foreach my $mod ( grep { defined $_ } @objs ) {
+        install_mod($mod);
+    }
+    print YAML::Dump($FAILED);
+}
+
+sub install_mod {
+    my $mod_name = shift;
+    my $version = shift;
+    my $mod = CPAN::Shell->expand( 'Module', $mod_name );
+    my $first_in = Module::CoreList->first_release($mod_name => $version);
+    if ( defined $first_in and $first_in <= 5.00803 ) { print "Skipping $mod_name. It's been core since $first_in\n"; return }
+    if ( $mod->distribution->isa_perl ) { print "Skipping $mod_name. It's only in the core. OOPS\n";return}
+    if ( $INSTALLED->{ $mod->cpan_file } ) { print "Skipping $mod_name. We've already installed it\n";return}
+
+    if ( $FAILED->{ $mod->cpan_file } >= 3 ) {
+        print YAML::Dump($INSTALLED);
+        print YAML::Dump($FAILED);
+
+        die "We've tried to install "
+            . $mod->distribution->as_string
+            . " twice";
+
+    }
+
+    # Install to local
+    unless ( $SKIP_DEPS_FOR->{$mod_name} ) {
+        $mod->make;
+        my $deps = $mod->distribution->prereq_pm;
+        foreach my $dep ( keys %$deps ) {
+            install_mod($dep => $deps->{$dep});
+        }
+    }
+    #$mod->force();
+    $mod->install;
+    $INSTALLED->{ $mod->cpan_file } = 1;
+}
+
+1;

Modified: jifty/branches/jifty-jsan/lib/Jifty/Logger.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Logger.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Logger.pm	Mon Apr 24 15:35:53 2006
@@ -9,7 +9,7 @@
 
 =head1 DESCRIPTION
 
-Uses L<Log4Perl> to log messages.  By default, logs all messages to
+Uses C<Log::Log4perl> to log messages.  By default, logs all messages to
 the screen.
 
 =cut
@@ -26,7 +26,7 @@
 object deals with logging for the system.
 
 Takes an optional name for this Jifty's logging "component" - See
-L<Log4Perl> for some detail about what that is.  It sets up a "warn"
+L<Log::Log4perl> for some detail about what that is.  It sets up a "warn"
 handler which logs warnings to the specified component.
 
 =cut

Modified: jifty/branches/jifty-jsan/lib/Jifty/Manual/Tutorial.pod
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Manual/Tutorial.pod	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Manual/Tutorial.pod	Mon Apr 24 15:35:53 2006
@@ -371,8 +371,16 @@
 Inside your applications F<web/templates> directory, create a directory called
 F<_elements>.
 
-Inside F<_elements>, open up a new file called C<nav> in your text editor
-and insert:
+  mkdir web/templates/_elements
+
+You may want to start with the stock jifty template, in which case you
+only need to add the C<< $top->child( Post... >> part
+
+  cat $(perl -MJifty::Util -e 'print Jifty::Util->share_root' \
+    )/web/templates/_elements/nav > web/templates/_elements/nav
+
+Otherwise, inside F<_elements>, open up a new file called C<nav> in your
+text editor and insert:
 
   <%init>
   my $top = Jifty->web->navigation;

Modified: jifty/branches/jifty-jsan/lib/Jifty/Notification.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Notification.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Notification.pm	Mon Apr 24 15:35:53 2006
@@ -80,28 +80,31 @@
 
 sub send_one_message {
     my $self = shift;
-    return unless my @recipients = $self->recipients;
-
+    my @recipients = $self->recipients;
+    my $to = join( ', ',
+      map { ( $_->can('email') ? $_->email : $_ ) } grep {$_} @recipients );
+     return unless ($to);
     my $message = Email::Simple->create(
-        header => [
-            From => $self->from || 'A Jifty Application <nobody>',
-            To   => join (', ', @recipients),
-            Subject => $self->subject || 'No subject',
-        ],
-        body => join ("\n", $self->preface, $self->body, $self->footer)
+      header => [
+        From => $self->from || 'A Jifty Application <nobody>',
+        To => $to,
+        Subject => $self->subject || 'No subject',
+      ],
+      body => join( "\n", $self->preface, $self->body, $self->footer )
     );
 
-    my $method = Jifty->config->framework('Mailer');
+    my $method   = Jifty->config->framework('Mailer');
     my $args_ref = Jifty->config->framework('MailerArgs');
     $args_ref = [] unless defined $args_ref;
 
-    my $sender = Email::Send->new({mailer => $method, mailer_args => $args_ref });
-    
+    my $sender
+      = Email::Send->new( { mailer => $method, mailer_args => $args_ref } );
+
     my $ret = $sender->send($message);
 
     unless ($ret) {
-        $self->log->error("Error sending mail: $ret");
-    } 
+      $self->log->error("Error sending mail: $ret");
+    }
 
     $ret;
 } 
@@ -173,7 +176,7 @@
 
 =head2 send
 
-Sends an indivual email to every user in L</to_list>; it does this by
+Sends an individual email to every user in L</to_list>; it does this by
 setting L</to> and L</recipient> to the first user in L</to_list>
 calling L<Jifty::Notification>'s C<send> method, and progressing down
 the list.
@@ -186,17 +189,9 @@
 sub send {
     my $self = shift;
 
-    if ($self->to) {
-        if ($self->to->can('email')) {
-            $self->recipients($self->to->email);
-        } else {
-            $self->recipients($self->to);
-        }
-        $self->send_one_message(@_);
-    }
-    for my $to ($self->to_list) {
+    for my $to ($self->to, $self->to_list) {
         $self->to($to);
-        $self->recipients($to->email);
+        $self->recipients($to);
         $self->send_one_message(@_);
     }
 }

Modified: jifty/branches/jifty-jsan/lib/Jifty/Test.pm
==============================================================================
--- jifty/branches/jifty-jsan/lib/Jifty/Test.pm	(original)
+++ jifty/branches/jifty-jsan/lib/Jifty/Test.pm	Mon Apr 24 15:35:53 2006
@@ -182,12 +182,14 @@
         unlink mailbox();
 
         # Remove testing db
-        Jifty->handle->disconnect() if (Jifty->handle);
+        if (Jifty->handle) {
+        Jifty->handle->disconnect();
         Log::Log4perl->get_logger("SchemaTool")->less_logging(3);
         my $schema = Jifty::Script::Schema->new;
         $schema->{drop_database} = 1;
         $schema->run;
         Log::Log4perl->get_logger("SchemaTool")->more_logging(3);
+        }
     }
 }
 


More information about the Jifty-commit mailing list