The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CatalystX::Features - Merges different application directories into your app.

VERSION

version 0.10

SYNOPSIS

        package MyApp;
        use Catalyst qw/-Debug
                +CatalystX::Features
                +CatalystX::Features::Lib
                +CatalystX::Features::Plugin::ConfigLoader
                +CatalystX::Features::Plugin::Static::Simple/;

DESCRIPTION

The idea fo this module is to make it easier to spread out outside of the main application directory, in the spirit of Eclipse features and Ruby on Rails plugins.

It's mainly useful if you're working on a large application with distinct isolated features that are not tightly coupled with the main app and could be pulled off or eventually reused somewhere else.

It also comes handy in a large project, with many developers working on specific application parts. And, say, you wish to split the functionality in diretories, or just want to keep them out of the application core files.

USAGE

  • Create a directory under your app home named /features

            mkdir /MyApp/features/
  • Each feature home dir should be named something like:

            /MyApp/features/my.demo.feature_1.0.0

It's a split on underscore _, the first part is the feature name, the second is the feature version.

Also splits on a dash -, allowing the feature to be named like Feature-0.9123.

If a higher version of a feature is found, that's the one to be used, the rest is ignored - a feature without a version is ok, it will be the highest version available - good for local dev and pushing to a repository. - a debug box is printed on startup, so you can check which version is running:

        [debug] Features Loaded:
        .----------------------------------------+------------------------+----------.
        | Home                                   | Name                   | Version  |
        +----------------------------------------+------------------------+----------+
        | simple.feature_1.0.0                   | simple.feature         | 1.0.0    |
        .-----------------------------------------------------------------+----------.

CONFIGURATION

home

Let's you set a list of directories where your features are located. It expects full paths.

        <CatalystX::Features>
                home /opt/myapp_features
                home /somewhere/else
        </CatalystX::Features>

Defaults to:

        MyApp/features

backend_class

Sets an alternative class to use as a backend. The default is CatalystX::Features::Backend.

        <CatalystX::Features>
                backend_class MyApp::Features
        </CatalystX::Features>

feature_class

Sets an alternative class to represent a single feature. The default is CatalystX::Features::Feature. This class should implement the role CatalystX::Features::Role::Feature.

        <CatalystX::Features>
                feature_class MyApp::Feature
        </CatalystX::Features>

METHODS

$c->setup

The plugin setup method. Loads features and prints the feature configuration table.

$c->features

Returns the feature backend object.

$c->features->list

Returns an array of loaded features, which are instances of the CatalystX::Features::Feature class.

$c->features_setup

Does the dirty setup work. Called from various CatalystX::Features::Plugin::* to make sure features are loaded.

TODO

These things here, and many, many more that I can't recall right now.

  • Check dependencies among features.

  • More plugins.

  • Deploy PAR/ZIP files automatically.

  • Delayed initialization into INC

AUTHORS

        Rodrigo de Oliveira (rodrigolive), C<rodrigolive@gmail.com>

LICENSE

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.