Ado
view release on metacpan or search on metacpan
lib/Ado/Build.pm view on Meta::CPAN
#Deciding where to install
my $prefix = $self->install_base || $self->config('siteprefix');
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));
lib/Ado/Build.pm view on Meta::CPAN
return $self->_uninstall('dry-run');
}
sub ACTION_build {
my $self = shift;
#Make sure *log files are empty before moving them to blib
_empty_log_files('log');
#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');
#Do other interventions before the real dist..
$self->SUPER::ACTION_dist;
return;
}
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
lib/Ado/Build.pm view on Meta::CPAN
'[](https://travis-ci.org/kberov/Ado)';
$markdown =~ s/(\n.+Travis-CI.+\n)/$1\n$ci_badge\n\n/xgm;
$out->say($markdown);
$out->close;
$self->log_info("Created $readme_md$/");
}
else { Carp::croak("Could not create $readme_md... $!"); }
}
else {
$self->SUPER::do_create_readme();
}
return;
}
1;
=pod
=encoding utf8
lib/Ado/Build.pm view on Meta::CPAN
Ado::Build inherits all methods from L<Module::Build> and implements
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>.
lib/Ado/Build.pm view on Meta::CPAN
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
We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_test>. See the source for details.
=head2 ACTION_dist
We put here custom functionality executed around the
C<$self-E<gt>SUPER::ACTION_dist>. See the sources for details.
=head2 ACTION_install
Changes file permissions to C<0600> of some files
like C<etc/ado.sqlite> and to C<0400> of some files like C<etc/ado.conf>.
You can put additional custom functionality here.
=head2 ACTION_fakeuninstall
Dry run for uninstall operation against module Ado.
lib/Ado/Command/adduser.pm view on Meta::CPAN
#TODO: add funcionality for notifying users on account expiration
#TODO: document this
stop_date => $t + ONE_YEAR, #account expires after one year
start_date => $t,
login_password => rand($t) . $$ . {} . $t,
};
};
sub init {
my ($self, @args) = @_;
$self->SUPER::init();
unless (@args) { Carp::croak($self->usage); }
my $args = $self->args;
my $ret = GetOptionsFromArray(
\@args,
'u|login_name=s' => \$args->{login_name},
'p|login_password=s' => \$args->{login_password},
'e|email=s' => \$args->{email},
'g|ingroup=s' => \$args->{ingroup},
'd|disabled:i' => \$args->{disabled},
'f|first_name=s' => \$args->{first_name},
lib/Ado/I18n.pm view on Meta::CPAN
package Ado::I18n;
use Mojo::Base 'Locale::Maketext';
our %Lexicon = (_AUTO => 1); ##no critic(ProhibitPackageVars)
sub get_handle {
my ($class, $language, $c, $config) = @_;
state $loaded = {};
my $self = $class->SUPER::get_handle($language, @{$$config{languages}});
$self->_load_messages_from_db($c->dbix, $$config{default_language})
unless $loaded->{$language};
$loaded->{$language} = 1;
return $self;
}
sub _load_messages_from_db {
my ($self, $dbix, $default) = @_;
my $SQL = <<'SQL';
SELECT d.msgid AS msgid,(
( run in 0.527 second using v1.01-cache-2.11-cpan-49f99fa48dc )