[Rt-commit] rt branch, development, updated. 34eaf1a2fdef1a1f4c4e2763561b90ed8154dfe7

Thomas Sibley trs at bestpractical.com
Thu Jun 24 15:37:16 EDT 2010


The branch, development has been updated
       via  34eaf1a2fdef1a1f4c4e2763561b90ed8154dfe7 (commit)
       via  3f11fb0077a1094136b686e14f5b0c9a0c558619 (commit)
      from  781817eb8cc85b4f18c4369e5edaebc4a41f8329 (commit)

Summary of changes:
 app.psgi                   |    3 +++
 etc/config.yml             |    4 +++-
 lib/RT.pm                  |   17 +++++++++++++++++
 lib/RT/View/SetupWizard.pm |   29 +++++++++++++++++++++++------
 4 files changed, 46 insertions(+), 7 deletions(-)
 create mode 100644 app.psgi

- Log -----------------------------------------------------------------
commit 3f11fb0077a1094136b686e14f5b0c9a0c558619
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jun 24 15:11:55 2010 -0400

    Add a basic PSGI app definition

diff --git a/app.psgi b/app.psgi
new file mode 100644
index 0000000..ff05fb1
--- /dev/null
+++ b/app.psgi
@@ -0,0 +1,3 @@
+use Jifty;
+Jifty->new;
+Jifty->handler->psgi_app;

commit 34eaf1a2fdef1a1f4c4e2763561b90ed8154dfe7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jun 24 15:38:11 2010 -0400

    Restart the app after we configure the database

diff --git a/etc/config.yml b/etc/config.yml
index 37e2a0b..a953e28 100644
--- a/etc/config.yml
+++ b/etc/config.yml
@@ -7,11 +7,13 @@ framework:
   ApplicationUUID: EAFC6FF2-5E8D-11DC-9FAD-91A9684ED971
   ConfigFileVersion: 4
   Database: 
+    # This lets the setup wizard reconfig the database and reload it
+    AutoUpgrade: 1
     CheckSchema: 0
     Database: rt4
     Driver: SQLite
     Host: localhost
-    Password: ''
+    Password: ""
     RecordBaseClass: Jifty::DBI::Record::Cachable
     User: root
     Version: 0.0.1
diff --git a/lib/RT.pm b/lib/RT.pm
index 8e0d1fa..ed10b11 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -72,6 +72,23 @@ A fully featured request tracker package
 
 =head2 INITIALIZATION
 
+=head2 start 
+
+Initializes and starts up RT.  This is called by Jifty internally and is the
+right place for startup logic.
+
+=head2 restart
+
+Called when restarting RT without shutting down.  Currently only used by the
+setup wizard.  This takes care of refreshing the L<RT::Model::Config> object we
+keep around.
+
+=cut
+
+sub restart {
+    RT->load_config;
+}
+
 =head2 load_config
 
 Load RT's config file.  First, the site configuration file
diff --git a/lib/RT/View/SetupWizard.pm b/lib/RT/View/SetupWizard.pm
index 6e85f1b..8d9792d 100644
--- a/lib/RT/View/SetupWizard.pm
+++ b/lib/RT/View/SetupWizard.pm
@@ -84,8 +84,10 @@ template 'database' => setup_page {
     h2 { _("Configure your database") };
     
     show 'database_widget';
-    # need to reload config here too, before the next page!
-    show 'buttons', prev => 'index.html', next => 'root';
+
+    # We need to restart here so that further changes to the DB get to the
+    # right place
+    show 'buttons', prev => 'index.html', next => 'root', restart => 1;
 };
 
 template 'root' => setup_page {
@@ -147,10 +149,25 @@ private template 'buttons' => sub {
         as_button => 1,
     );
 
-    form_submit(
-        url     => $self->fragment_for($args{'next'}),
-        label   => 'Next step',
-    );
+    if ( $args{'restart'} ) {
+        Jifty->log->debug("Restarting the server before next setup wizard step");
+        my $restart = new_action(
+            class     => 'Jifty::Plugin::Config::Action::Restart',
+            moniker   => 'restart-jifty',
+            order     => 90
+        );
+        render_param(
+            $restart      => 'url',
+            default_value => $self->fragment_for($args{'next'})
+        );
+        form_submit( label => 'Next step' );
+    }
+    else {
+        form_submit(
+            url     => $self->fragment_for($args{'next'}),
+            label   => 'Next step',
+        );
+    }
 };
 
 1;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list