Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 67d091d

Convert to Build.PL.

  • Participants
  • Parent commits 885ec75

Comments (0)

Files changed (4)

File abc-path/Games-ABC_Path-Solver/Build.PL

+use strict;
+use warnings;
+
+use File::Spec;
+use lib File::Spec->catdir(File::Spec->curdir(), "inc");
+
+use Test::Run::Builder;
+
+my $builder = Test::Run::Builder->new(
+    module_name         => 'Games::ABC_Path::Solver',
+    license             => 'mit',
+    dist_author         => 'Shlomi Fish <shlomif@cpan.org>',
+    build_requires => {
+        'Test::More' => 0,
+    },
+    requires => {
+        'base' => 0,
+        'Carp' => 0,
+        'Getopt::Long' => '2.36',
+    },
+    add_to_cleanup      => [ 'Games-Solitaire-Verify-*' ],
+    create_makefile_pl => 'traditional',
+    script_files => [
+        # "script/abc-path-solve",
+    ],
+    meta_merge =>
+    {
+        resources =>
+        {
+            repository => "http://svn.berlios.de/svnroot/repos/fc-solve/abc-path/",
+            homepage => "http://www.shlomifish.org/open-source/projects/japanese-puzzle-games/abc-path/",
+        },
+        keywords =>
+        [
+            "abc",
+            "game",
+            "games",
+            "grid",
+            "letters",
+            "path",
+            "puzzle",
+            "puzzles",
+            "riddle",
+            "riddles",
+            "table",
+        ],
+    },
+
+);
+
+$builder->create_build_script();

File abc-path/Games-ABC_Path-Solver/MANIFEST

+Build.PL
 Changes
-MANIFEST
-Makefile.PL
-README
-lib/Games/ABC_Path/Solver.pm
+inc/Test/Run/Builder.pm
 lib/Games/ABC_Path/Solver/Base.pm
 lib/Games/ABC_Path/Solver/Board.pm
 lib/Games/ABC_Path/Solver/Move.pm
+lib/Games/ABC_Path/Solver.pm
+Makefile.PL
+MANIFEST
+README
 t/00-load.t
 t/pod-coverage.t
 t/pod.t

File abc-path/Games-ABC_Path-Solver/Makefile.PL

-use strict;
-use warnings;
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
-    NAME                => 'Games::ABC_Path::Solver::Base',
-    AUTHOR              => q{Shlomi Fish <shlomif@cpan.org>},
-    VERSION_FROM        => 'lib/Games/ABC_Path/Solver/Base.pm',
-    ABSTRACT_FROM       => 'lib/Games/ABC_Path/Solver/Base.pm',
-    ($ExtUtils::MakeMaker::VERSION >= 6.3002
-      ? ('LICENSE'=> 'mit')
-      : ()),
-    PL_FILES            => {},
-    PREREQ_PM => {
-        'Test::More' => 0,
-    },
-    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
-    clean               => { FILES => 'Games-ABC_Path-Solver-*' },
-);

File abc-path/Games-ABC_Path-Solver/inc/Test/Run/Builder.pm

+package Test::Run::Builder;
+
+use strict;
+use warnings;
+
+use Module::Build;
+
+use vars qw(@ISA);
+
+@ISA = (qw(Module::Build));
+
+sub ACTION_runtest
+{
+    my ($self) = @_;
+    my $p = $self->{properties};
+
+    $self->depends_on('code');
+
+    local @INC = @INC;
+
+    # Make sure we test the module in blib/
+    unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'),
+		 File::Spec->catdir($p->{base_dir}, $self->blib, 'arch'));
+
+    $self->do_test_run_tests;
+}
+
+sub ACTION_distruntest {
+  my ($self) = @_;
+
+  $self->depends_on('distdir');
+
+  my $start_dir = $self->cwd;
+  my $dist_dir = $self->dist_dir;
+  chdir $dist_dir or die "Cannot chdir to $dist_dir: $!";
+  # XXX could be different names for scripts
+
+  $self->run_perl_script('Build.PL') # XXX Should this be run w/ --nouse-rcfile
+      or die "Error executing 'Build.PL' in dist directory: $!";
+  $self->run_perl_script('Build')
+      or die "Error executing 'Build' in dist directory: $!";
+  $self->run_perl_script('Build', [], ['runtest'])
+      or die "Error executing 'Build test' in dist directory";
+  chdir $start_dir;
+}
+
+sub do_test_run_tests
+{
+    my $self = shift;
+
+    require Test::Run::CmdLine::Iface;
+
+    my $test_run =
+        Test::Run::CmdLine::Iface->new(
+            {
+                'test_files' => [glob("t/*.t")],
+            }   
+            # 'backend_params' => $self->_get_backend_params(),
+        );
+
+    return $test_run->run();
+}
+
+1;
+