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
=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<gm> script.
+
+=head1 SEE ALSO
+
+L<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
--- /dev/null
+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<Pod::Usage>.
+
+=head1 SEE ALSO
+
+L<Gruntmaster::App>, L<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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 <b>test</b> contest.<br>
+ # 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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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<gruntmaster-daemon> rerun it.
+
+=head1 SEE ALSO
+
+L<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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 <b>test</b> contest.<br>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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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
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<gm>
+
+=head1 AUTHOR
+
+Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
+
+=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