'File::Spec' => 0,
'FindBin' => 0,
'File::Find' => 0,
+ 'Test::Group' => 0,
},
add_to_cleanup => [ 'Test-NoTabs-*' ],
);
0.1 2006-08-24
- Module created and released on an unsuspecting world.
+
+0.2 2006-08-25
+ - Minor code changes and pod updates
+ - Added Makefile.PL for compatibility
+
+0.3 2006-08-26
+ - Added missing dependancy (Test::Group)
Build.PL
+<<<<<<< HEAD:MANIFEST
+=======
+Makefile.PL
+>>>>>>> trunk:MANIFEST
Changes
MANIFEST
META.yml
--- #YAML:1.0
name: Test-NoTabs
-version: 0.1
+version: 0.3
author:
- Nick Gerakines <nick@socklabs.com>
abstract: Check the presence of tabs in your project
--- /dev/null
+use Module::Build::Compat;
+Module::Build::Compat->run_build_pl(args => \@ARGV);
+Module::Build::Compat->write_makefile();
\ No newline at end of file
use vars qw( $VERSION $PERL $UNTAINT_PATTERN $PERL_PATTERN);
-$VERSION = '0.1';
+$VERSION = '0.3.1';
$PERL = $^X || 'perl';
$UNTAINT_PATTERN = qr|^([-+@\w./:\\]+)$|;
sub notabs_ok {
my $file = shift;
- my $test_txt = shift || "Found tabs in '$file' on line ";
+ my $test_txt = shift || "Found tabs in '$file'";
$file = _module_to_path($file);
- open my($fh), $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; };
+ open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; };
my $line = 0;
while (<$fh>) {
$line++;
- next if (/^\s*#/); # Skip comments
- next if (/^\s*=.+/ .. /^\s*=(cut|back|end)/); # Skip pod
- last if (/^\s*(__END__|__DATA__)/); # End of code
+ next if (/^\s*#/);
+ next if (/^\s*=.+/ .. /^\s*=(cut|back|end)/);
+ last if (/^\s*(__END__|__DATA__)/);
if ( /\t/ ) {
- $Test->ok(0, $test_txt . $line);
+ $Test->ok(0, $test_txt . " on line $line");
return 0;
}
}
my $file = shift;
return 1 if $file =~ /\.pl$/i;
return 1 if $file =~ /\.t$/;
- open my($fh), $file or return;
+ open my $fh, $file or return;
my $first = <$fh>;
return 1 if defined $first && ($first =~ $PERL_PATTERN);
return;
=head1 DESCRIPTION
-This module scans your project/distrobution for any perl files (scripts,
+This module scans your project/distribution for any perl files (scripts,
modules, etc) for the presence of tabs.
=head1 EXPORT
Inspired by some code written by Paul Lindner.
L<Test::Strict> was used as an example when creating this module and
-distrobution.
+distribution.
+
+Rick Myers and Emanuele Zeppieri also provided valuable feedback.
=head1 SEE ALSO
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Config;
+use File::Spec;
+use Test::Chimps::Client;
+use Test::TAP::Model::Visual;
+
+chdir "$FindBin::Bin/..";
+
+my @tests = map glob, qw(t/*.t);
+my $start = time;
+my $model = Test::TAP::Model::Visual->new_with_tests(@tests);
+
+my $client = Test::Chimps::Client->new(
+ server => 'http://dev.socklabs.com/cgi-bin/chimps-server.pl',
+ model => $model,
+ report_variables => {
+ archname => $Config{archname},
+ committer => $ENV{USER} || $ENV{USERNAME},
+ osname => $Config{osname},
+ osvers => $Config{osvers},
+ project => 'Test-NoTabs',
+ duration => time - $start,
+ revision => get_revision(),
+ },
+);
+
+my ($status, $msg) = $client->send;
+if (! $status) {
+ print "Error: $msg\n";
+ exit(1);
+}
+
+sub get_revision {
+ return
+ # extract_revision('svk', 'svk info', qr/Mirrored From: .*Rev\. (\d+)/) ||
+ extract_revision('svn', 'svn info', qr/Revision: (\d+)/) ||
+ extract_svn_revision('.svn/entries') ||
+ 'unknown';
+}
+
+sub extract_revision {
+ my($cmd, $command, $re) = @_;
+
+ return unless has_command($cmd);
+
+ my $out = qx($command) or return;
+ $out =~ /$re/;
+ return $1;
+}
+
+sub has_command {
+ my $cmd = shift;
+ grep { -e File::Spec->catfile($_, $cmd) } split /:/, $ENV{PATH};
+}
+
+sub extract_svn_revision {
+ my $file = shift;
+ open my($fh), $file or return;
+ while (<$fh>) {
+ /revision="(\d+)"/ and return $1;
+ }
+ return;
+}