App-CatalystStarter-Bloated
view release on metacpan or search on metacpan
lib/App/CatalystStarter/Bloated.pm view on Meta::CPAN
Log::Log4perl->easy_init($FATAL);
}
elsif ($ARGV{'--debug'}) {
Log::Log4perl->easy_init($DEBUG);
}
else {
Log::Log4perl->easy_init($INFO);
}
l->debug( "Log level set to DEBUG" );
}
## related test files are listed at the closing } of each sub
## a helper for easy access to paths
sub _catalyst_path {
my $what = shift;
my @extra;
if ( $what eq "C" ) {
@extra = ("lib", $ARGV{"--name"}, "Controller");
}
elsif ( $what eq "M" ) {
@extra = ("lib", $ARGV{"--name"}, "Model");
}
elsif ( $what eq "V" ) {
@extra = ("lib", $ARGV{"--name"}, "View");
}
elsif ( $what eq "TT" ) {
@extra = ("lib", $ARGV{"--name"}, "View", $ARGV{"--TT"}.".pm");
@_ = ();
}
elsif ( $what eq "JSON" ) {
@extra = ("lib", $ARGV{"--name"}, "View", $ARGV{"--JSON"}.".pm");
@_ = ();
}
else {
@extra = ($what);
}
return path($cat_dir,@extra,@_)->absolute;
} ## catalyst_path.t
sub _set_cat_dir {
$cat_dir = $_[0] if defined $_[0];
return $cat_dir;
}
sub _creater {
my($s) = path($cat_dir, "script")->children(qr/create\.pl/);
l->debug("located creater script $s" );
return $s;
} ## creater.t
sub _run_system {
my @args = @_;
my @args_to_show = @args;
my ($o,$e,$r);
## hide db password:
if (
$args_to_show[0] =~ /_create\.pl$/ and
$args_to_show[1] eq "model"
) {
$args_to_show[8] = "<secret>" if
defined $args_to_show[8] and
$args_to_show[8] ne "";
}
if ( $ARGV{"--verbose"} ) {
l->debug("system call [verbose]: @args_to_show");
$r = system @args;
}
else {
l->debug("system call: @args_to_show");
($o,$e,$r) = capture { system @args };
}
## some known sdterr lines we do not show:
if ($e) {
my @e = split /\n/, $e;
my @e2 = @e;
@e2 = grep !/^Dumping manual schema for/, @e2;
@e2 = grep !/^Schema dump completed\./, @e2;
@e2 = grep !m{^Cannot determine perl version info from lib/.*\.pm}, @e2;
## hide all if we're testing non-verbosely
@e2 = () if "@args" eq "make test" and not $ARGV{'--verbose'};
print $_,"\n" for @e2;
}
if ( $r ) {
l->fatal( "system call died. It definitely shouldn't have." );
l->fatal( "command was: @args_to_show" );
}
}
sub _finalize_argv {
my $dsn_0 = $ARGV{'--dsn'};
## some booleans default on
if ( not $ARGV{'--nodsnfix'} ) {
$ARGV{'--dsnfix'} = $ARGV{'-dsnfix'} = 1
}
if ( not $ARGV{'--nopgpass'} ) {
$ARGV{'--pgpass'} = $ARGV{'-pgpass'} = 1
}
## defaults done
## html5 sets TT
if ($ARGV{'--html5'}) {
$ARGV{'-TT'} //= "HTML";
$ARGV{'--TT'} //= "HTML";
}
## views triggers json and tt
if ( $ARGV{'--views'} ) {
lib/App/CatalystStarter/Bloated.pm view on Meta::CPAN
## 3: Make model
_mk_model;
## 4: setup html template
_mk_html5;
## 5: test new catalyst
_test_new_cat;
l->info( "Catalyst setup done" );
}
1; # Magic true value required at end of module
__END__
=encoding utf8
=head1 NAME
App::CatalystStarter::Bloated - Creates a catalyst app, a TT view, a model and a HTML5 wrapper template from initalizr.com.
=head1 VERSION
This document describes App::CatalystStarter::Bloated version 0.9.3
=head1 SYNOPSIS
# dont use this module, use the installed script
# catalyst-fatstart.pl instead
=head1 DESCRIPTION
This distribution provides an alternative script to start catalyst
projects: catalyst-fatstart.pl
This script takes a number of options, see catalyst-fatstart.pl
--usage , --man and --help
In short it does the following:
=over
=item *
Calls catalyst.pl to create the catalyst project
=item *
Sets up a TT view as ::HTML and a JSON view as ::JSON
=item *
If given a --dsn, runs create model and provides default names
for schema and model classes.
=item *
If using a dbi:Pg dsn, looks in your ~/.pgpass to find usernames
and passwords and even intelligently completes your dsn if you are
missing hostname and or port.
=item *
Sets up a TT wrapper based on a HTML5 template intializr.com and
points its css, js images and fonts to /static
=back
=head1 INTERFACE
=head2 run
The function that does it all.
=head1 DIAGNOSTICS
Will come in next version
=head1 CONFIGURATION AND ENVIRONMENT
App::CatalystStarter::Bloated requires no configuration files or environment variables.
=head1 DEPENDENCIES
Several. Makefile/Build should take care of them.
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to
C<bug-app-catalyststarter-bloated@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.
=head1 SEE ALSO
L<Catalyst::Runtime>
=head1 AUTHOR
Torbjørn Lindahl C<< <torbjorn.lindahl@gmail.com> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2014, Torbjørn Lindahl C<< <torbjorn.lindahl@gmail.com> >>. All rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
( run in 0.809 second using v1.01-cache-2.11-cpan-5b529ec07f3 )