actions plugin
[scpubgit/App-SCS.git] / lib / App / SCS / Plugin / Actions.pm
CommitLineData
ea38c46d 1package App::SCS::Plugin::Actions;
2
3use Module::Runtime qw(use_module);
4use IO::All;
5use Moo;
6
7with 'App::SCS::Role::Plugin';
8
9has mount_at => (is => 'ro', default => sub { 'actions' });
10
11has dispatcher => (is => 'lazy', builder => sub {
12 my ($self) = @_;
13 use_module('Plack::App::PSGIBin')->new(
14 root => io->dir($self->app->share_dir)->catdir('actions')
15 );
16});
17
18sub page_dispatchers {
19 my ($self) = @_;
20 my $base = $self->mount_at;
21 "/${base}/..." => sub { $self->dispatcher },
22}
23
24sub provides_pages {
25 my ($self) = @_;
26 return;
27}
28
291;