Dist-Zilla-PluginBundle-Git-VersionManager
view release on metacpan or search on metacpan
t/lib/Helper.pm view on Meta::CPAN
note("$plugin is found in local directory or in 'provides' metadata; skipping"), next
if (
$pluginbundle_meta ? exists $pluginbundle_meta->{provides}{$plugin}
: do {
(my $file = $plugin) =~ s{::}{/}g; $file .= '.pm';
path('lib', $file)->exists;
});
my $required_version = $bundle_plugin_requirements->{find_meta($plugin)->name} // 0;
# plugin is a core requirement of the bundle
cmp_deeply(
$pluginbundle_meta->{prereqs}{runtime}{requires},
superhashof({ $plugin => $required_version }),
$plugin . ' is a runtime prereq of the plugin bundle',
) if $pluginbundle_meta;
}
pass 'this is a token test to keep things humming' if not $pluginbundle_meta;
if (not Test::Builder->new->is_passing)
{
diag 'got dist metadata: ', explain $dist_meta;
diag 'got plugin bundle metadata: ', explain $pluginbundle_meta;
}
}
} }
# provides a temp directory that is guaranteed to not be inside a git repository
# directory is cleaned up when $tempdir goes out of scope
sub no_git_tempdir
{
my $tempdir = Path::Tiny->tempdir(CLEANUP => 1);
mkdir $tempdir if not -d $tempdir; # FIXME: File::Temp::newdir doesn't make the directory?!
my $in_git = git_in_path($tempdir);
ok(!$in_git, 'tempdir is not in a real git repository');
return $tempdir;
}
# checks if a .git directory is in the current or any parent directory
sub git_in_path
{
my $in_git;
my $dir = path($_[0]);
my $count = 0;
while (not $dir->is_rootdir) {
# this should never happen.
do { diag "failed to detect that $dir is at the root?!"; last } if $dir eq $dir->parent;
my $checkdir = path($dir, '.git');
if (-d $checkdir) {
note "found $checkdir in $_[0]";
$in_git = 1;
last;
}
$dir = $dir->parent;
}
continue {
die "too many iterations when traversing $dir!"
if $count++ > 100;
}
return $in_git;
}
1;
( run in 0.580 second using v1.01-cache-2.11-cpan-71847e10f99 )