Game-FaceGenerator

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

         "requires" : {
            "ExtUtils::MakeMaker" : "6.52",
            "File::ShareDir::Install" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "File::ShareDir" : "0",
            "File::Slurper" : "0",
            "GD" : "0",
            "Modern::Perl" : "1.20180701",
            "Mojolicious" : "0",
            "Mojolicious::Plugin::Authentication" : "0",
            "perl" : "5.026000",
            "strict" : "0",
            "warnings" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {

META.yml  view on Meta::CPAN

  version: '1.4'
name: Game-FaceGenerator
no_index:
  directory:
    - t
    - inc
requires:
  File::ShareDir: '0'
  File::Slurper: '0'
  GD: '0'
  Modern::Perl: '1.20180701'
  Mojolicious: '0'
  Mojolicious::Plugin::Authentication: '0'
  perl: '5.026000'
  strict: '0'
  warnings: '0'
resources:
  repository: https://alexschroeder.ch/cgit/face-generator
version: 1.03
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use File::ShareDir::Install;

install_share 'share';

WriteMakefile(
  NAME             => 'Game::FaceGenerator',
  VERSION_FROM     => 'lib/Game/FaceGenerator.pm',
  ABSTRACT_FROM    => 'lib/Game/FaceGenerator.pm',
  AUTHOR           => 'Alex Schroeder',
  LICENSE          => 'agpl_3',
  MIN_PERL_VERSION => '5.26.0', # Modern::Perl '2018'
  EXE_FILES        => [
    'script/face-generator',
  ],
  PREREQ_PM => {
    'strict' => 0,
    'warnings' => 0,
    'Modern::Perl' => 1.20180701, # for '2018'
    'File::ShareDir' => 0,
    'File::Slurper' => 0,
    'Mojolicious' => 0,
    'Mojolicious::Plugin::Authentication' => 0,
    'GD' => 0,
  },
  CONFIGURE_REQUIRES => {
    'ExtUtils::MakeMaker' => '6.52',
    'File::ShareDir::Install' => 0,
  },

lib/Game/FaceGenerator.pm  view on Meta::CPAN

framework. This class in particular uses L<Mojolicious::Lite>.

See L<Mojolicious::Guides> for more information.

=cut

package Game::FaceGenerator;

our $VERSION = 1.03;

use Modern::Perl;
use Mojolicious::Lite;
use File::ShareDir 'dist_dir';
use Game::FaceGenerator::Core qw(
  dir no_flip all_artists random_components all_components
  all_elements render_components move);
use Cwd;

# Commands for the command line!
push @{app->commands->namespaces}, 'Game::FaceGenerator::Command';

lib/Game/FaceGenerator/Command/random.pm  view on Meta::CPAN

C<help> prints the man page.

=head1 EXAMPLES

    face-generator random alex man | display

=cut

package Game::FaceGenerator::Command::random;

use Modern::Perl;
use Mojo::Base 'Mojolicious::Command';
use Pod::Simple::Text;
use Game::FaceGenerator::Core qw(random_components render_components);

has description => 'Print a random face to STDOUT';

has usage => sub { my $self = shift; $self->extract_usage };

sub run {
  my ($self, $artist, $type, @args) = @_;

lib/Game/FaceGenerator/Core.pm  view on Meta::CPAN

This module provides the subroutines that L<Game::FaceGenerator> needs.

=cut

package Game::FaceGenerator::Core;

require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(dir no_flip all_artists random_components all_components all_elements render_components move);

use Modern::Perl;
use File::ShareDir qw(dist_dir);
use File::Slurper qw(read_dir read_text read_binary write_binary);
use List::Util 'any';
use Cwd;
use GD;

sub member {
  my $element = shift;
  foreach (@_) {
    return 1 if $element eq $_;

t/commands.t  view on Meta::CPAN

# later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Mojo::File;

my $script = Mojo::File->new('script', 'face-generator');

# random

# https://en.wikipedia.org/wiki/List_of_file_signatures → PNG
my $re = join('', map { chr(hex($_)) } qw(89 50 4E 47 0D 0A 1A 0A));
like(qx($^X $script random alex man), qr/^$re/, "random alex man is PNG");

t/face.t  view on Meta::CPAN

# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.

use Modern::Perl;
use Test::More;
use Test::Mojo;
use FindBin;
use GD;
use strict;
use warnings;
use File::Temp qw(tempdir);
use File::Slurper qw(write_binary);

my $t = Test::Mojo->new('Game::FaceGenerator');



( run in 1.655 second using v1.01-cache-2.11-cpan-a5abf4f5562 )