From 63afa40a4691cd73c543ff4f952beceb95db8841 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 2 Oct 2015 21:26:36 +0300 Subject: [PATCH] Write POD for Gruntmaster::App::* --- MANIFEST | 1 + lib/Gruntmaster/App.pm | 21 +++++++++- lib/Gruntmaster/App/Command.pm | 61 ++++++++++++++++++++++++++++ lib/Gruntmaster/App/Command/Add.pm | 36 ++++++++++++++++ lib/Gruntmaster/App/Command/Get.pm | 45 ++++++++++++++++++++ lib/Gruntmaster/App/Command/List.pm | 49 ++++++++++++++++++++++ lib/Gruntmaster/App/Command/Rerun.pm | 34 ++++++++++++++++ lib/Gruntmaster/App/Command/Rm.pm | 36 ++++++++++++++++ lib/Gruntmaster/App/Command/Set.pm | 38 +++++++++++++++++ lib/Gruntmaster/App/Command/Show.pm | 37 +++++++++++++++++ 10 files changed, 357 insertions(+), 1 deletion(-) create mode 100644 lib/Gruntmaster/App/Command.pm diff --git a/MANIFEST b/MANIFEST index 6a285eb..7b03592 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3,6 +3,7 @@ db.sql gm gruntmaster-opener lib/Gruntmaster/App.pm +lib/Gruntmaster/App/Command.pm lib/Gruntmaster/App/Command/Add.pm lib/Gruntmaster/App/Command/Get.pm lib/Gruntmaster/App/Command/List.pm diff --git a/lib/Gruntmaster/App.pm b/lib/Gruntmaster/App.pm index f206928..b87cf17 100644 --- a/lib/Gruntmaster/App.pm +++ b/lib/Gruntmaster/App.pm @@ -34,10 +34,29 @@ Gruntmaster::App - command-line interface to the Gruntmaster 6000 database =head1 SYNOPSIS - + use Gruntmaster::App; + Gruntmaster::App->run; =head1 DESCRIPTION +Gruntmaster::App is a command-line interface to the Gruntmaster 6000 +database. It is the backend of the B script. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. =cut diff --git a/lib/Gruntmaster/App/Command.pm b/lib/Gruntmaster/App/Command.pm new file mode 100644 index 0000000..b1be168 --- /dev/null +++ b/lib/Gruntmaster/App/Command.pm @@ -0,0 +1,61 @@ +package Gruntmaster::App::Command; + +use 5.014000; +use strict; +use warnings; + +our $VERSION = '5999.000_004'; + +use parent qw/App::Cmd::Command/; +use Pod::Usage; + +sub description { + my ($self) = @_; + my ($file) = (ref $self) =~ s,::,/,gr; + my $usage; + open my $fh, '>', \$usage; + pod2usage(-input => $INC{"$file.pm"}, -output => $fh, -exitval => 'NOEXIT', -verbose => 99, -sections => [qw/SYNOPSIS DESCRIPTION/]); + close $fh; + $usage =~ s/Usage:/Usage examples:/; + 1 while chomp $usage; + $usage +} + +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command - Base class for gm commands + +=head1 SYNOPSIS + + package Gruntmaster::App::Command::foo; + use Gruntmaster::App '-command'; + +=head1 DESCRIPTION + +Gruntmaster::App::Command is the base class of all gm commands. Its +only role is to extract a command's documentation from its POD by +overriding the description method to use L. + +=head1 SEE ALSO + +L, L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Add.pm b/lib/Gruntmaster/App/Command/Add.pm index b161904..5e8b07a 100644 --- a/lib/Gruntmaster/App/Command/Add.pm +++ b/lib/Gruntmaster/App/Command/Add.pm @@ -122,3 +122,39 @@ sub add_problem { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Add - add a problem or contest by answering a series of prompts + +=head1 SYNOPSIS + + gm -p add aplusb + gm -c add test_contest + +=head1 DESCRIPTION + +The add command creates a new problem or contest by prompting the user +for the properties of the new object. It takes a single argument, the +ID of the new object. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Get.pm b/lib/Gruntmaster/App/Command/Get.pm index ab547ad..2763f78 100644 --- a/lib/Gruntmaster/App/Command/Get.pm +++ b/lib/Gruntmaster/App/Command/Get.pm @@ -25,3 +25,48 @@ sub execute { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Get - get a property of an object + +=head1 SYNOPSIS + + gm -u get MGV name + # Marius Gavrilescu + + gm -p get aplusb level + # beginner + + gm -c get test_ct description + # This is a test contest.
+ # Nothing to see here. + + gm -j get 100 result_text + # Accepted + +=head1 DESCRIPTION + +The get command takes two arguments: an object id and a property name, +and returns the value of that property. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/List.pm b/lib/Gruntmaster/App/Command/List.pm index 3c62604..e447a67 100644 --- a/lib/Gruntmaster/App/Command/List.pm +++ b/lib/Gruntmaster/App/Command/List.pm @@ -23,3 +23,52 @@ sub execute { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::List - list all objects of a type + +=head1 SYNOPSIS + + gm -c list + # test_contest + # some_other_contest + + gm -j list # This is pretty pointless + # 1 + # 2 + # 3 + + gm -p list + # aplusb + # aminusb + + gm -u list + # MGV + # nobody + +=head1 DESCRIPTION + +The list command lists the IDs of all objects of a type, one per line. +The list is sorted. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Rerun.pm b/lib/Gruntmaster/App/Command/Rerun.pm index a63800b..9c6b270 100644 --- a/lib/Gruntmaster/App/Command/Rerun.pm +++ b/lib/Gruntmaster/App/Command/Rerun.pm @@ -25,3 +25,37 @@ sub execute { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Rerun - rerun a job + +=head1 SYNOPSIS + + gm rerun 123 + +=head1 DESCRIPTION + +The rerun command takes the ID of a job, clears its result, and makes +B rerun it. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Rm.pm b/lib/Gruntmaster/App/Command/Rm.pm index 25dc450..84b4237 100644 --- a/lib/Gruntmaster/App/Command/Rm.pm +++ b/lib/Gruntmaster/App/Command/Rm.pm @@ -25,3 +25,39 @@ sub execute { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Rm - remove an object + +=head1 SYNOPSIS + + gm -c rm test_contest + gm -p rm aplusb + gm -j rm 10 + gm -u rm MGV + +=head1 DESCRIPTION + +The rm command takes the ID of an object and removes it. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Set.pm b/lib/Gruntmaster/App/Command/Set.pm index b3754dd..3ae62b0 100644 --- a/lib/Gruntmaster/App/Command/Set.pm +++ b/lib/Gruntmaster/App/Command/Set.pm @@ -33,3 +33,41 @@ sub execute { 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Set - set a property of an object + +=head1 SYNOPSIS + + gm -u set MGV name 'Marius Gavrilescu' + gm -p set aplusb level beginner + gm -c set test_ct 'This is a test contest.
Nothing to see here' + gm -j set 100 result_text Accepted + +=head1 DESCRIPTION + +The set command takes three arguments: an object id, a property name, +and a value. It sets the given property of the given object to the +given value. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut diff --git a/lib/Gruntmaster/App/Command/Show.pm b/lib/Gruntmaster/App/Command/Show.pm index 45f3eef..fbdac50 100644 --- a/lib/Gruntmaster/App/Command/Show.pm +++ b/lib/Gruntmaster/App/Command/Show.pm @@ -100,3 +100,40 @@ END 1; __END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::App::Command::Show - display human-readable information about an object + +=head1 SYNOPSIS + + gm -u show MGV + gm -p show aplusb + gm -c show test_ct + gm -j show 100 + +=head1 DESCRIPTION + +The get command takes an object ID and prints information about that +object in a human-readable format. + +=head1 SEE ALSO + +L + +=head1 AUTHOR + +Marius Gavrilescu, Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2015 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.20.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut -- 2.39.2