Skip to content

Commit

Permalink
RapidAppify!
Browse files Browse the repository at this point in the history
  • Loading branch information
castaway committed Feb 24, 2016
1 parent 98227c7 commit 1d4f542
Show file tree
Hide file tree
Showing 16 changed files with 525 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This file documents the revision history for Perl extension AccessSystem.

0.01 2016-02-24 20:31:26
- initial revision, generated by Catalyst
25 changes: 25 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env perl
# IMPORTANT: if you delete this file your app will not work as
# expected. You have been warned.
use inc::Module::Install 1.02;
use Module::Install::Catalyst; # Complain loudly if you don't have
# Catalyst::Devel installed or haven't said
# 'make dist' to create a standalone tarball.

name 'AccessSystem';
all_from 'lib/AccessSystem.pm';

requires 'Catalyst::Runtime' => '5.90103';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
requires 'Moose';
requires 'namespace::autoclean';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
test_requires 'Test::More' => '0.88';
catalyst;

install_script glob('script/*.pl');
auto_install;
WriteAll;
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Run script/accesssystem_server.pl to test the application.
8 changes: 8 additions & 0 deletions accesssystem.psgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use strict;
use warnings;

use AccessSystem;

my $app = AccessSystem->apply_default_middlewares(AccessSystem->psgi_app);
$app;

10 changes: 10 additions & 0 deletions app.psgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BEGIN {
use Path::Class qw/file dir/;
$Bin = file($0)->parent->stringify; # Like FindBin
$lib = "$Bin/lib";
}

use lib $lib;

use Plack::Util;
Plack::Util::load_psgi("$Bin/accesssystem.psgi")
154 changes: 154 additions & 0 deletions lib/AccessSystem.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
package AccessSystem;
use Moose;
use namespace::autoclean;

use RapidApp 1.1005;

use Catalyst qw/
-Debug
RapidApp::RapidDbic
RapidApp::TabGui
RapidApp::AuthCore
RapidApp::CoreSchemaAdmin
RapidApp::NavCore
/;

extends 'Catalyst';

our $VERSION = '0.01';

__PACKAGE__->config(
name => 'AccessSystem',

'Plugin::RapidApp::RapidDbic' => {
dbic_models => ['AccessDB'],

# All custom configs optional...
configs => {
DB => {
grid_params => {
# ...
},
TableSpecs => {
# ...
}
},
OtherModel => {
# ...
}
}
},
# The TabGui plugin mounts the standard ExtJS explorer interface as the
# RapidApp root module (which is at the root '/' of the app by default)
'Plugin::RapidApp::TabGui' => {
title => "AccessSystem v$VERSION",
nav_title => 'Administration',
# Templates with the *.md extension render as simple Markdown:
dashboard_url => '/tple/site/dashboard.md',
# Make all templates in site/ (root/templates/site/) browsable in nav tree:
template_navtree_regex => '^site/'
},

# The general 'RapidApp' config controls aspects of the special components that
# are globally injected/mounted into the Catalyst application dispatcher:
'RapidApp' => {
## To change the root RapidApp module to be mounted someplace other than
## at the root (/) of the Catalyst app (default is '' which is the root)
#module_root_namespace => 'adm',

## To load additional, custom RapidApp modules (under the root module):
#load_modules => { somemodule => 'Some::RapidApp::Module::Class' }
},

# Customize the behaviors of the built-in "Template Controller" which is used
# to serve template files application-wide. Locally defined Templates, if present,
# are served from 'root/templates' (relative to the application home directory)
'Controller::RapidApp::Template' => {
# Templates ending in *.html can be accessed without the extension:
default_template_extension => 'html',

# Params to be supplied to the Template Access class:
access_params => {
# Make all template paths under site/ (root/templates/site/) editable:
writable_regex => '^site/',
creatable_regex => '^site/',
deletable_regex => '^site/',

## To declare templates under site/public/ (root/templates/site/public/)
## to be 'external' (will render in an iframe in the TabGui):
#external_tpl_regex => '^site/public/',
},

## To declare a custom template access class instead of the default (which
## is RapidApp::Template::Access). The Access class is used to determine
## exactly what type of access is allowed for each template/user, as well as
## which template variables should be available when rendering each template
## (Note: the access_params above are still supplied to ->new() ):
#access_class => 'AccessSystem::Template::Access',

## To directly serve templates from the application root (/) namespace for
## easy, public-facing content:
#root_template_prefix => 'site/public/page/',
#root_template => 'site/public/page/home',
},

# The AuthCore plugin automatically configures standard Catalyst Authentication,
# Authorization and Session plugins, using the RapidApp::CoreSchema database
# to store session and user databases. Opon first initialization, the default
# user 'admin' is created with default password 'pass'. No options are required
'Plugin::RapidApp::AuthCore' => {
#passphrase_class => 'Authen::Passphrase::BlowfishCrypt',
#passphrase_params => {
# cost => 14,
# salt_random => 1,
#}
},

# The CoreSchemaAdmin plugin automatically configures RapidDbic to provide access
# the system CoreSchema database. No options are required
'Plugin::RapidApp::CoreSchemaAdmin' => {
#
},

# The NavCore plugin automatically configures saved searches/views for
# RapidDbic sources. When used with AuthCore, each user has their own saved
# views in addition to system-wide saved views. No options are required.
'Plugin::RapidApp::NavCore' => {
#
},

);

# Start the application
__PACKAGE__->setup();

1;

__END__
=head1 NAME
AccessSystem - Catalyst/RapidApp based application
=head1 SYNOPSIS
script/accesssystem_server.pl
=head1 DESCRIPTION
[enter your description here]
=head1 SEE ALSO
L<RapidApp>, L<Catalyst>
=head1 AUTHOR
Catalyst developer
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
43 changes: 43 additions & 0 deletions lib/AccessSystem/Model/AccesDB.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package AccessSystem::Model::AccesDB;

use strict;
use base 'Catalyst::Model::DBIC::Schema';

__PACKAGE__->config(
schema_class => 'AccessSystem::Schema',

connect_info => {
dsn => 'dbi:SQLite:db/test.db',
user => '',
password => '',
}
);

=head1 NAME
AccessSystem::Model::AccesDB - Catalyst DBIC Schema Model
=head1 SYNOPSIS
See L<AccessSystem>
=head1 DESCRIPTION
L<Catalyst::Model::DBIC::Schema> Model using schema L<AccessSystem::Schema>
=head1 GENERATED BY
Catalyst::Helper::Model::DBIC::Schema - 0.65
=head1 AUTHOR
A clever guy
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut

1;
30 changes: 30 additions & 0 deletions script/accesssystem_cgi.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env perl

use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('AccessSystem', 'CGI');

1;

=head1 NAME
accesssystem_cgi.pl - Catalyst CGI
=head1 SYNOPSIS
See L<Catalyst::Manual>
=head1 DESCRIPTION
Run a Catalyst application as a CGI script.
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut

60 changes: 60 additions & 0 deletions script/accesssystem_create.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env perl

use strict;
use warnings;

use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('AccessSystem', 'Create');

1;

=head1 NAME
accesssystem_create.pl - Create a new Catalyst Component
=head1 SYNOPSIS
accesssystem_create.pl [options] model|view|controller name [helper] [options]
Options:
--force don't create a .new file where a file to be created exists
--mechanize use Test::WWW::Mechanize::Catalyst for tests if available
--help display this help and exits
Examples:
accesssystem_create.pl controller My::Controller
accesssystem_create.pl --mechanize controller My::Controller
accesssystem_create.pl view My::View
accesssystem_create.pl view HTML TT
accesssystem_create.pl model My::Model
accesssystem_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
dbi:SQLite:/tmp/my.db
accesssystem_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
[Loader opts like db_schema, naming] dbi:Pg:dbname=foo root 4321
[connect_info opts like quote_char, name_sep]
See also:
perldoc Catalyst::Manual
perldoc Catalyst::Manual::Intro
perldoc Catalyst::Helper::Model::DBIC::Schema
perldoc Catalyst::Model::DBIC::Schema
perldoc Catalyst::View::TT
=head1 DESCRIPTION
Create a new Catalyst Component.
Existing component files are not overwritten. If any of the component files
to be created already exist the file will be written with a '.new' suffix.
This behavior can be suppressed with the C<-force> option.
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
48 changes: 48 additions & 0 deletions script/accesssystem_fastcgi.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env perl

use Catalyst::ScriptRunner;
Catalyst::ScriptRunner->run('AccessSystem', 'FastCGI');

1;

=head1 NAME
accesssystem_fastcgi.pl - Catalyst FastCGI
=head1 SYNOPSIS
accesssystem_fastcgi.pl [options]
Options:
-? --help display this help and exit
-l --listen socket path to listen on
(defaults to standard input)
can be HOST:PORT, :PORT or a
filesystem path
-n --nproc specify number of processes to keep
to serve requests (defaults to 1,
requires --listen)
-p --pidfile specify filename for pid file
(requires --listen)
-d --daemon daemonize (requires --listen)
-M --manager specify alternate process manager
(FCGI::ProcManager sub-class)
or empty string to disable
-e --keeperr send error messages to STDOUT, not
to the webserver
--proc_title Set the process title (if possible)
=head1 DESCRIPTION
Run a Catalyst application as FastCGI.
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Loading

0 comments on commit 1d4f542

Please sign in to comment.