Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Tried to fix warning about deprecation of File::Mkdir::mkdir #7

Merged
merged 1 commit into from

2 participants

@ichesnokov

Hello!

I've installed Pies, and every time I tried to run panda, it complained about deprecation of File::Mkdir::mkdir, so I replaced it with Shell::Command::mkpath.

Hope, it'll be useful :)

@tadzik tadzik merged commit 6d5f1f5 into tadzik:master
@tadzik
Owner

Good job, thanks!

@moritz moritz referenced this pull request from a commit
@masak masak [JSON::Tiny] trim input before parsing it
This used to return "Any" because of the leading whitespace:

$ nom -e 'use JSON::Tiny; say from-json(q[   {}]).perl'
Any

But it now works:

$ nom -e 'use JSON::Tiny; say from-json(q[   {}]).perl'
{}

Closes #7.
121fff4
@stmuk stmuk referenced this pull request from a commit in stmuk/panda
@stmuk stmuk Squashed 'ext/File__Find/' changes from 19250d2..a2e1797
a2e1797 Merge pull request #7 from paultcochrane/pr/add-unit-declarator
e9e5356 Add unit declarator to module declarations

git-subtree-dir: ext/File__Find
git-subtree-split: a2e1797eb086d63ea35d5208b55086b6ac6792f7
54982b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
4 bin/panda
@@ -1,5 +1,5 @@
#!/usr/bin/env perl6
-use File::Mkdir;
+use Shell::Command;
use Panda;
subset Command of Str where
@@ -79,7 +79,7 @@ if %*ENV<PANDA_DEFAULT_OPTS> {
my $panda;
{
my $pandadir = %*ENV<HOME> ~ '/.panda';
- mkdir $pandadir, :p unless $pandadir.IO ~~ :d;
+ mkpath $pandadir unless $pandadir.IO ~~ :d;
my $projectsfile = "$pandadir/projects.json";
unless $projectsfile.IO ~~ :f {
View
37 ext/File/Mkdir.pm
@@ -1,37 +0,0 @@
-use v6;
-
-module File::Mkdir;
-
-multi sub mkdir(Str $name, $mode = 0o777, :$p!) is export {
- for [\~] $name.split('/').map({"$_/"}) {
- mkdir($_) unless .IO.d
- }
-}
-
-=begin pod
-
-=head1 NAME
-
-File::Mkdir -- provides recursive mkdir
-
-=head1 SYNOPSIS
-
- use File::Mkdir;
-
- # special mkdir exported in File::Mkdir
- mkdir '/some/directory/tree', :p;
- # just a casual, built-in mkdir
- mkdir 'directory';
-
-=head1 DESCRIPTION
-
-C<File::Mkdir> provides an mkdir variant, which, when provided the :p
-parameter, will create the directory tree recursively. For example,
-calling C<mkdir 'foo/bar', :p> will create the foo directory (unless
-it alredy exists), then the foo/bar directory (unless it exists).
-The standard Perl 6 C<mkdir> is still available, and will be called
-when the :p parameter is not passed.
-
-=end pod
-
-# vim: ft=perl6
View
60 ext/Shell/Command.pm
@@ -0,0 +1,60 @@
+module Shell::Command;
+
+sub cat(*@files) is export {
+ for @files -> $f {
+ given open($f) {
+ for .lines -> $line {
+ say $line;
+ }
+ .close
+ }
+ }
+}
+
+sub eqtime($source, $dest) is export {
+ ???
+}
+
+sub rm_f(*@files) is export {
+ for @files -> $f {
+ unlink $f if $f.IO ~~ :e;
+ }
+}
+
+sub rm_rf(*@files) is export {
+ ???
+}
+
+sub touch(*@files) is export {
+ ???
+}
+
+sub mv(*@args) is export {
+ ???
+}
+
+sub cp(*@args) is export {
+ ???
+}
+
+sub mkpath(*@paths) is export {
+ for @paths -> $name {
+ for [\~] $name.split('/').map({"$_/"}) {
+ mkdir($_) unless .IO.d
+ }
+ }
+}
+
+sub test_f($file) is export {
+ ???
+}
+
+sub test_d($file) is export {
+ ???
+}
+
+sub dos2unix($file) is export {
+ ???
+}
+
+# vim: ft=perl6
View
4 lib/Panda/Builder.pm
@@ -1,7 +1,7 @@
use Pies;
use Panda::Common;
use File::Find;
-use File::Mkdir;
+use Shell::Command;
class Panda::Builder does Pies::Builder {
has $!resources;
@@ -27,7 +27,7 @@ class Panda::Builder does Pies::Builder {
# list of files to compile
my @files = find(dir => 'lib', name => /\.pm6?$/).list;
my @dirs = @files.map(*.dir).uniq;
- mkdir "blib/$_", :p for @dirs;
+ mkpath "blib/$_" for @dirs;
my @tobuild = self.build-order(@files);
my $p6lib = "{cwd}/blib/lib:{cwd}/lib:{%*ENV<PERL6LIB>}";
View
4 lib/Panda/Common.pm
@@ -1,5 +1,5 @@
module Panda::Common;
-use File::Mkdir;
+use Shell::Command;
sub dirname ($mod as Str) is export {
$mod.subst(':', '_', :g);
@@ -7,7 +7,7 @@ sub dirname ($mod as Str) is export {
sub indir (Str $where, Callable $what) is export {
my $old = cwd;
- mkdir $where, :p;
+ mkpath $where;
chdir $where;
my $fail;
try { $what(); CATCH { $fail = $! } }
View
2  lib/Panda/Ecosystem.pm
@@ -1,6 +1,6 @@
use Pies;
use JSON::Tiny;
-use File::Mkdir;
+use Shell::Command;
class Panda::Ecosystem is Pies::Ecosystem {
has $!statefile;
View
4 lib/Panda/Fetcher.pm
@@ -2,7 +2,7 @@ use Pies;
use Panda::Common;
use Panda::Resources;
use File::Find;
-use File::Mkdir;
+use Shell::Command;
class Panda::Fetcher does Pies::Fetcher {
has $!resources;
@@ -39,7 +39,7 @@ class Panda::Fetcher does Pies::Fetcher {
# that's sort of ugly, I know, but we need
# <source-url> stripped
my $where = "$dest/{$_.dir.substr($url.chars)}";
- mkdir $where, :p;
+ mkpath $where;
next if $_.IO ~~ :d;
$_.IO.copy("$where/{$_.name}");
}
View
8 lib/Panda/Installer.pm
@@ -1,7 +1,7 @@
use Pies;
use Panda::Common;
use File::Find;
-use File::Mkdir;
+use Shell::Command;
class Panda::Installer does Pies::Installer {
has $!resources;
@@ -17,13 +17,13 @@ class Panda::Installer does Pies::Installer {
if 'blib'.IO ~~ :d {
for find(dir => 'blib', type => 'file').list -> $i {
# .substr(5) to skip 'blib/'
- mkdir "$!destdir/{$i.dir.substr(5)}", :p;
+ mkpath "$!destdir/{$i.dir.substr(5)}";
$i.IO.copy("$!destdir/{$i.Str.substr(5)}");
}
}
if 'bin'.IO ~~ :d {
for find(dir => 'bin', type => 'file').list -> $bin {
- mkdir "$!destdir/{$bin.dir}", :p;
+ mkpath "$!destdir/{$bin.dir}";
$bin.IO.copy("$!destdir/$bin");
"$!destdir/$bin".IO.chmod(0o755);
}
@@ -32,7 +32,7 @@ class Panda::Installer does Pies::Installer {
for find(dir => 'doc', type => 'file').list -> $doc {
my $path = "$!destdir/{$p.name.subst(':', '/', :g)}"
~ "/{$doc.dir}";
- mkdir $path, :p;
+ mkpath $path;
$doc.IO.copy("$path/{$doc.name}");
}
}
Something went wrong with that request. Please try again.