Amon2

 view release on metacpan or  search on metacpan

author/assets.pl  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use 5.008001;
use lib 'lib';
use LWP::UserAgent;
use autodie;
use Data::Dumper;
use File::Basename;
use File::Temp qw/tmpnam tempdir/;
use Text::Xslate;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );

my $xslate = Text::Xslate->new(
    syntax    => 'TTerse',
    module    => ['Data::Dumper'],
    type      => 'text',
    tag_start => '<%',
    tag_end   => '%>',
);
my $ua = LWP::UserAgent->new();

__PACKAGE__->register_js(
    'run_strftimejs',
    'https://raw.github.com/tokuhirom/strftime-js/master/strftime.js',
    'StrftimeJS',

author/assets.pl  view on Meta::CPAN

);
__PACKAGE__->register_js(
    'run_xsrf_token_js',
    'https://raw.github.com/tokuhirom/HTTP-Session2/master/js/xsrf-token.js',
    'XSRFTokenJS',
);

&main;exit;

sub main {
    local $Data::Dumper::Terse = 1;

    if (@ARGV) {
        my $code = __PACKAGE__->can($ARGV[0])
            or die "Unknown method: $ARGV[0]";
        $code->();
    } else {
        run_jquery();
        run_bootstrap();

        run_strftimejs();

author/assets.pl  view on Meta::CPAN

        next if $basename eq '.gitignore';
        next if $basename eq '.travis.yml';
        next if $filename =~ m{/examples/};
        next if $filename =~ m{/less/};
        next if $filename =~ m{/tests/};
        if ($filename =~ m{/dist/(.*)\z}) {
            $files->{"bootstrap/$1"} = $contents;
        }
    }

    local $Data::Dumper::Useqq = 1;
    local $Data::Dumper::Sortkeys = 1;
   my $content = $xslate->render_string(<<'...', {script => $0, content => Dumper($files)});
# This file is generated by <% script %>. Do not edit manually.
package Amon2::Setup::Asset::Bootstrap;
use strict;
use warnings;

sub tags {
    <<',,,';
    <link href="<: uri_for('/static/bootstrap/css/bootstrap.css') :>" rel="stylesheet" type="text/css" />
    <script src="<: uri_for('/static/bootstrap/js/bootstrap.js') :>"></script>



( run in 0.249 second using v1.01-cache-2.11-cpan-4d50c553e7e )