extends 'Bread::Board::Container';
+has flags => (
+ is => 'ro',
+ isa => 'ArrayRef',
+ default => sub { [] },
+);
+
has config_local_suffix => (
is => 'ro',
isa => 'Str',
config_local_suffix
config_path
locate_components
+ flags
+ home
+ root_dir
/;
my $config = $self->resolve( service => 'config' );
);
}
+sub build_flags_service {
+ my $self = shift;
+
+ return Bread::Board::Literal->new(
+ lifecycle => 'Singleton',
+ name => 'flags',
+ value => $self->get_flags,
+ );
+}
+
+sub get_flags {
+ my $self = shift;
+ my $flags = {};
+
+ foreach (@{ $self->flags }) {
+ if (/^-Debug$/) {
+ $flags->{log} =
+ ( $flags->{log} ) ? 'debug,' . $flags->{log} : 'debug';
+ }
+ elsif (/^-(\w+)=?(.*)$/) {
+ $flags->{ lc $1 } = $2;
+ }
+ else {
+ push @{ $flags->{plugins} }, $_;
+ }
+ }
+
+ return $flags;
+}
+
sub build_home_service {
my $self = shift;
lifecycle => 'Singleton',
name => 'home',
block => sub {
- my $self = shift;
+ my $self = shift;
my $class = $self->param('catalyst_application');
- my $home;
if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
- $home = $env;
+ return $env;
}
- $home ||= Catalyst::Utils::home($class);
- return $home;
+ if ( my $home = $self->param('flags')->{home} ) {
+ return $home;
+ }
+
+ return Catalyst::Utils::home($class);
},
- dependencies => [ depends_on('catalyst_application') ],
+ dependencies => [ depends_on('flags'), depends_on('catalyst_application') ],
);
}
Name of the application (such as MyApp).
+=head2 build_home_service
+
+The application home directory. All the files (including classes, scripts, etc)
+created for this application are in this directory, or in a sub-directory below
+this one.
+
+=head2 build_root_dir_service
+
+Inside the application home (as explained in L</build_home_service>), there is
+a root directory. This is where all templates and static files are.
+
=head2 build_driver_service
Config options passed directly to the driver being used.