]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - vendor/update
Implement support for saving filters.
[user/henk/code/inspircd.git] / vendor / update
index c57918cb5067dbb218373521b3f332e9257bf419..3c04bc63af0bdea5e019b5454635a38b1871745e 100755 (executable)
 #
 
 
-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);
 
@@ -50,21 +42,21 @@ close $fh;
 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!";
        }
@@ -91,7 +83,7 @@ close $fh;
 
 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** &mdash; [%s](mailto:%s)\n\n", $info->{author}, $info->{email} if $info->{email};
@@ -101,4 +93,4 @@ for my $name (sort keys $data) {
        my $website = $info->{website} // $info->{git};
        printf $fh "**Website** &mdash; [%s](%s)\n", $website, $website;
 }
-close $fh;
\ No newline at end of file
+close $fh;