view release on metacpan or search on metacpan
# =========================================================================
# THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA.
# DO NOT EDIT DIRECTLY.
# =========================================================================
use 5.008_001;
use strict;
use warnings;
use utf8;
use Module::Build;
use File::Basename;
use File::Spec;
my %args = (
license => 'perl',
dynamic_config => 0,
configure_requires => {
lib/Amon2/Lite.pm view on Meta::CPAN
*{"${base_class}::load_config"} = sub { +{ } };
}
}
1;
__END__
=for stopwords TinyURL
=encoding utf8
=head1 NAME
Amon2::Lite - Sinatra-ish framework on Amon2!
=head1 SYNOPSIS
use Amon2::Lite;
get '/' => sub {
lib/Amon2/Setup/Flavor/Lite.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
package Amon2::Setup::Flavor::Lite;
use parent qw(Amon2::Setup::Flavor);
sub run {
my ($self) = @_;
require Amon2::Lite;
require Amon2;
$self->{amon2_version} = $Amon2::VERSION;
$self->{amon2_lite_version} = $Amon2::Lite::VERSION;
$self->write_file('app.psgi', <<'...');
use strict;
use warnings;
use utf8;
use File::Spec;
use File::Basename;
use lib File::Spec->catdir(dirname(__FILE__), 'extlib', 'lib', 'perl5');
use lib File::Spec->catdir(dirname(__FILE__), 'lib');
use Amon2::Lite;
our $VERSION = '0.13';
# put your configuration here
sub load_config {
lib/Amon2/Setup/Flavor/Lite.pm view on Meta::CPAN
unless ($ENV{PLACK_ENV}) {
$ENV{PLACK_ENV} = 'test';
}
}
use parent qw/Exporter/;
use Test::More 0.96;
our @EXPORT = qw//;
{
# utf8 hack.
binmode Test::More->builder->$_, ":utf8" for qw/output failure_output todo_output/;
no warnings 'redefine';
my $code = \&Test::Builder::child;
*Test::Builder::child = sub {
my $builder = $code->(@_);
binmode $builder->output, ":utf8";
binmode $builder->failure_output, ":utf8";
binmode $builder->todo_output, ":utf8";
return $builder;
};
}
1;
...
$self->write_file('t/01_root.t', <<'...');
use strict;
use warnings;
use utf8;
use t::Util;
use Plack::Test;
use Plack::Util;
use Test::More;
my $app = Plack::Util::load_psgi 'app.psgi';
test_psgi
app => $app,
client => sub {
my $cb = shift;
t/100_static/01_simple.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Plack::Test;
use Test::Requires qw/HTTP::Request::Common/, 'Data::Section::Simple';
my $app = do {
use Amon2::Lite;
get '/' => sub { shift->create_response(200, ['Content-Length' => 2], ['OK']) };
__PACKAGE__->to_app(
t/300_setup/04_lite.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use t::TestFlavor;
use Test::Requires 'JSON', 'Plack::Middleware::ReverseProxy', 'Data::Section::Simple';
test_flavor(sub {
ok(-f 'app.psgi', 'app.psgi exists');
ok((do 'app.psgi'), 'app.psgi is valid') or do {
diag $@;
diag do {
open my $fh, '<', 'app.psgi' or die;
t/400_lite/01_simple.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Plack::Test;
use Test::Requires qw/HTTP::Request::Common/, 'Data::Section::Simple';
use Amon2::Lite;
get '/' => sub {
my ($c) = @_;
return Amon2::Web::Response->new(200, [], 'OK');
};
t/400_lite/02_plugin.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Requires 'JSON', 'Data::Section::Simple';
use Plack::Util;
use Plack::Test;
use HTTP::Request::Common;
my $app = Plack::Util::load_psgi('t/400_lite/02_plugin.psgi');
is(ref $app, 'CODE');
test_psgi $app, sub {
my $cb = shift;
t/400_lite/03_kolon.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Plack::Test;
use Test::Requires qw/HTTP::Request::Common/, 'Data::Section::Simple';
use FindBin;
use File::Spec;
use lib File::Spec->catdir($FindBin::Bin, '../../lib');
use Amon2::Lite;
sub config {
t/400_lite/03_kolon_simple.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Plack::Test;
use Test::Requires qw/HTTP::Request::Common/, 'Data::Section::Simple';
use FindBin;
use File::Spec;
use lib File::Spec->catdir($FindBin::Bin, '../../lib');
my $app = do {
use Amon2::Lite;
t/400_lite/04_tmt.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Plack::Test;
use Test::Requires qw/Text::MicroTemplate Tiffany::Text::MicroTemplate::File/, 'Data::Section::Simple';
use HTTP::Request::Common;
use Amon2::Lite;
sub create_view {
Tiffany::Text::MicroTemplate::File->new(+{
include_path => ['./t/tmpl/']
t/400_lite/05_enable_session.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Requires 'Test::WWW::Mechanize::PSGI';
my $app = do {
package MyApp;
use Amon2::Lite;
get '/' => sub {
my $c = shift;
t/400_lite/06_enable_middleware.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use HTTP::Response;
use Test::Requires 'Test::WWW::Mechanize::PSGI';
my $app = do {
package MyApp;
use Amon2::Lite;
get '/' => sub {
my $c = shift;
t/400_lite/07_http_method.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Requires 'Test::WWW::Mechanize::PSGI';
my $app = do {
package MyApp;
use Amon2::Lite;
get '/g' => sub { shift->create_response(200, [], 'get_ok' ) };
post '/p' => sub { shift->create_response(200, [], 'post_ok') };
any '/a' => sub { shift->create_response(200, [], 'any_ok' ) };
t/400_lite/08_x_nantoka.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Requires 'Test::WWW::Mechanize::PSGI';
subtest 'basic' => sub {
my $app = do {
package MyApp;
use Amon2::Lite;
get '/' => sub { shift->create_response(200, [], 'ok') };
__PACKAGE__->to_app();
};
t/400_lite/09_get_post.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Test::More;
use Test::Requires 'HTTP::Request::Common';
use HTTP::Message::PSGI;
use HTTP::Response;
use HTTP::Request::Common;
{
package sandbox;
use Amon2::Lite;
get '/' => sub {
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;