#
-BEGIN {
- require 5.10.0;
- unless (-f 'configure') {
- print "Error: $0 must be run from the main source directory!\n";
- exit 1;
- }
-}
-
-use feature ':5.10';
+use v5.10.0;
use strict;
use warnings FATAL => qw(all);
my ($data, $error) = from_toml $contents;
print_error "unable to parse $config: $!" if $error;
-while (my ($name, $info) = each $data) {
- print_format "Updating <|GREEN $name|> ...\n";
+while (my ($name, $info) = each %{$data}) {
+ say console_format "Updating <|GREEN $name|> ...";
my $unpackdir = File::Temp->newdir;
my $vendordir = catdir $RealDir, $name;
my $success = 0;
if (defined $info->{git}) {
- $success ||= system 'git', 'clone', $info->{git}, $unpackdir;
+ $success ||= execute 'git', 'clone', $info->{git}, $unpackdir;
chomp(my $tag = `git -C $unpackdir describe --abbrev=0 --tags HEAD 2>/dev/null`) unless $success;
- $success ||= system 'git', '-C', $unpackdir, 'checkout', $tag if $tag;
+ $success ||= execute 'git', '-C', $unpackdir, 'checkout', $tag if $tag;
chomp($info->{version} = `git -C $unpackdir describe --always --tags HEAD 2>/dev/null`);
} elsif (defined $info->{tarball}) {
my $tarball = catfile $unpackdir, basename $info->{tarball};
- $success ||= system 'wget', '--output-document', $tarball, $info->{tarball};
- $success ||= system 'tar', 'fx', $tarball, '-C', $unpackdir, '--strip-components', 1;
+ $success ||= execute 'wget', '--output-document', $tarball, $info->{tarball};
+ $success ||= execute 'tar', 'fx', $tarball, '-C', $unpackdir, '--strip-components', 1;
} else {
print_error "unable to update $name; no git or tarball specified!";
}
open($fh, '>', $readme) or print_error "unable to write $readme: $!";
print $fh $contents =~ s/\n\#\#.*//rs;
-for my $name (sort keys $data) {
+for my $name (sort keys %{$data}) {
my $info = $data->{$name};
printf $fh "\n## %s\n\n", $name;
printf $fh "**Author** — [%s](mailto:%s)\n\n", $info->{author}, $info->{email} if $info->{email};
my $website = $info->{website} // $info->{git};
printf $fh "**Website** — [%s](%s)\n", $website, $website;
}
-close $fh;
\ No newline at end of file
+close $fh;