From d3ce5a50d93a824598e702c2fdd4ef9873810443 Mon Sep 17 00:00:00 2001 From: Jakob Voss Date: Thu, 10 May 2018 14:16:54 +0200 Subject: [PATCH] Test at Windows with AppVeyor --- .appveyor.yml | 18 ++++++++++++++++++ .travis.yml | 1 + lib/Pod/Pandoc.pm | 9 +++++++-- lib/Pod/Simple/Pandoc.pm | 12 +++++------- t/pod-simple-pandoc-parse-modules.t | 3 +++ 5 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..099e066 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,18 @@ +cache: + - C:\strawberry + +install: + - if not exist "C:\strawberry" choco install strawberryperl -y + - set PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% + - cd %APPVEYOR_BUILD_FOLDER% + - cpanm --quiet --installdeps --with-develop --notest . + +build_script: + - perl Build.Pl + - perl Build + +test_script: + - perl Build test # test without Pandoc + - cinst -y pandoc + - perl Build test # test again with Pandoc + diff --git a/.travis.yml b/.travis.yml index e344e06..1cc5fc2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,7 @@ sudo: required dist: trusty # includes pandoc 1.12.2.1 perl: + - "5.26" - "5.24" - "5.22" - "5.20" diff --git a/lib/Pod/Pandoc.pm b/lib/Pod/Pandoc.pm index 27e94f5..77395a9 100644 --- a/lib/Pod/Pandoc.pm +++ b/lib/Pod/Pandoc.pm @@ -20,7 +20,8 @@ Pod::Pandoc - process Plain Old Documentation format with Pandoc # STATUS -[![Build Status](https://travis-ci.org/nichtich/Pod-Pandoc.svg)](https://travis-ci.org/nichtich/Pod-Pandoc) +[![Unix Build Status](https://travis-ci.org/nichtich/Pod-Pandoc.svg)](https://travis-ci.org/nichtich/Pod-Pandoc) +[![Windows Build status](https://ci.appveyor.com/api/projects/status/lfskwt20v0ofj5ix?svg=true)](https://ci.appveyor.com/project/nichtich/pod-pandoc) [![Coverage Status](https://coveralls.io/repos/nichtich/Pod-Pandoc/badge.svg)](https://coveralls.io/r/nichtich/Pod-Pandoc) [![Kwalitee Score](http://cpants.cpanauthors.org/dist/Pod-Pandoc.png)](http://cpants.cpanauthors.org/dist/Pod-Pandoc) [![Code Climate Issue Count](https://codeclimate.com/github/nichtich/Pod-Pandoc/badges/issue_count.svg)](https://codeclimate.com/github/nichtich/Pod-Pandoc) @@ -97,7 +98,7 @@ L. =head1 SEE ALSO -This module is basde on the wrapper module L to execute pandoc from Perl +This module is based on the wrapper module L to execute pandoc from Perl and on the module L for pandoc document processing. This module makes obsolete several specialized C modules such @@ -113,6 +114,10 @@ L. Jakob Voß Ejakob.voss@gbv.deE +=head1 CONTRIBUTORS + +Benct Philip Jonsson + =head1 COPYRIGHT AND LICENSE Copyright 2017- Jakob Voß diff --git a/lib/Pod/Simple/Pandoc.pm b/lib/Pod/Simple/Pandoc.pm index bde829d..ad303ea 100644 --- a/lib/Pod/Simple/Pandoc.pm +++ b/lib/Pod/Simple/Pandoc.pm @@ -6,6 +6,7 @@ use 5.010; our $VERSION = '0.346.0'; use Pod::Simple::SimpleTree; +use Pod::Perldoc; use Pandoc::Elements; use Pandoc::Filter::HeaderIdentifiers; use Pod::Pandoc::Modules; @@ -73,12 +74,9 @@ sub parse_file { sub parse_module { my ( $self, $name ) = @_; - # map module name to name - run3 [ 'perldoc', '-lm', $name ], undef, \$name; - croak $? if $?; - chomp $name; + my ($file) = Pod::Perldoc->new->grand_search_init([$name]); - $self->parse_file($name); + $self->parse_file($file); } sub parse_string { @@ -134,7 +132,7 @@ sub parse_and_merge { sub is_perl_file { my $file = shift; return 1 if $file =~ /\.(pm|pod)$/; - if ( -x $file ) { + if ( -f $file ) { open( my $fh, '<', $file ) or return; return 1 if $fh and ( <$fh> // '' ) =~ /^#!.*perl/; } @@ -467,7 +465,7 @@ C. =head2 parse_module( $module ) -Reads Pod from a module given by name such as C<"Pod::Pandoc">. +Reads Pod from a module given by name such as C<"Pod::Pandoc"> or by URL. =head2 parse_string( $string ) diff --git a/t/pod-simple-pandoc-parse-modules.t b/t/pod-simple-pandoc-parse-modules.t index 9ff2684..9fd0e99 100644 --- a/t/pod-simple-pandoc-parse-modules.t +++ b/t/pod-simple-pandoc-parse-modules.t @@ -1,8 +1,11 @@ use strict; use Test::More; use Pod::Simple::Pandoc; +use Pandoc; use Test::Output; +plan skip_all => 'pandoc not available' unless pandoc; + my $modules; stderr_is {