[Jifty-commit] r392 - jifty/trunk/lib/Jifty/Script

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Dec 26 00:30:58 EST 2005


Author: jesse
Date: Mon Dec 26 00:30:56 2005
New Revision: 392

Modified:
   /   (props changed)
   jifty/trunk/META.yml
   jifty/trunk/lib/Jifty/Script/Schema.pm

Log:
 r21755 at truegrounds:  jesse | 2005-12-26 00:29:23 -0500
 Updated pod for Jifty::Script::Schema. Now it passes tests
 


Modified: jifty/trunk/META.yml
==============================================================================
--- jifty/trunk/META.yml	(original)
+++ jifty/trunk/META.yml	Mon Dec 26 00:30:56 2005
@@ -1,5 +1,5 @@
 name: Jifty
-version: 0.51225
+version: 0.51225_01
 license: unknown
 distribution_type: module
 tests: t/*.t t/*/t/*.t

Modified: jifty/trunk/lib/Jifty/Script/Schema.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/Schema.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/Schema.pm	Mon Dec 26 00:30:56 2005
@@ -10,6 +10,13 @@
 use version;
 use Jifty::DBI::SchemaGenerator;
 
+=head2 options
+
+Returns a hash of all the options this script takes. (See the usage message for details)
+
+=cut
+
+
 sub options {
     return (
         "setup"             => "setup_tables",
@@ -22,14 +29,27 @@
     );
 }
 
+=head2 run
+
+Prints a help message if the users want it. If not, goes about its
+business.
+
+Sets up the environment, checks current database state, creates or deletes
+a database as necessary and then creates or updates your models' schema.
+
+
+
+=cut
+
+
 sub run {
     my $self = shift;
 
-    $self->check_usage();
+    $self->print_help();
     $self->setup_environment();
     $self->probe_database_existence();
     $self->manage_database_existence();
-    $self->setup_jifty_stuff();
+    $self->prepare_mode_classes();
     if ( $self->{create_all_tables} ) {
         $self->create_all_tables();
     } elsif ($self->{'setup_tables'}) {
@@ -39,6 +59,16 @@
     }
 }
 
+
+=head2 setup_environment
+
+If the user has specified an C<--include> flag or a path on the
+commandline, add it to the application's C<@INC>.  After that, get a
+minimal Jifty environment set up
+
+=cut
+
+
 sub setup_environment {
     my $self = shift;
 
@@ -53,7 +83,17 @@
 
 }
 
-sub check_usage {
+=head2 print_help
+
+Prints out help for the package using pod2usage.
+
+If the user specified --help, prints a brief usage message
+
+If the user specified --man, prints out a manpage
+
+=cut
+
+sub print_help {
     my $self = shift;
 
     # Option handling
@@ -63,7 +103,14 @@
         if $self->{man};
 }
 
-sub setup_jifty_stuff {
+=head2 prepare_mode_classes
+
+Reads in our application class from the config file, sets up a schema generator
+and finds all our app's models.
+
+=cut
+
+sub prepare_mode_classes {
 
     my $self = shift;
 
@@ -86,6 +133,14 @@
     );
 }
 
+
+=head2 probe_database_existence
+
+Probes our database to see if it exists and is up to date.
+
+=cut
+
+
 sub probe_database_existence {
     my $self = shift;
 
@@ -325,6 +380,16 @@
     }
 }
 
+
+=head2 manage_database_existence
+
+If the user wants the database created, creates the database. If the user wants 
+the old database deleted, does that too.
+
+
+=cut
+
+
 sub manage_database_existence {
     my $self     = shift;
     my $handle   = Jifty::Handle->new();


More information about the Jifty-commit mailing list