Apologies if you find the reopening of this rejected request offensive,
but I didn't see much point in opening a duplicate bug.
I have the feeling we may not see a fix for Test::Spelling any time soon
Additionally, this problem also impacts not just PodSpellingTests, but
also your Pod::Wordlist::hanekomu (
http://matrix.cpantesters.org/?dist=Pod-Wordlist-hanekomu+1.100860 )
So, as a result, I have coded up a temporary workaround that can be
integrated until such time as Test::Spelling works as needed.
The solution basically checks a fallback list of system spelling commands.
Its partially incomplete, and if you miss either of the 2 alternatives
to "spell", present behaviour is to just use "spell" and possibly fail
in the same way it presently does.
I've left indicators for other things that may wish to be supported
later, but at present, it should mostly work with both aspell and hunspell.
I've added the changes to my branch on github (
http://github.com/kentfredric/Dist-Zilla-Plugin-PodSpellingTests/commits/SystemSpell
)
And also a patch for the net difference has been attached.
I hope you find this useful =).
diff --git a/Changes b/Changes
index 67e9a62..b56acef 100644
--- a/Changes
+++ b/Changes
@@ -2,6 +2,8 @@ Revision history for Perl extension {{$dist->name}}
{{$NEXT}}
+ - Added workaround for Test::Spelling's defects on various platforms. ( Kent Fredric )
+
1.101420 2010-05-22 18:07:04 Europe/Vienna
- removed weaver.ini since that's handled in Dist::Zilla's [@MARCEL] now
- list Test::Spelling in dist.ini so we don't use() it anymore
diff --git a/lib/Dist/Zilla/Plugin/PodSpellingTests.pm b/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
index 8d7175f..63fe1c2 100644
--- a/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
+++ b/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
@@ -38,6 +38,7 @@ ___[ xt/release/pod-spell.t ]___
#!perl
use Test::More;
+use Carp qw();
eval "use Pod::Wordlist::hanekomu";
plan skip_all => "Pod::Wordlist:hanekomu required for testing POD spelling"
@@ -47,5 +48,77 @@ eval "use Test::Spelling";
plan skip_all => "Test::Spelling required for testing POD spelling"
if $@;
+#
+# Temporary workaround for Test::Spelling to work on systems without 'spell'
+# until Test::Spelling gets around to fixing it.
+#
+# Order values to make re-prioritising easier later. I've set aspell to be default to check first
+# because I don't know how to reliably test for "spell" as I don't have it and can't get it.
+#
+my @cmds = sort { $a->{order} <=> $b->{order} } (
+
+ # do we need '-l en " for aspell?
+ {
+ order => 1,
+ name => 'aspell',
+ args => 'aspell list',
+ check => sub {
+ open my $fh, '-|', 'aspell', '--help' or return;
+ while ( defined( my $line = <$fh> ) ) {
+ return 1 if $line =~ qr/^\s*list\s*produce.*misspelled/;
+ }
+ return;
+ },
+ },
+ {
+ order => 2,
+ name => 'hunspell',
+ args => 'hunspell -l',
+ check => sub {
+
+ # Urgh. Yuck.
+ open my $fh, '-|', 'hunspell --help 2>&1' or return;
+ while ( defined( my $line = <$fh> ) ) {
+ return 1 if $line =~ qr/^\s*-l\s*print.*misspelled/;
+ }
+ return;
+ },
+ },
+ {
+ order => 3,
+ name => 'ispell',
+ args => 'ispell',
+ check => sub {
+ return; # I don't have this, so somebody else will have to add support
+ },
+ },
+ {
+ order => 4,
+ name => 'spell',
+ args => 'spell',
+ check => sub {
+
+ # TODO: Do a real test, currently we just return 1.
+ # So if it doesn't work, its no worse than it currently is. ( Broken )
+ return 1;
+ },
+ },
+ {
+ order => 99,
+ name => undef,
+ args => undef,
+ check => sub {
+ Carp::croak("No `spell' function available.");
+ },
+ }
+);
+
+for my $cmd (@cmds) {
+ next unless $cmd->{check}->();
+ warn "Using $cmd->{name} for spelling ( $cmd->{args} )";
+ set_spell_cmd( $cmd->{args} );
+ last;
+}
+
all_pod_files_spelling_ok('lib');