3 use Module::Runtime qw(use_module);
7 with 'App::SCS::Role::WithConfig';
9 has plugins => (is => 'ro', default => sub { [] });
11 has root_dir => (is => 'lazy');
15 io->dir(io->dir($self->config->{root_dir})->absolute);
18 has share_dir => (is => 'lazy');
20 sub _build_share_dir {
22 io->dir($self->config->{share_dir}||$self->root_dir->catdir('share'));
25 has page_plugin_config => (is => 'lazy');
27 sub _build_page_plugin_config {
32 my %map = map $_->page_plugins, reverse @{$self->plugins};
33 ref($_) or $_ = { class => $_, config => sub {} } for values %map;
38 map $_->default_page_plugins, @{$self->plugins}
43 has pages => (is => 'lazy');
47 return use_module('App::SCS::PageSet')->new(
48 base_dir => $self->share_dir->catdir('pages'),
49 plugin_config => $self->page_plugin_config,
53 has web => (is => 'lazy');
57 return use_module('App::SCS::Web')->new(
64 $self->load_plugin(Core => {});
65 my @plist = @{$self->config->{plugins}||[]};
66 while (my ($name, $conf) = splice @plist, 0, 2) {
67 $self->load_plugin($name, $conf);
72 my ($self, $name, $config) = @_;
73 my $class = ($name =~ s/^\+// ? $name : "App::SCS::Plugin::${name}");
76 use_module($class)->new(
101 foreach my $p (@{$self->plugins}) {
102 return if $p->run_cli($env);