view release on metacpan or search on metacpan
- add "REST Test" commands for the new 'schedule/intervals/...' resources
0.182 2015-04-18 18:16 CEST
- rename "SCHEDULE INTERVALS" commands, resources, etc. to "INTERVAL FILLUP"
0.183 2015-04-18 18:35 CEST
- make "INTERVAL FILLUP" REST-test commands take lower and upper date bounds
instead of tsrange
0.184 2015-04-18 20:03 CEST
- bin/dochazka-cli: use Data::Dumper to display payload when status is OK and
payload is not a number or string
- add INTERVAL FILLUP commands (piggyback on INTERVAL FETCH)
0.185 2015-04-27 16:59 CEST
- give active testing employee a schedule already in t/001-init.t;
get rid of unintuitive t/cmd_active/001-init.t
- use prompt date (century, year, month, etc.) instead of current date
(century, year, month, etc.)
- Test.pm: add a 'delete_interval' test routine
- t/cmd_active/interval.t: expand unit; use imported 'delete_interval' routine;
- Util.pm: in lookup_employee(), do not go on to sec_id check when nick check
returns 403
- Shared.pm: rename show_current() to show_as_at() to generalize it
- Commands/: rename current routines to as_at in Priv.pm and Schedule.pm
- CommandMap.pm: rename current routines to as_at and add PRIV and SCHEDULE
commands with _DATE parameter
- Util.pm: expose determine_employee() argument in debug log
0.205 2015-07-27 10:14 CEST
- Build.PL: require a recent version of Web::MREST
- bin/dochazka-cli: use JSON->encode, instead of Data::Dumper, to format
statuses for display to user
- Add boilerplate for SCHEDULE ALL and SCHEDULE ALL DISABLED commands
- Shared.pm: refrain from displaying time in show_as_at()
0.206 2015-07-27 13:58 CEST
- CommandMap.pm: change second _DATE to _DATE1
(fixes Github issue #5)
0.207 2015-07-27 14:08 CEST
- Build.PL: change Web::MREST dependency to Web::MREST::CLI
bin/dochazka-cli view on Meta::CPAN
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $site $meta );
use App::Dochazka::CLI qw( $debug_mode $current_emp $current_priv $prompt_date );
use App::Dochazka::CLI::Completion qw( dochazka_cli_completion );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Util qw( authenticate_to_server init_logger init_prompt );
use App::Dochazka::Common::Model::Employee;
use Data::Dumper;
use File::HomeDir;
use Getopt::Long 2.32;
use JSON;
use Pod::Usage;
use Term::ReadKey;
use Term::ReadLine;
use Web::MREST::CLI qw( init_cli_client );
my $JSON = JSON->new->pretty;
bin/dochazka-cli view on Meta::CPAN
=head1 DESCRIPTION
This script is used to start the Dochazka command line interface, hereinafter
referred to as "the CLI".
CLI commands are documented in L<App::Dochazka::CLI::Guide>.
=cut
local $Data::Dumper::Terse = 1;
$log->init(
ident => "DochazkaCLI",
debug_mode => 1,
);
my $server = '';
my $home = File::HomeDir->my_home;
my $noauth = 0;
my $versionparam = 0;
lib/App/Dochazka/CLI.pm view on Meta::CPAN
#
# top-level CLI module
#
package App::Dochazka::CLI;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use Data::Dumper;
use Exporter 'import';
use Test::More;
=head1 NAME
App::Dochazka::CLI - Dochazka command line client
lib/App/Dochazka/CLI/CommandMap.pm view on Meta::CPAN
dump_memsched_entries
fetch_all_schedules
replicate_memsched_entry
schedule_all
schedule_new
schedulespec
schedulespec_remark
schedulespec_scode
show_schedule_as_at
);
use Data::Dumper;
use Exporter qw( import );
=head1 NAME
App::Dochazka::CLI::CommandMap - Command map
lib/App/Dochazka/CLI/Commands/Activity.pm view on Meta::CPAN
# Activity commands
package App::Dochazka::CLI::Commands::Activity;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Util qw( parse_test rest_error );
use Data::Dumper;
use Exporter 'import';
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Activity - Activity commands
lib/App/Dochazka/CLI/Commands/Component.pm view on Meta::CPAN
package App::Dochazka::CLI::Commands::Component;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Shared qw( shared_generate_report );
use App::Dochazka::CLI::Util qw( parse_test rest_error );
use Data::Dumper;
use Exporter 'import';
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Component - Component commands
lib/App/Dochazka/CLI/Commands/Employee.pm view on Meta::CPAN
use App::CELL qw( $CELL $log );
use App::Dochazka::CLI qw( $current_emp $current_priv $debug_mode );
use App::Dochazka::CLI::Util qw(
determine_employee
lookup_employee
parse_test
refresh_current_emp
rest_error
);
use App::Dochazka::Common::Model::Employee;
use Data::Dumper;
use Exporter 'import';
use Term::ReadKey;
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Employee - Employee commands
lib/App/Dochazka/CLI/Commands/History.pm view on Meta::CPAN
# History commands
package App::Dochazka::CLI::Commands::History;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $current_emp $debug_mode );
use App::Dochazka::CLI::Util qw( lookup_employee parse_test rest_error truncate_to );
use Data::Dumper;
use Exporter 'import';
use Text::Table;
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::History - History commands
lib/App/Dochazka/CLI/Commands/Interval.pm view on Meta::CPAN
determine_employee
month_alpha_to_numeric
normalize_date
normalize_time
parse_test
refresh_current_emp
rest_error
truncate_to
);
use App::Dochazka::Common::Model::Interval;
use Data::Dumper;
use Date::Calc qw( Days_in_Month );
use Exporter 'import';
use JSON;
use Params::Validate qw( :all );
use Text::Table;
use Web::MREST::CLI qw( send_req );
lib/App/Dochazka/CLI/Commands/Misc.pm view on Meta::CPAN
# Miscellaneous commands
package App::Dochazka::CLI::Commands::Misc;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode $prompt_date );
use App::Dochazka::CLI::Util qw( init_prompt normalize_date parse_test rest_error );
use Data::Dumper;
use Exporter 'import';
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Misc - Misc commands
lib/App/Dochazka/CLI/Commands/Priv.pm view on Meta::CPAN
package App::Dochazka::CLI::Commands::Priv;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Shared qw( show_as_at );
use App::Dochazka::CLI::Util qw( parse_test );
use Data::Dumper;
use Exporter 'import';
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Priv - Priv commands
lib/App/Dochazka/CLI/Commands/Schedule.pm view on Meta::CPAN
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Shared qw( print_schedule_object show_as_at );
use App::Dochazka::CLI::Util qw( parse_test );
use App::Dochazka::Common::Model::Schedule;
use Data::Dumper;
use Exporter 'import';
use JSON;
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Commands::Schedule - Schedule commands
lib/App/Dochazka/CLI/Completion.pm view on Meta::CPAN
#
package App::Dochazka::CLI::Completion;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $log );
use App::Dochazka::CLI::Parser qw( parse possible_words );
use App::Dochazka::CLI::TokenMap qw( $completion_map $token_map );
use Data::Dumper;
use Exporter 'import';
=head1 NAME
App::Dochazka::CLI::Completion - Completion module
=cut
our @EXPORT_OK = qw(
lib/App/Dochazka/CLI/Parser.pm view on Meta::CPAN
package App::Dochazka::CLI::Parser;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::TokenMap qw( $token_map );
use App::Dochazka::CLI::CommandMap;
use Data::Dumper;
use Exporter 'import';
use Web::MREST::CLI qw( send_req );
=head1 NAME
App::Dochazka::CLI::Parser - Parser module
lib/App/Dochazka/CLI/Shared.pm view on Meta::CPAN
# Shared routines
package App::Dochazka::CLI::Shared;
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL );
use App::Dochazka::CLI qw( $current_emp $debug_mode );
use App::Dochazka::CLI::Util qw( lookup_employee rest_error );
use Data::Dumper;
use Exporter 'import';
use File::Slurp;
use File::Temp;
use JSON;
use Web::MREST::CLI qw( send_req );
=head1 NAME
lib/App/Dochazka/CLI/Util.pm view on Meta::CPAN
$current_emp
$current_priv
$debug_mode
$prompt_date
$prompt_century
$prompt_year
$prompt_month
$prompt_day
);
use App::Dochazka::Common::Model::Employee;
use Data::Dumper;
use Date::Calc qw( check_date Add_Delta_Days );
use Exporter 'import';
use File::ShareDir;
use Log::Any::Adapter;
use Params::Validate qw( :all );
use Scalar::Util qw( looks_like_number );
use Try::Tiny;
use Web::MREST::CLI qw( normalize_filespec send_req );
t/001-init.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use App::Dochazka::CLI::Test qw( init_unit );
use Data::Dumper;
use Test::More;
use Test::Warnings;
$debug_mode = 1;
sub create_employees_carefully {
my ( $nick, $privlevel, $fullname ) = @_;
my ( $cmd, $rv, $status );
$cmd = "EMPLOYEE=$nick PROFILE";
t/cmd_active/activity.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
note( 'authenticate to server' );
t/cmd_active/employee.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'worker', password => 'worker', quiet => 1 );
if ( $rv->not_ok and $rv->{'http_status'} =~ m/500 Can\'t connect/ ) {
t/cmd_active/interval.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI qw( $prompt_date $prompt_century $prompt_year $prompt_month $prompt_day );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( delete_interval_test fetch_interval_test init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'worker', password => 'worker', quiet => 1 );
if ( $rv->not_ok and $rv->{'http_status'} =~ m/500 Can\'t connect/ ) {
t/cmd_admin/activity.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'root', password => 'immutable', quiet => 1 );
if ( $rv->not_ok and $rv->{'http_status'} =~ m/500 Can\'t connect/ ) {
t/cmd_admin/employee-utf8.t view on Meta::CPAN
use 5.012;
use strict;
use warnings;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
$debug_mode = 1;
my ( $cmd, $rv );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
t/cmd_admin/employee.t view on Meta::CPAN
use strict;
use warnings;
use utf8;
#use App::CELL::Test::LogToFile;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI qw( $debug_mode );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
$debug_mode = 1;
my ( $cmd, $rv );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
t/cmd_admin/history.t view on Meta::CPAN
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use App::Dochazka::Common::Model::Privhistory;
use App::Dochazka::Common::Model::Schedhistory;
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
note( 'authenticate to server' );
t/cmd_inactive/activity.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'absent', password => 'absent', quiet => 1 );
t/cmd_inactive/employee.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'absent', password => 'absent', quiet => 1 );
t/cmd_passerby/activity.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
$rv = authenticate_to_server( user => 'demo', password => 'demo', quiet => 1 );
t/cmd_passerby/employee.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
note( 'authenticate to server' );
t/cmd_passerby/schedule.t view on Meta::CPAN
#!perl
use 5.012;
use strict;
use warnings;
use App::CELL qw( $CELL $log $meta $site );
use App::Dochazka::CLI::Parser qw( process_command );
use App::Dochazka::CLI::Test qw( init_unit );
use App::Dochazka::CLI::Util qw( authenticate_to_server );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $rv );
note( 'initialize unit' );
$rv = init_unit();
plan skip_all => "init_unit failed with status " . $rv->text unless $rv->ok;
note( 'authenticate to server' );
t/parser/parse_test.t view on Meta::CPAN
#
# test parsing of various command strings
#!perl
use 5.012;
use strict;
use warnings;
use App::Dochazka::CLI::Parser qw( parse $semantic_tree );
use App::Dochazka::CLI::Test qw( do_parse_test );
use Data::Dumper;
use Test::More;
use Test::Warnings;
my ( $cmd, $r, $r_should_be, $coderef );
#================================
# REST Test commands
#================================