[Jifty-commit] r3320 - in jifty/trunk: lib/Jifty lib/Jifty/Script
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jun 1 23:08:30 EDT 2007
Author: jesse
Date: Fri Jun 1 23:08:30 2007
New Revision: 3320
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Config.pm
jifty/trunk/lib/Jifty/Script/App.pm
Log:
r57857 at pinglin: jesse | 2007-06-01 23:06:56 -0400
* add a config file version, so we can change old defaults.
Modified: jifty/trunk/lib/Jifty/Config.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Config.pm (original)
+++ jifty/trunk/lib/Jifty/Config.pm Fri Jun 1 23:08:30 2007
@@ -155,6 +155,9 @@
# getting stuck in a default config file for an app
$self->stash( Hash::Merge::merge( $self->defaults, $self->stash));
+ $self->stash($self->update_config($self->stash));
+
+
# Finally, check for global postload hooks (these are used by the
# test harness)
$self->$Jifty::Config::postload()
@@ -264,16 +267,6 @@
L10N => {
PoDir => "share/po",
},
- Plugins => [
- # { LetMe => {}, },
- { SkeletonApp => {}, },
- { REST => {}, },
- { Halo => {}, },
- { ErrorTemplates => {}, },
- { OnlineDocs => {}, },
- { CompressedCSSandJS => {}, },
- { AdminUI => {}, }
- ],
Web => {
Port => '8888',
BaseURL => 'http://localhost',
@@ -297,6 +290,58 @@
}
+=head2 initial_config
+
+Returns a default guessed config for a new application
+
+=cut
+
+sub initial_config {
+ my $self = shift;
+ my $guess = $self->guess(@_);
+ $guess->{'framework'}->{'ConfigFileVersion'} = 2;
+ $guess->{'framework'}->{'Plugins'} = [
+ { LetMe => {}, },
+ { SkeletonApp => {}, },
+ { REST => {}, },
+ { Halo => {}, },
+ { ErrorTemplates => {}, },
+ { OnlineDocs => {}, },
+ { CompressedCSSandJS => {}, },
+ { AdminUI => {}, }
+ ];
+ return $guess;
+}
+
+
+
+=head2 update_config $CONFIG
+
+Takes an application's configuration as a hashref. Right now, it just sets up
+plugins that match an older jifty version's defaults
+
+=cut
+
+sub update_config {
+ my $self = shift;
+ my $config = shift;
+ if ( $config->{'framework'}->{'ConfigFileVersion'} <2) {
+ unshift (@{$config->{'framework'}->{'Plugins'}},
+ { SkeletonApp => {}, },
+ { REST => {}, },
+ { Halo => {}, },
+ { ErrorTemplates => {}, },
+ { OnlineDocs => {}, },
+ { CompressedCSSandJS => {}, },
+ { AdminUI => {}, }
+ );
+ }
+
+ return $config;
+}
+
+
+
=head2 defaults
We have a couple default values that shouldn't be included in the
@@ -309,6 +354,7 @@
my $self = shift;
return {
framework => {
+ ConfigFileVersion => '1',
L10N => {
DefaultPoDir => Jifty::Util->share_root . '/po',
},
Modified: jifty/trunk/lib/Jifty/Script/App.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/App.pm (original)
+++ jifty/trunk/lib/Jifty/Script/App.pm Fri Jun 1 23:08:30 2007
@@ -147,7 +147,7 @@
sub _write_config {
my $self = shift;
my $cfg = Jifty::Config->new(load_config => 0);
- my $default_config = $cfg->guess($self->dist_name);
+ my $default_config = $cfg->initial_config($self->dist_name);
my $file = join("/",$self->prefix, 'etc','config.yml');
print("Creating configuration file $file\n");
Jifty::YAML::DumpFile($file => $default_config);
More information about the Jifty-commit
mailing list