Commits

Shlomi Fish committed a1b5b60

Convert to Test::Run::Builder.

Comments (0)

Files changed (5)

modules/Mail-LMLM/Build.PL

 use strict;
 use warnings;
 
-use Module::Build;
+use lib './inc';
 
-my $build = Module::Build->new(
+use Test::Run::Builder;
+
+my $build = Test::Run::Builder->new(
     'module_name' => "Mail::LMLM",
     'build_requires' => 
     {

modules/Mail-LMLM/MANIFEST

 examples/Iglu/test.pl
 examples/Iglu/upload.sh
 get-version.pl
+inc/Test/Run/Builder.pm
 INSTALL
 lib/Mail/LMLM/Object.pm
 lib/Mail/LMLM.pm

modules/Mail-LMLM/META.yml

 abstract: 'List of Mailing Lists Manager'
 author:
   - unknown
-build_requires: {}
+build_requires:
+  Test::More: 0
 configure_requires:
   Module::Build: 0.38
 dynamic_config: 1
 generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.120630'
-license: bsd
+keywords:
+  - E-mail
+  - 'mailing lists'
+  - 'mailing list'
+  - HTML
+  - manager
+license: mit
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
   version: 1.4
     file: lib/Mail/LMLM/Types/Majordomo.pm
     version: 0
 requires:
-  Test::More: 0
+  strict: 0
+  vars: 0
+  warnings: 0
 resources:
-  license: http://www.opensource.org/licenses/bsd-license.php
+  license: http://www.opensource.org/licenses/mit-license.php
+  repository: http://bitbucket.org/shlomif/perl-mail-lmlm/overview
 version: 0.6801

modules/Mail-LMLM/Makefile.PL

+# Note: this file was auto-generated by Module::Build::Compat version 0.3800
 use ExtUtils::MakeMaker;
-
-my $dist_name = "Mail-LMLM";
-
-WriteMakefile(
-    'NAME' => 'Mail::LMLM',
-    'DISTNAME' => $dist_name,
-    'VERSION_FROM' => 'lib/Mail/LMLM.pm',
-    );
-
-use lib './lib';
-require Mail::LMLM;
-
-my $version = $Mail::LMLM::VERSION;
-
-print "Generating the RPM SPEC file\n";
-my $rpm_spec = "perl-${dist_name}.spec";
-
-# Remove the .spec because it's not writable.
-unlink($rpm_spec);
-
-open I, "<$rpm_spec.in";
-open O, ">$rpm_spec";
-while (<I>)
-{
-    s!\[\[VERSION\]\]!$version!g;
-    print O $_;
-}
-close(O);
-close(I);
+WriteMakefile
+(
+  'PL_FILES' => {},
+  'INSTALLDIRS' => 'site',
+  'NAME' => 'Mail::LMLM',
+  'EXE_FILES' => [],
+  'VERSION_FROM' => 'lib/Mail/LMLM.pm',
+  'PREREQ_PM' => {
+                   'warnings' => 0,
+                   'strict' => 0,
+                   'Test::More' => 0,
+                   'vars' => 0
+                 }
+)
+;

modules/Mail-LMLM/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 get_test_run_test_files
+{
+    return [glob("t/*.t")]
+}
+
+sub do_test_run_tests
+{
+    my $self = shift;
+
+    require Test::Run::CmdLine::Iface;
+
+    my $test_run =
+        Test::Run::CmdLine::Iface->new(
+            {
+                'test_files' => $self->get_test_run_test_files(),
+            }   
+            # 'backend_params' => $self->_get_backend_params(),
+        );
+
+    return $test_run->run();
+}
+
+sub ACTION_tags
+{
+    return 
+        system(qw(
+            ctags -f tags --recurse --totals
+    		--exclude=blib/** --exclude=t/lib/**
+    		--exclude=.svn --exclude='*~'
+    		--languages=Perl --langmap=Perl:+.t
+    ));
+}
+
+1;
+