Ado

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      Ado::Control::Ado::Default to Ado::Plugin::Admin distribution.
    - Moved generic routes to be always defined last.

0.77 2015-01-24
  - Happy Christmass and New Year!
  - Applied for Grant from TPF:
    http://news.perlfoundation.org/2015/01/grant-proposal-ado---a-rapid-a.html
    This proposal will be used as roadmap.
  - Fixed typo in Ado::Build SYNOPSIS. Thanks RSAVAGE, WEBY.
  - Do not use deprecated in Mojolicious 5.73 $c->render_exception()
    and $c->render_not_found(). Use $c->reply->not_found() and
    $c->reply->exception() instead.
  - Started cleanups:
    Removed templates/добре/ок.html.ep just to reduce
    http://cpants.cpanauthors.org/dist/Ado/errors
  - Noted in etc/ado.conf that arbitrary Perl code can be executed
    when connecting to the database.
  - POD improvements and cleanups.
  - Upgraded to Mojolicious::Plugin::SemanticUI 0.11.

0.76 2014-12-14

Changes  view on Meta::CPAN

0.69 2014-10-26
  - $CODENAME changed to
    "Живете" - U+2C06 GLAGOLITIC CAPITAL LETTER ZHIVETE (Ⰶ)
  - Switched from favicon.ico to favicon.png for better quality.
  - Fixed popup positioning and appearance of the logo in the main menu.
  - Added the condition 'ingroup' to Ado::Plugin::Auth.
  - Implemented Ado::Model::Users::by_group_name($group, $limit, $offset).

0.68 2014-10-25
  - Upgraded to Mojolicious 5.54.
  - Added templates/not_found.html.ep.
  - Upgraded to DBD::SQLite 1.44.
  - Dramatic performance improvement with 'PRAGMA synchronous = OFF' and
    'PRAGMA journal_mode=WAL'.
  - Improved Ado::Command::adduser documentation.

0.67 2014-10-10
  - Fixed failing tests for Ado::Plugin::I18n after upgrade and improved it.
  - Added universal exception.html.ep.
  - Upgraded to Mojolicious 5.48.
  - Added helper to_json to Ado::Plugin::AdoHelpers, same as

MANIFEST  view on Meta::CPAN

templates/default/index.html.ep
templates/default/index_text.html+bg.ep
templates/default/index_text.html+de.ep
templates/default/index_text.html.ep
templates/doc/show.html.ep
templates/exception.html.ep
templates/layouts/articles.html.ep
templates/layouts/default.html.ep
templates/layouts/doc.html.ep
templates/login.html.ep
templates/not_found.html.ep
templates/partials/adobar.html.ep
templates/partials/apache2htaccess.ep
templates/partials/apache2vhost.ep
templates/partials/authbar.html.ep
templates/partials/head.html.ep
templates/partials/login_form.html.ep
templates/partials/logo.html.ep
templates/test/ado_helpers.html.ep

lib/Ado/Command/generate/crud.pm  view on Meta::CPAN

        html => {article => $data}
    );
}

# Updates a resource in table <%= $a->{t} %>.
sub update {
    my $c = shift;
    my $v = $c->validation;
    my ($id) = $c->stash('id') =~/(\d+)/;
    my $res = $table_class->find($id);
    $c->reply->not_found() unless $res->data;
    $c->debug('$data:'.$c->dumper($res->data));

    if($v->has_data && $res->data){
        $v->optional('title')->size(3, 50);
        $v->optional('body')->size(3, 1 * 1024 * 1024);#1MB
        $res->title($v->param('title'))->body($v->param('body'))
         ->update() unless $v->has_error;
    }
    my $data = $res->data;
    return $c->respond_to(

lib/Ado/Plugin/MarkdownRenderer.pm  view on Meta::CPAN

    $app->config(__PACKAGE__, $config);
    return $self;
}

sub md_to_html {
    my ($c, $config, $file_path) = @_;
    $file_path ||= ($c->stash('md_file') || return '');

    #remove anchors
    $file_path =~ s{[^#]#.+}{};
    unless ($file_path) { $c->reply->not_found() && return '' }
    my $fullname = catfile($config->{md_root}, $file_path);
    $c->debug("md_file: $file_path; \$fullname: $fullname");

    my ($name, $path, $suffix) = fileparse($fullname, @{$config->{md_file_sufixes}});
    my $html_filepath = catfile($path, "$name.html");

    #Reuse previously produced html file if md_file is older than the html file.
    if (   $config->{md_reuse_produced_html}
        && -s $html_filepath
        && (stat($fullname))[9] < (stat($html_filepath))[9])
    {
        $c->debug('Found ' . $html_filepath);
        return b(path($html_filepath)->slurp)->decode;
    }

    #404 Not Found
    my $md_filepath = catfile($path, "$name$suffix");
    unless (-s $md_filepath) { $c->reply->not_found() && return '' }

    my $markdown = path($md_filepath)->slurp;
    my $self_url = $c->url_for()->to_string;
    my %options  = (%{$config->{md_options}}, self_url => $self_url);
    my $html     = $c->markdown($markdown, \%options);
    $c->debug($c->dumper({'%options' => \%options, '$html_filepath' => $html_filepath}));
    path($html_filepath)->spurt($html);
    return b($html)->decode;
}

t/boilerplate.t  view on Meta::CPAN

#!perl -T
use 5.014000;
use strict;
use warnings FATAL => 'all';
use Test::More;

sub not_in_file_ok {
    my ($filename, %regex) = @_;
    open(my $fh, '<', $filename)
      or die "couldn't open $filename for reading: $!";

    my %violated;

    while (my $line = <$fh>) {
        while (my ($desc, $regex) = each %regex) {
            if ($line =~ $regex) {
                push @{$violated{$desc} ||= []}, $.;

t/boilerplate.t  view on Meta::CPAN

        fail("$filename contains boilerplate text");
        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
    }
    else {
        pass("$filename contains no boilerplate text");
    }
}

sub module_boilerplate_ok {
    my ($module) = @_;
    not_in_file_ok(
        $module => 'the great new $MODULENAME' => qr/ - The great new /,
        'boilerplate description'  => qr/Quick summary of what the module/,
        'stub function definition' => qr/function[12]/,
    );
}


not_in_file_ok(
    README                       => "The README is used..." => qr/The README is used/,
    "'version information here'" => qr/to provide version information/,
);

not_in_file_ok(Changes => "placeholder date/time" => qr(Date/time));

module_boilerplate_ok('lib/Ado.pm');


done_testing();

t/plugin/markdown_renderer-01.t  view on Meta::CPAN


#test Ado::Control::Articles
my $config = $app->config('Ado::Plugin::MarkdownRenderer');

is($config->{md_reuse_produced_html}, 1);
my $static_file = $app->home->rel_file('public/articles/hello.html');
unlink($static_file);

#file is generated and the user is redirected to it.
$t->get_ok('/articles/hello.html')->status_is(302);
$t->get_ok('/articles/not_found.html')->status_is(404)->text_like('h1' => qr'Not Found');
ok(-e $static_file, 'file /articles/hello.html really exists');

#static file
$t->get_ok('/articles/hello.html')->status_is(200)
  ->text_like('h1' => qr'Ползата от историята');

#cached static file: Check If-Modified-Since
my $mtime = Mojo::Date->new(Mojo::Asset::File->new(path => $static_file)->mtime)->to_string;
$t->head_ok('/articles/hello.html' => {'If-Modified-Since' => $mtime})->status_is(304);



( run in 0.588 second using v1.01-cache-2.11-cpan-cc502c75498 )