Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Change .path to .IO, .directory to .dirname, and cwd to CWD to catch …
…up with accumulated IO deprecations
  • Loading branch information
Geoffrey Broadwell committed Dec 7, 2014
1 parent cfe2c50 commit 3c4b72a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
32 changes: 16 additions & 16 deletions bench
Expand Up @@ -125,23 +125,23 @@ multi MAIN ('config') {
#| Prepare for mass benchmarking
multi MAIN ('setup') {
say 'Creating directories ...';
mkdir $COMPONENTS_DIR unless $COMPONENTS_DIR.path.d;
mkdir $COMPONENTS_DIR unless $COMPONENTS_DIR.IO.d;

say 'Cloning component repos ...';
for $COMPONENTS.values -> $component {
my $name = $component<name>;
say "==> $name";

chdir $COMPONENTS_DIR;
mkdir $name unless $name.path.d;
mkdir $name unless $name.IO.d;
chdir $name;

my $repo = $component<repo_url>;
my $bare = "$name.git";
say "----> Already cloned." if $bare.path.d && $name.path.d;
run < git fetch > if $bare.path.d && $name.path.d;
run < git clone --mirror >, $repo, $bare unless $bare.path.d;
run < git clone -l >, $bare, $name unless $name.path.d;
say "----> Already cloned." if $bare.IO.d && $name.IO.d;
run < git fetch > if $bare.IO.d && $name.IO.d;
run < git clone --mirror >, $repo, $bare unless $bare.IO.d;
run < git clone -l >, $bare, $name unless $name.IO.d;
}

say 'Setup complete.';
Expand All @@ -155,7 +155,7 @@ multi MAIN ('fetch', *@components) {
my $comp_dir = "$COMPONENTS_DIR/$name";
my $bare = "$name.git";

unless "$comp_dir/$bare".path.d {
unless "$comp_dir/$bare".IO.d {
say "No bare repository exists for component $name; can't fetch updates.";
next;
}
Expand All @@ -167,7 +167,7 @@ multi MAIN ('fetch', *@components) {
say '~~~> FETCHING';
for $bare, $comp<checkouts>.list -> $dir {
my $path = "$comp_dir/$dir";
next unless $path.path.d;
next unless $path.IO.d;

say "----> $dir";
chdir $path;
Expand All @@ -184,7 +184,7 @@ multi MAIN ('fetch', *@components) {
say '~~~> PULLING';
for $comp<checkouts>.list -> $dir {
my $path = "$comp_dir/$dir";
next unless "$path/.git".path.d;
next unless "$path/.git".IO.d;
next if $dir eq any(@all-tags);

say "----> $dir";
Expand All @@ -205,7 +205,7 @@ multi MAIN ('extract', *@components) {
chdir "$COMPONENTS_DIR/$name";

my $bare = "$name.git";
unless $bare.path.d {
unless $bare.IO.d {
say "No bare repository exists for component $name; can't extract releases.";
next;
}
Expand Down Expand Up @@ -235,22 +235,22 @@ multi MAIN ('extract', *@components) {

# Work around Rakudo bug #115390 by splitting into multiple loops
for @revs -> $rev {
if $rev.path.d {
if $rev.IO.d {
say "$rev already cloned.";
next;
}
run < git clone -l >, $bare, $rev;
}
for @revs -> $rev {
unless $rev.path.d {
unless $rev.IO.d {
$*ERR.say: "Unable to extract release '$rev'.";
next;
}
chdir $rev; LEAVE chdir '..';
run < git checkout -q >, $rev; # > -- Dang syntax highlighting
}
for @revs -> $rev {
next unless $rev.path.d;
next unless $rev.IO.d;
next if $rev eq any(@all-tags);

chdir $rev; LEAVE chdir '..';
Expand Down Expand Up @@ -310,7 +310,7 @@ multi MAIN ('list-branches', *@components) {
my $comp_dir = "$COMPONENTS_DIR/$name";
my $bare = "$name.git";

unless "$comp_dir/$bare".path.d {
unless "$comp_dir/$bare".IO.d {
say "No bare repository exists for component $name; can't list branches.";
next;
}
Expand Down Expand Up @@ -341,7 +341,7 @@ sub known-tags(*@components, :$with-dates) {
my $comp_dir = "$COMPONENTS_DIR/$name";
my $bare = "$name.git";

unless "$comp_dir/$bare".path.d {
unless "$comp_dir/$bare".IO.d {
say "No bare repository exists for component $name; can't list tags.";
next;
}
Expand Down Expand Up @@ -492,7 +492,7 @@ multi MAIN ('diagnose', *@timings, :$format?, :$style?, :$outfile?,

#| Clean up build trees in $COMPONENTS_DIR, keeping bare clones by default
multi MAIN ('clean', *@components) {
unless $COMPONENTS_DIR.path.d {
unless $COMPONENTS_DIR.IO.d {
say "No 'components' tree exists, so there is nothing to clean.";
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Bench/Globals.pm6
@@ -1,6 +1,6 @@
module Bench::Globals;

our $PROGRAM_DIR is export = $*PROGRAM_NAME.path.directory;
our $PROGRAM_DIR is export = $*PROGRAM_NAME.IO.dirname;
our $COMPONENTS_DIR is export = "$PROGRAM_DIR/components";
our $TIMINGS_DIR is export = "$PROGRAM_DIR/timings";

Expand Down
12 changes: 6 additions & 6 deletions lib/Bench/Handling.pm6
Expand Up @@ -8,7 +8,7 @@ our sub go_to_bench_dir() is export {
# Reduce directory insanity a bit by changing to bench root
# and eliminating hardcoding for generated subdir names
chdir $PROGRAM_DIR;
$PROGRAM_DIR = cwd;
$PROGRAM_DIR = $*CWD;
$COMPONENTS_DIR = "$PROGRAM_DIR/components";
$TIMINGS_DIR = "$PROGRAM_DIR/timings";
}
Expand All @@ -19,9 +19,9 @@ our sub init_bench_handling() is export {

#| Check whether components dir exists and bail out if not (recommending 'setup' command)
our sub needs-setup ($action) is export {
unless $COMPONENTS_DIR.path.d {
unless $COMPONENTS_DIR.IO.d {
print qq:to/COMPONENTS/;
There is no '{ $COMPONENTS_DIR.path.basename }' tree, and thus there are no repos to $action.
There is no '{ $COMPONENTS_DIR.IO.basename }' tree, and thus there are no repos to $action.
Please run: `$*PROGRAM_NAME setup`.
COMPONENTS
exit 1;
Expand All @@ -30,9 +30,9 @@ our sub needs-setup ($action) is export {

#| Check whether timings dir exists and bail out if not (recommending steps to produce timings)
our sub needs-timings ($action) is export {
unless $TIMINGS_DIR.path.d {
unless $TIMINGS_DIR.IO.d {
print qq:to/TIMINGS/;
There is no '{ $TIMINGS_DIR.path.basename }' tree, and thus there are no timings to $action.
There is no '{ $TIMINGS_DIR.IO.basename }' tree, and thus there are no timings to $action.
Please run:
`$*PROGRAM_NAME setup` to prepare and clone components,
`$*PROGRAM_NAME extract` to extract Perls to be benchmarked,
Expand All @@ -59,7 +59,7 @@ our sub as-options (*%args) is export {

#| Simulate the behavior of `git clean -dxf`
our sub rmtree ($dir, :$noisy = True) is export {
return unless $dir.path.d;
return unless $dir.IO.d;
say "Removing $dir" if $noisy;
rm_rf $dir;
}
Expand Down

0 comments on commit 3c4b72a

Please sign in to comment.