Amon2-Setup-Flavor-Teng
view release on metacpan or search on metacpan
lib/Amon2/Setup/Flavor/Teng.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
package Amon2::Setup::Flavor::Teng;
use parent qw(Amon2::Setup::Flavor);
our $VERSION = '0.05';
sub run {
my $self = shift;
$self->write_file('lib/<<PATH>>.pm', <<'...');
package <% $module %>;
use strict;
use warnings;
use utf8;
use parent qw/Amon2/;
use 5.008001;
__PACKAGE__->load_plugin(qw/DBI/);
# initialize database
use DBI;
sub setup_schema {
my $self = shift;
my $dbh = $self->dbh();
lib/Amon2/Setup/Flavor/Teng.pm view on Meta::CPAN
return $self->{db};
}
1;
...
$self->write_file('lib/<<PATH>>/DB.pm', <<'...');
package <% $module %>::DB;
use strict;
use warnings;
use utf8;
use parent qw(Teng);
1;
...
$self->write_file('t/08_teng.t', <<'...');
use strict;
use warnings;
use DBI;
use Test::More;
lib/Amon2/Setup/Flavor/TengWithoutLoader.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
package Amon2::Setup::Flavor::TengWithoutLoader;
use parent qw(Amon2::Setup::Flavor);
sub run {
my $self = shift;
$self->write_file('lib/<<PATH>>.pm', <<'...');
package <% $module %>;
use strict;
use warnings;
use utf8;
use parent qw/Amon2/;
use 5.008001;
__PACKAGE__->load_plugin(qw/DBI/);
# initialize database
use DBI;
sub setup_schema {
my $self = shift;
my $dbh = $self->dbh();
t/01_teng.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Amon2::Setup::Flavor;
use File::Path ();
use Test::More;
use Test::Requires +{ 'YAML::Tiny' => '1.46' };
use t::TestFlavor;
use t::Util;
my $flavor = Amon2::Setup::Flavor->new({module => 'My::App'});
test_flavor(sub {
ok(-f 'lib/My/App.pm', 'lib/My/App.pm exists');
t/01_teng.t view on Meta::CPAN
'',
'',
+{
sqlite_unicode => 1,
}
],
};
...
File::Path::mkpath('db');
open my $fh, '>:utf8', 'development.db' or die "Cannot open db";
close $fh;
}, 'Teng');
done_testing;
t/02_teng_without_loader.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Amon2::Setup::Flavor;
use File::Path ();
use Test::More;
use Test::Requires +{ 'YAML::Tiny' => '1.46' };
use t::TestFlavor;
use t::Util;
my $flavor = Amon2::Setup::Flavor->new({module => 'My::App'});
test_flavor(sub {
ok(-f 'lib/My/App.pm', 'lib/My/App.pm exists');
t/02_teng_without_loader.t view on Meta::CPAN
'',
'',
+{
sqlite_unicode => 1,
}
],
};
...
File::Path::mkpath('db');
open my $fh, '>:utf8', 'development.db' or die "Cannot open db";
close $fh;
}, 'TengWithoutLoader');
done_testing;
t/TestFlavor.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
package t::TestFlavor;
use parent qw(Exporter);
our @EXPORT = qw(test_flavor);
use File::Temp qw/tempdir/;
use App::Prove;
use File::Basename;
use Cwd;
use File::Spec;
use Plack::Util;
( run in 0.986 second using v1.01-cache-2.11-cpan-49f99fa48dc )