Skip to content

Commit 926c8df

Browse files
committed
add standard progress bar
1 parent fcd0c9f commit 926c8df

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

META6.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"OO::Monitors",
1919
"File::Find",
2020
"Test::META",
21+
"Term::ProgressBar",
2122
"Sake"
2223
],
2324
"tags": [

Sakefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use Term::ProgressBar;
2+
13
use lib 'lib';
24

35
task 'default' => 'htmlify';
@@ -43,7 +45,6 @@ task 'ctest', { run-tests(<t/07-tabs.t xt/perl-nbsp.t xt/trailing-whitespace.t>)
4345

4446
#| Generate type graph images
4547
task 'type-graph-images', {
46-
say "Generating type-graph images";
4748
use Perl6::TypeGraph;
4849
use Perl6::TypeGraph::Viz;
4950

@@ -91,17 +92,19 @@ task 'type-graph-images', {
9192
my $type-graph = Perl6::TypeGraph.new-from-file('type-graph.txt');
9293
my $infile-time = 'type-graph.txt'.IO.modified;
9394

95+
my $bar = Term::ProgressBar.new( count => +$type-graph.sorted, :p, :name<type-graph images>);
96+
my $count = 1;
97+
9498
#| Writing type graph images
9599
for $type-graph.sorted -> $type {
96100
my $outfile = "html/images/type-graph-{$type}.svg";
97101
my $outfile-time = try $outfile.IO.modified // 0;
98102

103+
$bar.update($count++);
104+
99105
if $outfile-time < $infile-time {
100106
my $viz = Perl6::TypeGraph::Viz.new-for-type($type);
101107
push @jobs, $viz.to-file($outfile, format => 'svg');
102-
print '.';
103-
} else {
104-
print '#';
105108
}
106109
}
107110

@@ -110,17 +113,20 @@ task 'type-graph-images', {
110113
%by-group<Exception>.append: $type-graph.types< Exception Any Mu >;
111114
%by-group<Metamodel>.append: $type-graph.types< Any Mu >;
112115

116+
$bar = Term::ProgressBar.new( count => +%by-group.keys, :p, :name<specialized images>);
117+
$count = 1;
118+
113119
for %by-group.kv -> $group, @types {
114120
my $outfile = "html/images/type-graph-{$group}.svg";
115121
my $outfile-time = try $outfile.IO.modified // 0;
122+
123+
$bar.update($count++);
124+
116125
if $outfile-time < $infile-time {
117126
my $viz = Perl6::TypeGraph::Viz.new(:types(@types),
118127
:dot-hints(viz-hints($group)),
119128
:rank-dir('LR'));
120129
push @jobs, $viz.to-file($outfile, format => 'svg');
121-
print '.';
122-
} else {
123-
print '#';
124130
}
125131
}
126132
say '';

0 commit comments

Comments
 (0)