From: Michael Wallner Date: Tue, 17 Mar 2015 06:03:40 +0000 (+0100) Subject: flush X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=bba2db4365095568f6c978873a20febf442baa7b;p=m6w6%2Freplicator flush --- diff --git a/bin/fetch b/bin/fetch index 0523c96..4b49e34 100755 --- a/bin/fetch +++ b/bin/fetch @@ -16,24 +16,24 @@ $client->setOptions([ ]); while (!feof(STDIN)) { - if (strlen($url = rtrim(fgets(STDIN)))) { - $url = new Url($url, null, 0); - $ver = basename($url->path); - $pkg = basename(dirname($url->path)); - $skp = sprintf("%s/../build/%s-%s.skip", __DIR__, $pkg, $ver); - $tgz = sprintf("%s/../build/%s-%s.tgz", __DIR__, $pkg, $ver); - $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__, $pkg, $pkg, $ver); + if (strlen($line = rtrim(fgets(STDIN)))) { + if (list($pkg, $ver, $url) = explode("\t", $line)) { + $url = new Url($url, null, 0); + $skp = sprintf("%s/../build/%s-%s.skip", __DIR__, $pkg, $ver); + $tgz = sprintf("%s/../build/%s-%s.tgz", __DIR__, $pkg, $ver); + $ext = sprintf("%s/../public/phars/%s/%s-%s.ext.phar", __DIR__, $pkg, $pkg, $ver); - if (is_file($skp)) { - // skip - } elseif (is_file($tgz) || is_file($ext)) { - printf("%s\t%s\t%s\n", $pkg, $ver, $tgz); - } else { - $client->enqueue(new Request("GET", $url), function($res) use($tgz, $pkg, $ver) { - $res->getBody()->toStream(fopen($tgz, "w")); + if (is_file($skp)) { + // skip + } elseif (is_file($tgz) || is_file($ext)) { printf("%s\t%s\t%s\n", $pkg, $ver, $tgz); - return true; - }); + } else { + $client->enqueue(new Request("GET", $url), function($res) use($tgz, $pkg, $ver) { + $res->getBody()->toStream(fopen($tgz, "w")); + printf("%s\t%s\t%s\n", $pkg, $ver, $tgz); + return true; + }); + } } } } diff --git a/bin/latest b/bin/latest deleted file mode 100755 index 7fa187e..0000000 --- a/bin/latest +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/php -item as $item) { - printf("%s\n", $item->link); - } -} diff --git a/bin/pecl b/bin/pecl new file mode 100755 index 0000000..d6d5e9e --- /dev/null +++ b/bin/pecl @@ -0,0 +1,14 @@ +#!/usr/bin/php +item as $item) { + $url = (string) $item->link; + printf("%s\t%s\t%s\n", basename(dirname($url)), basename($url), $url); + } +} diff --git a/public/index.php b/public/index.php index 7918e92..0c8868e 100644 --- a/public/index.php +++ b/public/index.php @@ -4,7 +4,7 @@ Replicator - +