Skip to content

Commit f6a057c

Browse files
author
Geoffrey Broadwell
committed
Convert more commands to use latest explode-components(): build just drops some boilerplate, extract-releases converts from manual component calculation; fetch adds the ability to specify components
1 parent c76c6ef commit f6a057c

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

bench

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,16 @@ multi MAIN ('setup') {
5151
}
5252

5353
#= Fetch latest commits in each cloned component
54-
multi MAIN ('fetch') {
54+
multi MAIN ('fetch', *@components) {
5555
needs-setup('fetch');
5656

57-
chdir $COMPONENTS_DIR;
58-
59-
for dir('.').sort -> $component-name {
60-
say "==> $component-name";
57+
for explode-components(@components, :default-to-dirs) -> $comp {
58+
my $name = $comp<info><name>;
59+
say "==> $name";
6160

62-
my $bare = "$component-name/$component-name.git";
61+
my $bare = "$name/$name.git";
6362
unless $bare.IO.d {
64-
say "No bare repository exists for component $component-name; can't fetch updates.";
63+
say "No bare repository exists for component $name; can't fetch updates.";
6564
next;
6665
}
6766

@@ -83,21 +82,20 @@ sub needs-setup ($action) {
8382
multi MAIN ('extract-releases', *@components) {
8483
needs-setup('extract releases');
8584

86-
chdir $COMPONENTS_DIR;
87-
@components ||= dir('.').sort;
85+
for explode-components(@components) -> $comp {
86+
my $name = $comp<info><name>;
87+
say "==> $name";
8888

89-
for @components -> $component-name {
90-
say "==> $component-name";
91-
chdir "$COMPONENTS_DIR/$component-name";
89+
chdir "$COMPONENTS_DIR/$name";
9290

93-
my $bare = "$component-name.git";
91+
my $bare = "$name.git";
9492
unless $bare.IO.d {
95-
say "No bare repository exists for component $component-name; can't extract releases.";
93+
say "No bare repository exists for component $name; can't extract releases.";
9694
next;
9795
}
9896

9997
# Determine which release tags to check out by default
100-
my $tag_regex = $COMPONENTS{$component-name}<release_tags>;
98+
my $tag_regex = $comp<release_tags>;
10199
next unless $tag_regex;
102100

103101
%*ENV<GIT_DIR> = $bare;
@@ -123,10 +121,7 @@ multi MAIN ('extract-releases', *@components) {
123121
multi MAIN ('build', *@components) {
124122
needs-setup('build components');
125123

126-
chdir $COMPONENTS_DIR;
127-
@components ||= dir('.').sort;
128-
129-
for explode-components(@components) -> $comp {
124+
for explode-components(@components, :default-to-dirs) -> $comp {
130125
my $name = $comp<info><name>;
131126
say "==> $name";
132127

0 commit comments

Comments
 (0)