[libdist-zilla-plugin-test-podspelling-perl] 10/86: added configuration (wordlist, spell_cmd, stopwords) to this plugin (thanks harleypig)

Axel Beckert abe at deuxchevaux.org
Mon May 25 10:02:00 UTC 2015


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to annotated tag 2.001001
in repository libdist-zilla-plugin-test-podspelling-perl.

commit 4cc02208e0e52d0aaf899725b09a849b2bcad3c8
Author: Marcel Gruenauer <hanekomu at gmail.com>
Date:   Wed Dec 15 16:58:05 2010 +0100

    added configuration (wordlist, spell_cmd, stopwords) to this plugin (thanks harleypig)
---
 Changes                                   |  2 +
 README                                    | 84 +++++++++++++++++++++++++++
 dist.ini                                  |  5 +-
 lib/Dist/Zilla/Plugin/PodSpellingTests.pm | 96 +++++++++++++++++++++++++++++--
 4 files changed, 182 insertions(+), 5 deletions(-)

diff --git a/Changes b/Changes
index 67e9a62..100ec74 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Revision history for Perl extension {{$dist->name}}
 
 {{$NEXT}}
+    - added configuration (wordlist, spell_cmd, stopwords) to this plugin
+      (thanks harleypig)
 
 1.101420  2010-05-22 18:07:04 Europe/Vienna
     - removed weaver.ini since that's handled in Dist::Zilla's [@MARCEL] now
diff --git a/README b/README
new file mode 100644
index 0000000..c0b34ae
--- /dev/null
+++ b/README
@@ -0,0 +1,84 @@
+NAME
+    Dist::Zilla::Plugin::PodSpellingTests - Release tests for POD spelling
+
+VERSION
+    version 1.103490
+
+SYNOPSIS
+    In "dist.ini":
+
+        [PodSpellingTests]
+
+    or:
+
+        [PodSpellingTests]
+        wordlist = Pod::Wordlist
+        spell_cmd = aspell list
+        stopwords = CPAN
+        stopwords = github
+        stopwords = stopwords
+        stopwords = wordlist
+
+DESCRIPTION
+    This is an extension of Dist::Zilla::Plugin::InlineFiles, providing the
+    following file:
+
+      xt/release/pod-spell.t - a standard Test::Spelling test
+
+METHODS
+  wordlist
+    The module name of a word list you wish to use that works with
+    Test::Spelling.
+
+    Defaults to Pod::Wordlist::hanekomu.
+
+  spell_cmd
+    If "spell_cmd" is set then "set_spell_cmd( your_spell_command );" added
+    to the test file to allow.
+
+    Defaults to nothing.
+
+  stopwords
+    If stopwords is set then "add_stopwords( <DATA" )> is added to the test
+    file and the words are added after the __DATA__ section.
+
+    "stopwords" can appear multiple times, one word per line.
+
+    Defaults to nothing.
+
+ATTRIBUTES
+INSTALLATION
+    See perlmodinstall for information and options on installing Perl
+    modules.
+
+BUGS AND LIMITATIONS
+    No bugs have been reported.
+
+    Please report any bugs or feature requests through the web interface at
+    <http://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-PodS
+    pellingTests>.
+
+AVAILABILITY
+    The latest version of this module is available from the Comprehensive
+    Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a
+    CPAN site near you, or see
+    <http://search.cpan.org/dist/Dist-Zilla-Plugin-PodSpellingTests/>.
+
+    The development version lives at
+    <http://github.com/hanekomu/Dist-Zilla-Plugin-PodSpellingTests.git> and
+    may be cloned from
+    <git://github.com/hanekomu/Dist-Zilla-Plugin-PodSpellingTests.git>.
+    Instead of sending patches, please fork this project using the standard
+    git and github infrastructure.
+
+AUTHORS
+    *   Marcel Gruenauer <marcel at cpan.org>
+
+    *   Harley Pig <harleypig at gmail.com>
+
+COPYRIGHT AND LICENSE
+    This software is copyright (c) 2010 by Marcel Gruenauer.
+
+    This is free software; you can redistribute it and/or modify it under
+    the same terms as the Perl 5 programming language system itself.
+
diff --git a/dist.ini b/dist.ini
index 3cdf635..85f6404 100644
--- a/dist.ini
+++ b/dist.ini
@@ -1,7 +1,10 @@
 name = Dist-Zilla-Plugin-PodSpellingTests
+author = Marcel Gruenauer <marcel at cpan.org>
+author = Harley Pig <harleypig at gmail.com>
 copyright_year = 2010
 
 [@MARCEL]
 
-[Prereq]
+[Prereqs]
 Test::Spelling = 0
+Pod::Wordlist::hanekomu = 0
diff --git a/lib/Dist/Zilla/Plugin/PodSpellingTests.pm b/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
index de6150d..38068f8 100644
--- a/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
+++ b/lib/Dist/Zilla/Plugin/PodSpellingTests.pm
@@ -3,17 +3,60 @@ use strict;
 use warnings;
 
 package Dist::Zilla::Plugin::PodSpellingTests;
+
 # ABSTRACT: Release tests for POD spelling
 use Moose;
-use Pod::Wordlist::hanekomu;
 extends 'Dist::Zilla::Plugin::InlineFiles';
-
+with 'Dist::Zilla::Role::TextTemplate';
+sub mvp_multivalue_args { qw( stopwords ) }
+has wordlist => (
+    is      => 'ro',
+    isa     => 'Str',
+    default => 'Pod::Wordlist::hanekomu',    # default to original
+);
+has spell_cmd => (
+    is      => 'ro',
+    isa     => 'Str',
+    default => '',                           # default to original
+);
+has stopwords => (
+    is      => 'ro',
+    isa     => 'ArrayRef[Str]',
+    default => sub { [] },                   # default to original
+);
+around add_file => sub {
+    my ($orig, $self, $file) = @_;
+    my ($set_spell_cmd, $add_stopwords, $stopwords);
+    if ($self->spell_cmd) {
+        $set_spell_cmd = sprintf "set_spell_cmd('%s');", $self->spell_cmd;
+    }
+    if (@{ $self->stopwords } > 0) {
+        $add_stopwords = 'add_stopwords(<DATA>);';
+        $stopwords = join "\n", '__DATA__', @{ $self->stopwords };
+    }
+    $self->$orig(
+        Dist::Zilla::File::InMemory->new(
+            {   name    => $file->name,
+                content => $self->fill_in_string(
+                    $file->content,
+                    {   wordlist      => \$self->wordlist,
+                        set_spell_cmd => \$set_spell_cmd,
+                        add_stopwords => \$add_stopwords,
+                        stopwords     => \$stopwords,
+                    },
+                ),
+            }
+        ),
+    );
+};
 __PACKAGE__->meta->make_immutable;
 no Moose;
 1;
 
 =begin :prelude
 
+=for stopwords wordlist
+
 =for test_synopsis
 1;
 __END__
@@ -26,6 +69,16 @@ In C<dist.ini>:
 
     [PodSpellingTests]
 
+or:
+
+    [PodSpellingTests]
+    wordlist = Pod::Wordlist
+    spell_cmd = aspell list
+    stopwords = CPAN
+    stopwords = github
+    stopwords = stopwords
+    stopwords = wordlist
+
 =head1 DESCRIPTION
 
 This is an extension of L<Dist::Zilla::Plugin::InlineFiles>, providing the
@@ -33,6 +86,37 @@ following file:
 
   xt/release/pod-spell.t - a standard Test::Spelling test
 
+=head1 ATTRIBUTES
+
+=method wordlist
+
+The module name of a word list you wish to use that works with
+L<Test::Spelling>.
+
+Defaults to L<Pod::Wordlist::hanekomu>.
+
+=method spell_cmd
+
+If C<spell_cmd> is set then C<set_spell_cmd( your_spell_command );> added to
+the test file to allow.
+
+Defaults to nothing.
+
+=method stopwords
+
+If stopwords is set then C<add_stopwords( <DATA> )> is added to the test file
+and the words are added after the __DATA__ section.
+
+C<stopwords> can appear multiple times, one word per line.
+
+Defaults to nothing.
+
+=begin Pod::Coverage
+
+mvp_multivalue_args
+
+=end Pod::Coverage
+
 =cut
 
 __DATA__
@@ -41,12 +125,16 @@ ___[ xt/release/pod-spell.t ]___
 
 use Test::More;
 
-eval "use Pod::Wordlist::hanekomu";
-plan skip_all => "Pod::Wordlist:hanekomu required for testing POD spelling"
+eval "use {{ $wordlist }}";
+plan skip_all => "{{ $wordlist }} required for testing POD spelling"
   if $@;
 
 eval "use Test::Spelling";
 plan skip_all => "Test::Spelling required for testing POD spelling"
   if $@;
 
+{{ $set_spell_cmd }}
+{{ $add_stopwords }}
 all_pod_files_spelling_ok('lib');
+{{ $stopwords }}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdist-zilla-plugin-test-podspelling-perl.git



More information about the Pkg-perl-cvs-commits mailing list