Skip to content

Commit b29f81c

Browse files
committed
Fix use of local dzil
1 parent fb6af8c commit b29f81c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Changes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
* Create p5stack directory if missing (Issue#2, reported by AMBS++).
55
* Attempt to warn about cpanm misses (Issue#3, reported by AMBS++).
6+
* Fix use of local dzil
67

78
0.003 2015-11-19 22:29:12+00:00 Europe/Lisbon
89

lib/App/p5stack.pm

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,24 @@ sub _do_setup {
111111
my $cpanm = $self->_get_cpanm;
112112

113113
if ($self->{deps} eq 'dzil') {
114-
my $dzil = which 'dzil';
115-
$self->_do_cpanm("Dist::Zilla") unless $dzil;
116114

117115
unless (-e catfile($self->{home},'dist.ini')) {
118116
_log('Configuration is set to use "dzil" to gather dependencies information, but no "dist.ini" file was found in current directory.. exiting.');
119117
exit;
120118
}
121-
system "$dzil listdeps | $cpanm --no-sudo -l $self->{local_lib}";
122-
$self->{cpanm_flag} = $? >> 8;
119+
120+
my $dzil = which 'dzil';
121+
if ($dzil) {
122+
system "$dzil listdeps | $cpanm --no-sudo -l $self->{local_lib}";
123+
$self->{cpanm_flag} = $? >> 8;
124+
}
125+
else {
126+
$self->_do_cpanm("Dist::Zilla");
127+
my $bin = catfile($self->{local_bin}, 'dzil');
128+
my @env = ("PERL5LIB=$self->{Ilib}", "PATH=$self->{local_bin}:\$PATH");
129+
system join(' ', @env, "$bin listdeps | $cpanm --no-sudo -l $self->{local_lib}");
130+
$self->{cpanm_flag} = $? >> 8;
131+
}
123132
}
124133
if ($self->{deps} eq 'cpanfile') {
125134
unless (-e catfile($self->{home},'cpanfile')) {

0 commit comments

Comments
 (0)