Commit 28416637 authored by Kent Fredric's avatar Kent Fredric

Build results of 1d1d366 (on master)

parent e265bba5
# git help shortlog
# newname <newaddr> oldname <oldaddr>
<kentnl@cpan.org> <kentfredric@gmail.com>
language: perl
matrix:
allow_failures:
- perl: "5.8"
- env: STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1
- env: STERILIZE_ENV=0 DEVELOPER_DEPS=1
include:
- perl: "5.8"
env: STERILIZE_ENV=0
- perl: "5.10"
env: STERILIZE_ENV=0
- perl: "5.12"
env: STERILIZE_ENV=0
- perl: "5.14"
env: STERILIZE_ENV=0
- perl: "5.16"
env: STERILIZE_ENV=0
- perl: "5.20"
env: STERILIZE_ENV=0
- perl: "5.21"
env: STERILIZE_ENV=0
- perl: "5.8"
env: STERILIZE_ENV=1
- perl: "5.10"
env: STERILIZE_ENV=1
- perl: "5.12"
env: STERILIZE_ENV=1
- perl: "5.14"
env: STERILIZE_ENV=1
- perl: "5.20"
env: STERILIZE_ENV=1
- perl: "5.21"
env: STERILIZE_ENV=1
- perl: "5.21"
env: STERILIZE_ENV=0 DEVELOPER_DEPS=1
- perl: "5.21"
env: STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1
- perl: "5.21"
env: STERILIZE_ENV=0 COVERAGE_TESTING=1
---
after_failure:
- perl ./maint-travis-ci/report_fail_ctx.pl
before_install:
- perlbrew list
- time git clone --depth 10 https://github.com/kentfredric/travis-scripts.git maint-travis-ci
- time git -C ./maint-travis-ci reset --hard master
- time perl ./maint-travis-ci/branch_reset.pl
- time perl ./maint-travis-ci/sterilize_env.pl
before_script:
- time perl ./maint-travis-ci/before_script.pl
branches:
only:
- master
- build/master
- releases
install:
- time perl ./maint-travis-ci/install_deps_early.pl
- time perl ./maint-travis-ci/install_deps.pl
before_script:
- time perl ./maint-travis-ci/before_script.pl
language: perl
matrix:
allow_failures:
- perl: '5.8'
- env: STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1
- env: STERILIZE_ENV=0 DEVELOPER_DEPS=1
include:
- env: STERILIZE_ENV=0 COVERAGE_TESTING=1
perl: '5.21'
- env: STERILIZE_ENV=1
perl: '5.21'
- env: STERILIZE_ENV=0
perl: '5.8'
- env: STERILIZE_ENV=0
perl: '5.10'
- env: STERILIZE_ENV=0
perl: '5.12'
- env: STERILIZE_ENV=0
perl: '5.14'
- env: STERILIZE_ENV=0
perl: '5.16'
- env: STERILIZE_ENV=0
perl: '5.20'
- env: STERILIZE_ENV=0
perl: '5.21'
- env: STERILIZE_ENV=1
perl: '5.8'
- env: STERILIZE_ENV=1
perl: '5.10'
- env: STERILIZE_ENV=1
perl: '5.20'
- env: STERILIZE_ENV=0 DEVELOPER_DEPS=1
perl: '5.21'
- env: STERILIZE_ENV=0 RELEASE_TESTING=1 AUTHOR_TESTING=1
perl: '5.21'
script:
- time perl ./maint-travis-ci/script.pl
after_failure:
- perl ./maint-travis-ci/report_fail_ctx.pl
branches:
only:
- "master"
- "build/master"
- "releases"
sudo: false
Release history for Test-File-ShareDir
1.001000 2015-02-28T11:09:38Z d703dd2
[Dependencies::Stats]
- Dependencies changed since 1.000005, see misc/*.deps* for details
- configure: +1 (recommends: -1, suggests: +1)
- develop: +10 ↑3 -2 (suggests: +1 ↑2)
- runtime: +2 (suggests: +1)
- test: +1 (recommends: -2, suggests: +2)
[Deprecations]
- OO interfaces have a ->add_to_inc method which is being replaced with the more generic ->register, which wil retain
meaning when the interface no longer actually uses @INC
[Features]
- OO interfaces now all have a ->register and a ->clear method.
- Now supports exporting with_dist_dir and with_module_dir functions from Test::File::ShareDir
1.000005 2014-08-15T23:41:58Z
[00 Trivial]
- CPANDAY!
......
This software is copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>.
This software is copyright (c) 2015 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
......@@ -12,7 +12,7 @@ b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>.
This software is Copyright (c) 2015 by Kent Fredric <kentnl@cpan.org>.
This is free software, licensed under:
......@@ -272,7 +272,7 @@ That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>.
This software is Copyright (c) 2015 by Kent Fredric <kentnl@cpan.org>.
This is free software, licensed under:
......
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.020.
# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.032.
.gitignore
.mailmap
.perltidyrc
.travis.yml
Changes
......@@ -20,11 +21,13 @@ lib/Test/File/ShareDir/Object/Dist.pm
lib/Test/File/ShareDir/Object/Inc.pm
lib/Test/File/ShareDir/Object/Module.pm
lib/Test/File/ShareDir/TempDirObject.pm
lib/Test/File/ShareDir/Utils.pm
maint/perlcritic.rc.gen.pl
misc/Changes.deps
misc/Changes.deps.all
misc/Changes.deps.dev
misc/Changes.deps.opt
misc/built_with.json
misc/perlcritic.deps
perlcritic.rc
t/00-compile/lib_Test_File_ShareDir_Dist_pm.t
......@@ -33,6 +36,7 @@ t/00-compile/lib_Test_File_ShareDir_Object_Dist_pm.t
t/00-compile/lib_Test_File_ShareDir_Object_Inc_pm.t
t/00-compile/lib_Test_File_ShareDir_Object_Module_pm.t
t/00-compile/lib_Test_File_ShareDir_TempDirObject_pm.t
t/00-compile/lib_Test_File_ShareDir_Utils_pm.t
t/00-compile/lib_Test_File_ShareDir_pm.t
t/00-report-prereqs.dd
t/00-report-prereqs.t
......@@ -52,11 +56,17 @@ t/05_files/share/afile
t/06_cwd_simple.t
t/06_files/lib/Example.pm
t/06_files/share/afile
t/07_files/lib/Example.pm
t/07_files/share/afile
t/07_util_withdist.t
t/08_files/lib/Example.pm
t/08_files/share/afile
t/08_util_withmodule.t
weaver.ini
xt/author/critic.t
xt/author/eol.t
xt/release/cpan-changes.t
xt/release/distmeta.t
xt/release/eol.t
xt/release/kwalitee.t
xt/release/minimum-version.t
xt/release/pod-coverage.t
......
This diff is collapsed.
This diff is collapsed.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.020.
# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.032.
use strict;
use warnings;
use 5.006;
use ExtUtils::MakeMaker ;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Create a Fake ShareDir for your modules for testing.",
......@@ -18,13 +15,17 @@ my %WriteMakefileArgs = (
"DISTNAME" => "Test-File-ShareDir",
"EXE_FILES" => [],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.006",
"NAME" => "Test::File::ShareDir",
"PREREQ_PM" => {
"Carp" => 0,
"Class::Tiny" => 0,
"Exporter" => "5.57",
"File::Copy::Recursive" => 0,
"File::ShareDir" => "1.00",
"Path::Tiny" => "0.018",
"Scope::Guard" => 0,
"parent" => 0,
"strict" => 0,
"warnings" => 0
},
......@@ -37,7 +38,7 @@ my %WriteMakefileArgs = (
"Test::More" => "0.96",
"lib" => 0
},
"VERSION" => "1.000005",
"VERSION" => "1.001000",
"test" => {
"TESTS" => "t/*.t t/00-compile/*.t"
}
......@@ -48,15 +49,18 @@ my %FallbackPrereqs = (
"Carp" => 0,
"Class::Tiny" => 0,
"Cwd" => 0,
"Exporter" => "5.57",
"ExtUtils::MakeMaker" => 0,
"File::Copy::Recursive" => 0,
"File::ShareDir" => "1.00",
"File::Spec" => 0,
"FindBin" => 0,
"Path::Tiny" => "0.018",
"Scope::Guard" => 0,
"Test::Fatal" => 0,
"Test::More" => "0.96",
"lib" => 0,
"parent" => 0,
"strict" => 0,
"warnings" => 0
);
......@@ -72,6 +76,3 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
NAME
Test::File::ShareDir - Create a Fake ShareDir for your modules for
testing.
Test::File::ShareDir
VERSION
version 1.000005
"Test::File::ShareDir" is some low level plumbing to enable a
distribution to perform tests while consuming its own "share"
directories in a manner similar to how they will be once installed.
SYNOPSIS
use Test::More;
This allows "File::ShareDir" to see the *latest* version of content
instead of simply whatever is installed on whichever target system you
happen to be testing on.
# use FindBin; optional
Note: This module only has support for creating 'new' style share dirs
and are NOT compatible with old File::ShareDirs.
use Test::File::ShareDir
# -root => "$FindBin::Bin/../" # optional,
-share => {
-module => { 'My::Module' => 'share/MyModule' }
-dist => { 'My-Dist' => 'share/somefolder' }
};
For this reason, unless you have File::ShareDir 1.00 or later installed,
this module will not be usable by you.
use My::Module;
INSTALLATION
use File::ShareDir qw( module_dir dist_dir );
This is a Perl module distribution. It should be installed with whichever
tool you use to manage your installation of Perl, e.g. any of
module_dir( 'My::Module' ) # dir with files from $dist/share/MyModule
cpanm .
cpan .
cpanp -i .
dist_dir( 'My-Dist' ) # dir with files from $dist/share/somefolder
Consult http://www.cpan.org/modules/INSTALL.html for further instruction.
Should you wish to install this module manually, the procedure is
DESCRIPTION
This module only has support for creating 'new' style share dirs and are
NOT compatible with old File::ShareDirs.
For this reason, unless you have File::ShareDir 1.00 or later installed,
this module will not be usable by you.
SIMPLE INTERFACE
Starting with version 0.4.0, there are a few extra interfaces you can
use.
These will probably be more useful, and easier to grok, because they
don't have a layer of indirection in order to simultaneously support
both "Module" and "Dist" "ShareDir"'s.
Simple Exporter Interfaces
"Test::File::ShareDir::Dist"
"Test::File::ShareDir::Dist" provides a simple export interface for
making "TempDir" "ShareDir"'s from a given path:
use Test::File::ShareDir::Dist { "Dist-Name" => "share/" };
This will automatically create a "ShareDir" for "Dist-Name" in a
"TempDir" based on the contents of "CWD/share/"
See "Test::File::ShareDir::Dist" for details.
"Test::File::ShareDir::Module"
"Test::File::ShareDir::Module" provides a simple export interface for
making "TempDir" "ShareDir"'s from a given path:
use Test::File::ShareDir::Module { "Module::Name" => "share/" };
This will automatically create a "ShareDir" for "Module::Name" in a
"TempDir" based on the contents of "CWD/share/"
See "Test::File::ShareDir::Module" for details.
Simple Object Oriented Interfaces
"Test::File::ShareDir::Object::Dist"
"Test::File::ShareDir::Object::Dist" provides a simple object oriented
interface for making "TempDir" "ShareDir"'s from a given path:
use Test::File::ShareDir::Object::Dist;
my $obj = Test::File::ShareDir::Object::Dist->new( dists => { "Dist-Name" => "share/" } );
$obj->install_all_dists;
$obj->add_to_inc;
This will automatically create a "ShareDir" for "Dist-Name" in a
"TempDir" based on the contents of "CWD/share/"
See "Test::File::ShareDir::Object::Dist" for details.
"Test::File::ShareDir::Object::Module"
"Test::File::ShareDir::Object::Module" provides a simple object oriented
interface for making "TempDir" "ShareDir"'s from a given path:
use Test::File::ShareDir::Object::Module;
my $obj = Test::File::ShareDir::Object::Module->new( modules => { "Module::Name" => "share/" } );
$obj->install_all_modules;
$obj->add_to_inc;
This will automatically create a "ShareDir" for "Module::Name" in a
"TempDir" based on the contents of "CWD/share/"
See "Test::File::ShareDir::Object::Module" for details.
IMPORTING
-root
This parameter is the prefix the other paths are relative to.
If this parameter is not specified, it defaults to the Current Working
Directory ( "CWD" ).
In versions prior to 0.3.0, this value was mandatory.
The rationale behind using "CWD" as the default value is as follows.
* Most users of this module are likely to be using it to test
distributions
* Most users of this module will be using it in "$project/t/" to load
files from "$project/share/"
* Most "CPAN" tools run tests with "CWD" = $project
Therefor, defaulting to "CWD" is a reasonably sane default for most
people, but where it is not it can still be overridden.
-root => "$FindBin::Bin/../" # resolves to project root from t/ regardless of Cwd.
-share
This parameter is mandatory, and contains a "hashref" containing the
data that explains what directories you want shared.
-share => { ..... }
-module
"-module" contains a "hashref" mapping Module names to path names for
module_dir style share dirs.
-share => {
-module => { 'My::Module' => 'share/mymodule/', }
}
...
module_dir('My::Module')
Notedly, it is a "hashref", which means there is a limitation of one
share dir per module. This is simply because having more than one share
dir per module makes no sense at all.
-dist
"-dist" contains a "hashref" mapping Distribution names to path names
for dist_dir style share dirs. The same limitation applied to "-module"
applies here.
-share => {
-dist => { 'My-Dist' => 'share/mydist' }
}
...
dist_dir('My-Dist')
AUTHOR
Kent Fredric <kentnl@cpan.org>
perl Makefile.PL
make
make test
make install
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
This software is copyright (c) 2015 by Kent Fredric <kentnl@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
; This file is generated from dist.ini.meta by dzil bakeini.
; Edit that file or the bundles contained within for long-term changes.
; Generated by Dist::Zilla::Plugin::Author::KENTNL::DistINI version 1.0.2 at Tue Feb 22 00:49:00 2011
; vim: syntax=dosini
; Uncomment this to bootstrap via self
; [Bootstrap::lib]
name = Test-File-ShareDir
author = Kent Fredric <kentnl@cpan.org>
license = Perl_5
......@@ -14,9 +18,11 @@ issues = 1
:version = 1.14000001
[MetaData::BuiltWith / @Author::KENTNL/MetaData::BuiltWith]
:version = 1.004000
show_config = 1
show_uname = 1
uname_args = -s -o -r -m -i
use_external_file = only
[Git::Contributors / @Author::KENTNL/Git::Contributors]
:version = 0.006
......@@ -39,6 +45,8 @@ include_dotfiles = 1
[Manifest / @Author::KENTNL/Manifest]
[Author::KENTNL::TravisCI / @Author::KENTNL/Author::KENTNL::TravisCI]
[CopyFilesFromBuild / @Author::KENTNL/CopyXBuild]
copy = LICENSE
......@@ -52,7 +60,7 @@ copy = LICENSE
[Test::Kwalitee / @Author::KENTNL/Test::Kwalitee]
[EOLTests / @Author::KENTNL/EOLTests]
[Test::EOL / @Author::KENTNL/Test::EOL]
trailing_whitespace = 1
[Test::MinimumVersion / @Author::KENTNL/Test::MinimumVersion]
......@@ -77,7 +85,9 @@ skips = ^Example$
-phase = develop
-type = suggests
Dist::Zilla::App::Command::bakeini = 0.001000
Dist::Zilla::PluginBundle::Author::KENTNL = 2.017002
Dist::Zilla::PluginBundle::Author::KENTNL = 2.023003
[Prereqs::AuthorDeps / @Author::KENTNL/Prereqs::AuthorDeps]
[MinimumPerl / @Author::KENTNL/MinimumPerl]
......@@ -90,7 +100,10 @@ locate_comment = 1
[MakeMaker / @Author::KENTNL/MakeMaker]
default_jobs = 10
[ReadmeFromPod / @Author::KENTNL/ReadmeFromPod]
[Author::KENTNL::RecommendFixes / @Author::KENTNL/Author::KENTNL::RecommendFixes]
:version = 0.001001
[Readme::Brief / @Author::KENTNL/ShippedReadme]
[ReadmeAnyFromPod / @Author::KENTNL/ReadmeAnyFromPod]
filename = README.mkdn
......@@ -115,7 +128,8 @@ filename = Changes
tag_format = %v-source
[Git::NextRelease / @Author::KENTNL/Git::NextRelease]
format = %v %{yyyy-MM-dd'T'HH:mm:ss}dZ
:version = 0.004000
format = %v %{yyyy-MM-dd'T'HH:mm:ss}dZ %h
time_zone = UTC
[BumpVersionAfterRelease / @Author::KENTNL/BumpVersionAfterRelease]
......@@ -133,13 +147,21 @@ tag_format = %v
[UploadToCPAN / @Author::KENTNL/UploadToCPAN]
[Twitter / @Author::KENTNL/Twitter]
hash_tags = #perl #cpan
hash_tags = #perl #cpan #testing
tweet_url = https://metacpan.org/release/{{$AUTHOR_UC}}/{{$DIST}}-{{$VERSION}}{{$TRIAL}}#whatsnew
url_shortener = none
[Prereqs::Recommend::MatchInstalled / @Author::KENTNL/Prereqs::Recommend::MatchInstalled]
modules = ExtUtils::MakeMaker
modules = Test::More
[Prereqs::Upgrade / @Author::KENTNL/Prereqs::Upgrade]
-target_relation = suggests
Dist::Zila::Plugin::MetaProvides::Package = 2.000000
Dist::Zilla = 5
ExtUtils::MakeMaker = 7.00
File::ShareDir::Install = 0.10
Moo = 1.000008
Moose = 2.000
Path::Tiny = 0.058
Test::File::ShareDir = 1.000000
Test::More = 0.99
[Prereqs::Recommend::MatchInstalled / @Author::KENTNL/always_latest_develop_bundle]
applyto_map = develop.suggests = develop.suggests
......@@ -148,20 +170,29 @@ modules = Dist::Zilla::PluginBundle::Author::KENTNL
modules = Dist::Zilla::App::Command::bakeini
[Prereqs / @Author::KENTNL/::Role::BundleDeps]
;version_major = 0
;version_minor = 1
; the following data denotes when this minor was minted
;version_rel_year = 2011
;version_rel_month = 2
;version_rel_day = 22
;version_rel_hour = 0
;version_rel_time_zone = Pacific/Auckland
-phase = develop
-relationship = requires
Dist::Zilla::Plugin::Author::KENTNL::RecommendFixes = 0.001001
Dist::Zilla::Plugin::Author::KENTNL::TravisCI = 0
Dist::Zilla::Plugin::Authority = 1.006
Dist::Zilla::Plugin::AutoPrereqs = 0
Dist::Zilla::Plugin::BumpVersionAfterRelease = 0
Dist::Zilla::Plugin::ConfirmRelease = 0
Dist::Zilla::Plugin::CopyFilesFromBuild = 0
Dist::Zilla::Plugin::EOLTests = 0
Dist::Zilla::Plugin::Git::Check = 0
Dist::Zilla::Plugin::Git::Commit = 0
Dist::Zilla::Plugin::Git::CommitBuild = 0
Dist::Zilla::Plugin::Git::Contributors = 0.006
Dist::Zilla::Plugin::Git::GatherDir = 0
Dist::Zilla::Plugin::Git::NextRelease = 0
Dist::Zilla::Plugin::Git::NextRelease = 0.004000
Dist::Zilla::Plugin::Git::Tag = 0
Dist::Zilla::Plugin::GithubMeta = 0
Dist::Zilla::Plugin::License = 0
......@@ -169,7 +200,7 @@ Dist::Zilla::Plugin::MakeMaker = 0
Dist::Zilla::Plugin::Manifest = 0
Dist::Zilla::Plugin::ManifestSkip = 0
Dist::Zilla::Plugin::MetaConfig = 0
Dist::Zilla::Plugin::MetaData::BuiltWith = 0
Dist::Zilla::Plugin::MetaData::BuiltWith = 1.004000
Dist::Zilla::Plugin::MetaJSON = 0
Dist::Zilla::Plugin::MetaProvides::Package = 1.14000001
Dist::Zilla::Plugin::MetaTests = 0
......@@ -179,13 +210,16 @@ Dist::Zilla::Plugin::PodCoverageTests = 0
Dist::Zilla::Plugin::PodSyntaxTests = 0
Dist::Zilla::Plugin::PodWeaver = 0
Dist::Zilla::Plugin::Prereqs = 0
Dist::Zilla::Plugin::Prereqs::AuthorDeps = 0
Dist::Zilla::Plugin::Prereqs::Recommend::MatchInstalled = 0
Dist::Zilla::Plugin::Prereqs::Upgrade = 0
Dist::Zilla::Plugin::Readme::Brief = 0
Dist::Zilla::Plugin::ReadmeAnyFromPod = 0
Dist::Zilla::Plugin::ReadmeFromPod = 0
Dist::Zilla::Plugin::RewriteVersion::Sanitized = 0
Dist::Zilla::Plugin::RunExtraTests = 0
Dist::Zilla::Plugin::Test::CPAN::Changes = 0
Dist::Zilla::Plugin::Test::Compile::PerFile = 0
Dist::Zilla::Plugin::Test::EOL = 0
Dist::Zilla::Plugin::Test::Kwalitee = 0
Dist::Zilla::Plugin::Test::MinimumVersion = 0
Dist::Zilla::Plugin::Test::Perl::Critic = 0
......
; Generated by Dist::Zilla::Plugin::Author::KENTNL::DistINI version 1.0.2 at Tue Feb 22 00:49:00 2011
; vim: syntax=dosini
name = Test-File-ShareDir
author = Kent Fredric <kentnl@cpan.org>
license = Perl_5
......@@ -8,8 +9,7 @@ copyright_holder = Kent Fredric <kentnl@cpan.org>
; [Bootstrap::lib]
[@Author::KENTNL]
:version = 2.016000
git_versions = 1
:version = 2.023
normal_form = numify
mantissa = 6
toolkit = eumm
......@@ -17,6 +17,8 @@ toolkit_hardness = soft
bumpversions = 1
copyfiles = LICENSE
srcreadme = mkdn
twitter_extra_hash_tags = #testing
Prereqs::Upgrade.-target_relation = suggests
;version_major = 0
;version_minor = 1
......@@ -26,7 +28,6 @@ srcreadme = mkdn
;version_rel_day = 22
;version_rel_hour = 0
;version_rel_time_zone = Pacific/Auckland
twitter_hash_tags = #perl #cpan
auto_prereqs_skip = ^Example$
[MetaNoIndex]
......
......@@ -4,7 +4,7 @@ use warnings;
package Test::File::ShareDir;
our $VERSION = '1.000005';
our $VERSION = '1.001000';
# ABSTRACT: Create a Fake ShareDir for your modules for testing.
......@@ -22,25 +22,145 @@ our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
use File::ShareDir 1.00 qw();
use Exporter qw();
use Test::File::ShareDir::Utils qw( extract_dashes );
use Carp qw( croak );
use parent qw( Exporter );
our @EXPORT_OK = qw( with_dist_dir with_module_dir );
sub import {
my ( undef, %input_config ) = @_;
my ( $package, @args ) = @_;
my ( @imports, %params );
# ->import( { }, qw( imports ) )
if ( 'HASH' eq ref $args[0] ) {
%params = %{ shift @args };
@imports = @args;
}
else {
# ->import( -arg => value, -arg => value, @imports );
while (@args) {
if ( $args[0] =~ /\A-(.*)\z/msx ) {
$params{ $args[0] } = $args[1];
splice @args, 0, 2, ();
next;
}
push @imports, shift @args;
}
}
require Test::File::ShareDir::TempDirObject;
if ( keys %params ) {
require Test::File::ShareDir::TempDirObject;
my $tempdir_object = Test::File::ShareDir::TempDirObject->new( \%input_config );
my $tempdir_object = Test::File::ShareDir::TempDirObject->new( \%params );
for my $module ( $tempdir_object->_module_names ) {
$tempdir_object->_install_module($module);
for my $module ( $tempdir_object->_module_names ) {
$tempdir_object->_install_module($module);
}
for my $dist ( $tempdir_object->_dist_names ) {
$tempdir_object->_install_dist($dist);
}
unshift @INC, $tempdir_object->_tempdir->stringify;
}
if (@imports) {
$package->export_to_level( 1, undef, @imports );
}
return;
}
# This code is just to make sure any guard objects
# are not lexically visible to the sub they contain creating a self reference.
sub _mk_clearer {
my ($clearee) = @_;
return sub { $clearee->clear };
}
for my $dist ( $tempdir_object->_dist_names ) {
$tempdir_object->_install_dist($dist);
sub with_dist_dir {
my ( $config, $code ) = @_;
if ( 'CODE' ne ( ref $code || q{} ) ) {
croak( 'CodeRef expected at end of with_dist_dir(), ' . ( ref $code || qq{scalar="$code"} ) . ' found' );
}
require Test::File::ShareDir::Object::Dist;
require Scope::Guard;
my $dist_object = Test::File::ShareDir::Object::Dist->new( extract_dashes( 'dists', $config ) );
$dist_object->install_all_dists();
$dist_object->register();
my $guard = Scope::Guard->new( _mk_clearer($dist_object) ); ## no critic (Variables::ProhibitUnusedVarsStricter)
return $code->();
}