22 Nov 2021 22:52:12 UTC
- Distribution: RapidApp
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Testers (60 / 0 / 1)
- KwaliteeBus factor: 2
- % Coverage
- License: perl_5
- Perl: v5.10.0
- Activity24 month
- Download (2.29MB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:18 non-PAUSE usersVANSTYN Henry Van Styn
- Reverse dependencies
- CPAN Testers List
- Dependency graph
RapidApp::Manual::Bootstrap - Bootstrapping a new app with rapidapp.pl
RapidApp ships with the script rapidapp.pl which you can use to create a new application from scratch with a skeleton of base files and directories. It extends the existing catalyst.pl script and "helper" ecosystem, but with some RapidApp-specific customizations, including support for different helper "traits" to setup different common application scenarios out-of-the-box.
rapidapp.plwith no arguments will show its usage with basic examples:
The usage is exactly the same as
catalyst.plwith the exception of the additional
--helpersoption which can be used to specify a comma-separated list of helper traits which are essentially different modes of operation.
For example, the RapidDbic helper trait will automatically configure the new application to use the RapidDbic plugin, as well as create a DBIC model and schema for an existing database:
rapidapp.pl --helpers RapidDbic MyApp -- --dsn dbi:mysql:database=somedb,root,''
The arguments following the
--are processed by the specified helpers rather than the main script itself. In the case of the RapidDbic helper, the
--dsnparameter supplies the database connection info.
Not all helper traits are so complex. For instance, the "Templates" helper trait simply includes additional example configurations for RapidApp's built-in template functionality.
Multiple helpers can be used together. For example, the following will setup an application named "MyApp" with plugins to enable default user logins (default credentials:
admin/pass) saved views, example template controller configs, and generate a new SQLite database, model and schema from an existing DDL (i.e. native SQLite CREATE TABLE statements) file:
rapidapp.pl --helpers RapidDbic,Templates,AuthCore,NavCore MyApp \ -- --from-sqlite-ddl /path/to/existing/schema.sql
This documentation is still preliminary, however, the configs and files generated in the new app include additional comments and explanations. So, to learn more about a particular helper trait or config option, create a new app and look at its files (most everything is created within the main application class (i.e. MyApp.pm).
Also, since everything is based on Catalyst, its documentation which is much more thorough is a good place to start.
RapidApp also ships with rdbic.pl which can be used to generate and run a new CRUD app on-the-fly. It is essentially a single-use app which is regenerated each time it is ran. Files are generated into a temporary directory which is automatically cleaned up on exit.
# For a proper DSN rdbic.pl dbi:mysql:database=somedb,root,'' # For an SQLite file rdbic.pl /path/to/existing/sqlt.db
This is the fastest way to start a new app for a database, however, since the config is entirely generated, its obviously not as flexible. rdbic.pl is basically a general-purpose database admin utility, like PhpMyAdmin, Navicat, etc.
See the rdbic.pl documentation for more details.
The Plack-based interface Plack::App::RapidApp::rDbic is also available for generating a CRUD app on-the-fly which can be further configured and mounted within any PSGI/Plack configuration. rdbic.pl is simply a wrapper around Plack::App::RapidApp::rDbic which provides many more options and features than rdbic.pl exposes.