App-Dapper

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.09    2014-02-20
        Added 5.14.0 minimum perl version requirement.

0.08    2014-02-20
        Eliminated some tests (init, build) that were causing CI failures.

0.07    2014-02-20
        Added Getopt::Mixed to list of build options.

0.06    2014-02-20
        Addded DateTime::Format::XSD dependency to resolve test errors.

0.05    2014-02-19
        Updated Makefile.PL dependencies to resolve errors for cpantesters.org.

0.04    2014-02-18
        Removed unicode characters from App::Dapper pod.
        Added references to source and issue tracking on github.

0.03    2014-02-18
        Added significant documentation to App::Dapper and bin/dapper.

META.json  view on Meta::CPAN

      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "6.88"
         }
      },
      "runtime" : {
         "requires" : {
            "CGI" : "0",
            "Data::Dumper" : "0",
            "Data::Dumper::HTML" : "0",
            "DateTime" : "1.52",
            "DateTime::Format::XSD" : "0",
            "Exporter" : "0",
            "ExtUtils::MakeMaker" : "0",
            "File::Find" : "0",
            "File::Monitor" : "0",
            "File::Path" : "0",
            "File::Spec::Functions" : "0",
            "FindBin" : "0",
            "Getopt::Mixed" : "0",
            "IO::Dir" : "0",
            "JSON" : "0",

META.yml  view on Meta::CPAN

  version: '1.4'
name: App-Dapper
no_index:
  directory:
    - t
    - inc
requires:
  CGI: '0'
  Data::Dumper: '0'
  Data::Dumper::HTML: '0'
  DateTime: '1.52'
  DateTime::Format::XSD: '0'
  Exporter: '0'
  ExtUtils::MakeMaker: '0'
  File::Find: '0'
  File::Monitor: '0'
  File::Path: '0'
  File::Spec::Functions: '0'
  FindBin: '0'
  Getopt::Mixed: '0'
  IO::Dir: '0'
  JSON: '0'

Makefile.PL  view on Meta::CPAN

    BUILD_REQUIRES => {
        'Test::More'                   => 0.98,
    },
    TEST_REQUIRES => {
        'YAML::PP'                     => 0,
    },
    PREREQ_PM => {
        'CGI'                          => 0,
        'Data::Dumper'                 => 0,
        'Data::Dumper::HTML'           => 0,
        'DateTime'                     => 1.52, 
        'DateTime::Format::XSD'        => 0,
        'Exporter'                     => 0,
        'ExtUtils::MakeMaker'          => 0,
        'File::Find'                   => 0,
        'File::Monitor'                => 0,
        'File::Path'                   => 0,
        'File::Spec::Functions'        => 0,
        'FindBin'                      => 0,
        'Getopt::Mixed'                => 0,
        'IO::Dir'                      => 0,
        'JSON'                         => 0,

lib/App/Dapper.pm  view on Meta::CPAN

use Net::HTTPServer;

use YAML::PP qw/ Load Dump LoadFile DumpFile /;
use File::Spec::Functions qw/ canonpath /;
use File::Path qw(make_path);

use Data::Dumper;
$Data::Dumper::Indent = 1;
$Data::Dumper::Sortkeys = 1;

use DateTime;
use DateTime::Format::XSD;

use App::Dapper::Serve;
use App::Dapper::Init;
use App::Dapper::Utils;
use App::Dapper::Defaults;
use App::Dapper::Filters;

my $DEFAULT_PORT = 8000;
my $ID = 0;

lib/App/Dapper.pm  view on Meta::CPAN

    my $class = shift;
    my $self = {
        created=> 1,
        source => shift,
        output => shift,
        layout => shift,
        config => shift,
    };

    $self->{site} = App::Dapper::Defaults::get_defaults();
    $self->{site}->{time} = DateTime->now( time_zone => DateTime::TimeZone->new( name => 'local' ) );
    $self->{source} = "_source" unless defined($self->{source});
    $self->{output} = "_output" unless defined($self->{output});
    $self->{layout} = "_layout" unless defined($self->{layout});
    $self->{config} = "_config.yml" unless defined($self->{config});

    bless $self, $class;
    return $self;
}

=head2 init

lib/App/Dapper.pm  view on Meta::CPAN

    $page{content} = $2;

    for my $key (keys %{$frontmatter}) {
        $page{$key} = $frontmatter->{$key};
    }

    $page{slug} = App::Dapper::Utils::slugify($page{title});

    my $date;
    if (not $page{date}) {
        $date = DateTime::Format::XSD->parse_datetime(App::Dapper::Utils::get_modified_time($source_file_name));
        # print "Didn't find date for $source_file_name. Setting to file modified date of $date\n";
        $page{date} = $date;
    } else {
        $date = DateTime::Format::XSD->parse_datetime($page{date});
    }

    $page{date}   = $date;
    $page{year}   = $date->year();
    $page{month}  = $date->month();
    $page{day}    = $date->day();
    $page{hour}   = $date->hour();
    $page{minute} = $date->minute();
    $page{second} = $date->second();
      
    # Insert zero to beginning if year, month, day,
    # hour, minute or second is less than 10
    $page{$_} < 10 and $page{$_} = '0' . $page{$_}
      for ('year', 'month', 'day', 'hour', 'minute', 'second');

    if(not $page{timezone}) {
        $page{timezone} = DateTime::TimeZone->new( name => 'local' );
    }

    $page{url} = defined $page{urlpattern} ? $page{urlpattern} : $self->{site}->{urlpattern};
    $page{url} =~ s/\:category/$page{categories}/g unless not defined $page{categories};
    $page{url} =~ s/\:year/$page{year}/g unless not defined $page{year};
    $page{url} =~ s/\:month/$page{month}/g unless not defined $page{month};
    $page{url} =~ s/\:day/$page{day}/g unless not defined $page{day};
    $page{url} =~ s/\:hour/$page{hour}/g unless not defined $page{hour};
    $page{url} =~ s/\:minute/$page{minute}/g unless not defined $page{minute};
    $page{url} =~ s/\:second/$page{second}/g unless not defined $page{second};

lib/App/Dapper/Filters.pm  view on Meta::CPAN

=head2 date_to_xmlschema

Convert a date to an XML-formattted version of the date that also includes
the timezone.

=cut

sub date_to_xmlschema {
    my $str = shift;

    use DateTime;
    use DateTime::Format::XSD;

    return DateTime::Format::XSD->format_datetime($str);
}

=head2 replace_last

Liquid filter to replace the last occurrance of a string with another string.

=cut

sub replace_last {
    my ($input, $string, $replacement) = @_;



( run in 0.341 second using v1.01-cache-2.11-cpan-05444aca049 )