Jifty

 view release on metacpan or  search on metacpan

lib/Jifty/Config.pm  view on Meta::CPAN

                ]
            },
            Web => {
                Port             => '8888',
                BaseURL          => 'http://localhost',
                DataDir          => "var/mason",
                StaticRoot       => "share/web/static",
                TemplateRoot     => "share/web/templates",
                ServeStaticFiles => 1,
                MasonConfig      => {
                    autoflush            => 0,
                    error_mode           => 'fatal',
                    error_format         => 'text',
                    default_escape_flags => 'h',
                },
                Globals => [],
                PSGIStatic => 1,
            },
        },
    };

    # Make sure to handle any %path% values we may have guessed
    return $self->_expand_relative_paths($guess);
}

=head2 initial_config

Returns a default guessed config for a new application.

See L<Jifty::Script::App>.

=cut

sub initial_config {
    my $self = shift;
    my $guess = $self->guess(@_);
    $guess->{'framework'}->{'ConfigFileVersion'} = 6;

    # These are the plugins which new apps will get by default
    $guess->{'framework'}->{'Plugins'} = [
        { AdminUI            => {}, },
        { CompressedCSSandJS => {}, },
        { ErrorTemplates     => {}, },
        { Halo               => {}, },
        { LetMe              => {}, },
        { OnlineDocs         => {}, },
        { REST               => {}, },
        { SkeletonApp        => {}, },
    ];

    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;

    my $version = $config->{'framework'}->{'ConfigFileVersion'};
    my $plugins = ($config->{'framework'}->{'Plugins'} ||= []);

    # This app configuration predates the plugin refactor
    if ($version < 2) {

        # These are the plugins which old apps expect because their
        # features used to be in the core.
        unshift (@{$plugins},
            { AdminUI            => {}, },
            { CompressedCSSandJS => {}, },
            { ErrorTemplates     => {}, },
            { Halo               => {}, },
            { OnlineDocs         => {}, },
            { REST               => {}, },
            { SkeletonApp        => {}, },
        );
    }

    if ($version < 3) {
        unshift (@{$plugins},
            { CSSQuery           => {}, }
        );
    }

    if ($version < 4) {
        unshift (@{$plugins},
            { Prototypism        => {}, }
        );
    }

    if ($version < 5) {
        unshift (@{$plugins},
            { Compat             => {}, }
        );

        push (@{$plugins},
            { Deflater           => {}, }
        );
    }

    return $config;
}

=head2 defaults

We have a couple default values that shouldn't be included in the
"guessed" config, as that routine is used when initializing a new 
application. Generally, these are platform-specific file locations.

=cut

sub defaults {
    my $self = shift;
    return {
        framework => {
            ConfigFileVersion => '1',



( run in 1.650 second using v1.01-cache-2.11-cpan-40ba7b3775d )