Ado

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


0.25 2014-01-01 20:27:50 CET
    - Added more tests for Ado::Build (test coverage is > 90%).
    - Fixed ACTION_perltidy. We do not modify Build.PL any more.
    - Fixed stupid bug in manifest.t

0.24 2013-12-31 17:09:24 CET
    - This is an important release.
      CODENAME: "Азь" - U+2C00 GLAGOLITIC CAPITAL LETTER AZU(Ⰰ)
    - Introduced Ado::Command::version and the concept of $CODENAME.
    - We have a stabilised Build process.
    - Fixed ACTION_uninstall and ACTION_fakeuninstall (Valcho).
    - Fixed failing pod-coverage.t because of -T switch (Valcho).
    - Fixed ACTION_perltidy - was not tidying t/*.t files.
    - Added tests for ACTION_perltidy.
    - Introduced t/ado-build.t.

0.23 2013-12-30 03:14:17 CET
    - Added experimental tests for Ado::Build.
    - Fixed ACTION_perltidy - did not tidy Build.PL
    - Dynamically generating  META.json and META.yml

Changes  view on Meta::CPAN

    - Added uninstall and fakeuninstall actions to Ado::Build (Valcho).
    - Fixed wrong install_path for lib directory
      when "--install_base" is not passed as argument.
    - Using Perl's $Config{siteprefixexp} for
      other directories: qw(etc public log templates).

0.22 2013-12-29 03:30:38 CET
    - Refactored creation of README.md, kept README.
    - Wellcome Valcho to the core team :)!
    - Removed $ADO_HOME (by popular demand)
      and symplified installation process a lot.
    - Improved Manual.pod/README.

0.21 2013-12-28 03:37:42 CET
    - Added build action submit (draft).
    - Added build action "perltidy" - see Ado::Build.
      deleted:    bin/ado_perltidy
      Thanks to Vulcho Nedelchev(WEBY) for the inspiration.
    - Improved list_for_json in Ado::Control.
    - Implemented validate_input in Ado::Control.
    - Implemented Test::AdoPlugin.

Changes  view on Meta::CPAN

      Added informative message about ADO_HOME.
    - Set lib and arch install paths to "lib".
    - Enhanced documentation.
    - Implemented custom automatic README
      generation from Ado::Nabual.
    - Improved Build.PL

0.14 2013-12-14 14:11:45 CET
    - Setting explicitly MOJO_MODE in bin/ado
    - Better detection for MOJO_HOME and MOJO_CONFIG
    - Enhanced the Build process,
      added ACTION_build, ACTION_dist process_log_files
      and _empty_log_files to Ado::Build.
    - Enhanced Ado::Plugin::Routes, added tests.
    - Implemented Ado::Plugin::Routes.
    - Again changed the routes structure in config.
      Every route description is simply a HASHREF.
    - Enhanced documentation.
    - Reenabled pod-coverage tests.

0.13 2013-12-10 01:44:30 CET
    - Removed usage of PoweredBy.

lib/Ado/Build.pm  view on Meta::CPAN

use strict;
use warnings FATAL => 'all';
use File::Spec::Functions qw(catdir catfile);
use File::Path qw(make_path);
use File::Copy qw(copy);
use ExtUtils::Installed;
use ExtUtils::Install;
use parent 'Module::Build';
use Exporter qw( import );    #export functionality to Ado::BuildPlugin etc..
our @EXPORT_OK = qw(
  create_build_script process_etc_files do_create_readme
  process_public_files process_templates_files
  ACTION_perltidy ACTION_submit PERL_DIRS);

sub PERL_DIRS {
    state $dirs = [map { catdir($_[0]->base_dir, $_) } qw(bin lib etc t)];
    return @$dirs;
}

sub create_build_script {
    my $self = shift;

lib/Ado/Build.pm  view on Meta::CPAN

    for my $be (qw(etc public log templates)) {

        #in case of installing a plugin, check if folder exists
        next unless -d $be;
        $self->add_build_element($be);
        $self->install_path($be => catdir($prefix, $be));
    }
    return $self->SUPER::create_build_script();
}

sub process_public_files {
    my $self = shift;
    for my $asset (@{$self->rscan_dir('public')}) {
        if (-d $asset) {
            make_path(catdir('blib', $asset));
            next;
        }
        copy($asset, catfile('blib', $asset));
    }
    return;
}

sub process_etc_files {
    my $self   = shift;
    my $prefix = $self->install_base || $self->config('siteprefix');
    my $mode   = $ENV{MOJO_MODE} ||= 'development';

    for my $asset (@{$self->rscan_dir('etc')}) {
        if (-d $asset) {
            make_path(catdir('blib', $asset));
            next;
        }

lib/Ado/Build.pm  view on Meta::CPAN

        my $asset_path = catfile($prefix, $asset);
        if ($asset =~ m/ado\.sqlite/ && -s $asset_path) {
            $self->log_info("Skipping $asset because it already exists at $asset_path! $/");
            next;
        }
        copy($asset, catfile('blib', $asset));
    }
    return;
}

sub process_log_files {
    my $self = shift;
    for my $asset (@{$self->rscan_dir('log')}) {
        if (-d $asset) {
            make_path(catdir('blib', $asset));
            next;
        }
        copy($asset, catfile('blib', $asset));
    }
    return;
}

sub process_templates_files {
    my $self = shift;
    for my $asset (@{$self->rscan_dir('templates')}) {
        if (-d $asset) {
            make_path(catdir('blib', $asset));
            next;
        }
        copy($asset, catfile('blib', $asset));
    }
    return;
}

lib/Ado/Build.pm  view on Meta::CPAN


    #Do other interventions before the real build...
    $self->SUPER::ACTION_build;
    return;
}

sub ACTION_test {
    my $self = shift;

    #Custom functionality before test
    $self->_process_custom_files(catdir('blib', 'etc'), catdir('blib', 'log'))
      if -d 'blib';
    $self->_process_custom_files('etc', 'log');
    $self->SUPER::ACTION_test;
    return;
}

sub ACTION_dist {
    my $self = shift;

    #Make sure *log files are empty before including them into the distro
    _empty_log_files('log');

lib/Ado/Build.pm  view on Meta::CPAN

sub ACTION_install {
    my $self = shift;

    #Custom functionality before installation
    #here...
    #TODO: Think about what to do with *.conf and *.sqlite files in case of upgrade!!!
    #TODO: (upgrade)rotate logs - archive existing log files before emptying.
    $self->SUPER::ACTION_install;

    #Custom functionality after installation
    $self->_process_custom_files($self->install_path('etc'), $self->install_path('log'));
    return;
}

sub _process_custom_files {
    my ($self, $etc_dir, $log_dir) = @_;

    #make some files writable and/or readable only by the user that runs the application
    my $ro = oct('0400');
    my $rw = oct('0600');
    for my $asset (
        qw(ado.conf plugins/routes.conf plugins/auth.conf plugins/markdown_renderer.conf))
    {
        _chmod($ro, catfile($etc_dir, $asset));
    }

lib/Ado/Build.pm  view on Meta::CPAN

  ./Build dist
  ./Build submit
  #.... and so on


=head1 DESCRIPTION

This is a subclass of L<Module::Build>. We use L<Module::Build::API> to add
custom functionality. This module and L<Ado::BuildPlugin> exist just because of
the additional install paths that we use beside C<lib> and C<bin> and
processing the files in those paths. These modules also can serve as examples
for your own builders if you have some custom things to do during  build, test,
install and even if you need to add a new C<ACTION_*> to your setup.

=head1 ATTRIBUTES

Ado::Build defines some attributes, used across different actions.

=head2 PERL_DIRS

Returns the list of absolute paths to directories in the project containing

lib/Ado/Build.pm  view on Meta::CPAN

the following ones.

=head2 create_build_script

This method is called in C<Build.PL>.
In this method we also call C<add_build_element> for C<etc> C<public>,
C<templates> and C<log> folders.
Finally we set all the C<install_path>s for the distro
and we call C<$self-E<gt>SUPER::create_build_script>.

=head2 process_etc_files

Moves files found in C<Ado/etc> to C<Ado/blib/etc>.
See L<Module::Build::API/METHODS>
Returns void.

=head2 process_log_files

Moves files found in C<Ado/log> to C<Ado/blib/log>.
Returns void.

=head2 process_public_files

Moves files found in C<Ado/public> to C<Ado/blib/public>.
Returns void.

=head2 process_templates_files

Moves files found in C<Ado/templates> to C<Ado/blib/templates>.
Returns void.

=head2 ACTION_build

We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_build>. See the source for details.

=head2 ACTION_test

lib/Ado/BuildPlugin.pm  view on Meta::CPAN

package Ado::BuildPlugin;
use 5.014;
use strict;
use warnings FATAL => 'all';
use parent 'Module::Build';
use Ado::Build qw(
  process_etc_files process_public_files do_create_readme
  process_templates_files create_build_script
  ACTION_perltidy ACTION_submit PERL_DIRS);

1;

=pod

=encoding utf8

=head1 NAME

lib/Ado/BuildPlugin.pm  view on Meta::CPAN

This module and L<Ado::Build> exist because of the additional install paths
that we use beside C<lib> and C<bin>. These modules also can serve as examples
for your own builders if you have some custom things to do during
build, test, install and even if you need to add a new C<ACTION_*>
to your setup.


=head1 METHODS

Ado::BuildPlugin inherits all methods from L<Module::Build>.
It also imports C<create_build_script>, C<process_etc_files>,
C<process_public_files>, C<process_templates_files> from L<Ado::Build>.


=head1 AUTHOR

Красимир Беров (Krasimir Berov)

=head1 COPYRIGHT AND LICENSE

Copyright 2013-2014 Красимир Беров (Krasimir Berov).

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

package Ado::Plugin::AdoHelpers;
use Mojo::Base 'Ado::Plugin';
use Mojo::Util qw(decode);
use List::Util qw(first);
use Mojo::File 'path';

# allow plugins to process SQL scripts while loading
sub do_sql_file {
    my ($app, $sql_file) = @_;
    my $dbh = $app->dbix->dbh;

    #$app->log->debug('do_sql_file:' . $sql_file) if $Ado::Control::DEV_MODE;

    my $SQL = decode('UTF-8', path($sql_file)->slurp());

    #Remove multi-line comments
    $SQL =~ s|/\*+.+?\*/\s+?||gsmx;

public/vendor/crypto-js/rollups/sha1.js  view on Meta::CPAN

/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(e,m){var p={},j=p.lib={},l=function(){},f=j.Base={extend:function(a){l.prototype=this;var c=new l;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$s...
n=j.WordArray=f.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=m?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var c=this.words,q=a.words,d=this.sigBytes;a=a.sigBytes;this.clamp();if(d%4)for(var b...
32-8*(c%4);a.length=e.ceil(c/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b<a;b+=4)c.push(4294967296*e.random()|0);return new n.init(c,a)}}),b=p.enc={},h=b.Hex={stringify:func...
2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d<a;d++)b.push(String.fromCharCode(c[d>>>2]>>>24-8*(d%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],d=...
k=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,...
a._data=this._data.clone();return a},_minBufferSize:0});j.Hasher=k.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){k.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process...
f)).finalize(b)}}});var s=p.algo={};return p}(Math);
(function(){var e=CryptoJS,m=e.lib,p=m.WordArray,j=m.Hasher,l=[],m=e.algo.SHA1=j.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(f,n){for(var b=this._hash.words,h=b[...
k)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.f...

public/vendor/pagedown/Markdown.Converter.js  view on Meta::CPAN

                    <!
                    (--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)   // see http://www.w3.org/TR/html-markup/syntax.html#comments and http://meta.stackoverflow.com/q/95256
                    >
                    [ \t]*
                    (?=\n{2,})                                  // followed by a blank line
                )
            /g,hashElement);
            */
            text = text.replace(/\n\n[ ]{0,3}(<!(--(?:|(?:[^>-]|-[^>])(?:[^-]|-[^-])*)--)>[ \t]*(?=\n{2,}))/g, hashElement);

            // PHP and ASP-style processor instructions (<?...?> and <%...%>)

            /*
            text = text.replace(/
                (?:
                    \n\n            // Starting after a blank line
                )
                (                   // save in $1
                    [ ]{0,3}        // attacklab: g_tab_width - 1
                    (?:
                        <([?%])     // $2

public/vendor/pagedown/Markdown.Converter.js  view on Meta::CPAN


                    return hashBlock("<blockquote>\n" + bq + "\n</blockquote>");
                }
            );
            return text;
        }

        function _FormParagraphs(text, doNotUnhash) {
            //
            //  Params:
            //    $text - string to process with html <p> tags
            //

            // Strip leading and trailing lines:
            text = text.replace(/^\n+/g, "");
            text = text.replace(/\n+$/g, "");

            var grafs = text.split(/\n{2,}/g);
            var grafsOut = [];
            
            var markerRe = /~K(\d+)K/;

public/vendor/pagedown/Markdown.Converter.js  view on Meta::CPAN

                            foundAny = true;
                            return g_html_blocks[id];
                        });
                    }
                }
            }
            return grafsOut.join("\n\n");
        }

        function _EncodeAmpsAndAngles(text) {
            // Smart processing for ampersands and angle brackets that need to be encoded.

            // Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin:
            //   http://bumppo.net/projects/amputator/
            text = text.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&amp;");

            // Encode naked <'s
            text = text.replace(/<(?![a-z\/?!]|~D)/gi, "&lt;");

            return text;
        }

        function _EncodeBackslashEscapes(text) {
            //
            //   Parameter:  String.
            //   Returns:    The string, with after processing the following backslash
            //               escape sequences.
            //

            // attacklab: The polite way to do this is with the new
            // escapeCharacters() function:
            //
            //     text = escapeCharacters(text,"\\",true);
            //     text = escapeCharacters(text,"`*_{}[]()>#+-.!",true);
            //
            // ...but we're sidestepping its use of the (slow) RegExp constructor

public/vendor/pagedown/Markdown.Editor.js  view on Meta::CPAN

                return; // Input text hasn't changed.
            }
            else {
                oldInputText = text;
            }

            var prevTime = new Date().getTime();

            text = converter.makeHtml(text);

            // Calculate the processing time of the HTML creation.
            // It's used as the delay time in the event listener.
            var currTime = new Date().getTime();
            elapsedTime = currTime - prevTime;

            pushPreviewHtml(text);
        };

        // setTimeout is already used.  Used as an event listener.
        var applyTimeout = function () {

public/vendor/pagedown/Markdown.Editor.js  view on Meta::CPAN


            if (requiresRefresh) {
                oldInputText = "";
                makePreviewHtml();
            }
            else {
                applyTimeout();
            }
        };

        this.processingTime = function () {
            return elapsedTime;
        };

        var isFirstTimeFilled = true;

        // IE doesn't let you use innerHTML if the element is contained somewhere in a table
        // (which is the case for inline editing) -- in that case, detach the element, set the
        // value, and reattach. Yes, that *is* ridiculous.
        var ieSafePreviewSet = function (text) {
            var preview = panels.preview;

t/00-load.t  view on Meta::CPAN

for my $file (@files) {
    my $module = $file;
    $module =~ s,\.pm$,,;
    $module =~ s,.*/?lib/,,;
    $module =~ s,/,::,g;

    use_ok($module) || diag $@;
}

for (
    qw(_empty_log_files process_etc_files
    process_public_files process_log_files process_templates_files
    ACTION_build ACTION_dist ACTION_install ACTION_perltidy ACTION_submit ACTION_fakeuninstall ACTION_uninstall )
  )
{
    can_ok('Ado::Build', $_);
}
for (
    qw(process_etc_files process_public_files process_templates_files
    ACTION_build ACTION_dist ACTION_install ACTION_perltidy ACTION_submit)
  )
{
    can_ok('Ado::BuildPlugin', $_);
}
diag("Testing loading of Ado $Ado::VERSION, Perl $], $^X");

done_testing();



( run in 0.405 second using v1.01-cache-2.11-cpan-8d75d55dd25 )