flush
authorMichael Wallner <mike@php.net>
Tue, 17 Mar 2015 06:03:40 +0000 (07:03 +0100)
committerMichael Wallner <mike@php.net>
Tue, 17 Mar 2015 06:03:40 +0000 (07:03 +0100)
bin/fetch
bin/latest [deleted file]
bin/pecl [new file with mode: 0755]
public/index.php

index 0523c96a944c56f1e336950169a04966ed20e53b..4b49e3421638d08ff82aa68b6de3623c2420d302 100755 (executable)
--- 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 (executable)
index 7fa187e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/php
-<?php
-
-ini_set("display_errors", 0);
-ini_set("log_errors", 1);
-
-if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/latest.rss"))) {
-       foreach ($sxe->item as $item) {
-               printf("%s\n", $item->link);
-       }
-}
diff --git a/bin/pecl b/bin/pecl
new file mode 100755 (executable)
index 0000000..d6d5e9e
--- /dev/null
+++ b/bin/pecl
@@ -0,0 +1,14 @@
+#!/usr/bin/php
+<?php
+
+ini_set("display_errors", 0);
+ini_set("log_errors", 1);
+
+$what = !empty($argv[1]) ? $argv[1] : "latest";
+
+if (($sxe = simplexml_load_file("http://pecl.php.net/feeds/$what.rss"))) {
+       foreach ($sxe->item as $item) {
+               $url = (string) $item->link;
+               printf("%s\t%s\t%s\n", basename(dirname($url)), basename($url), $url);
+       }
+}
index 7918e920a76cd5b1e9a68161a92574c2d60d9640..0c8868ed1f94124ca58385f49b7befea4610eea2 100644 (file)
@@ -4,7 +4,7 @@
                <meta charset="utf-8">
                <title>Replicator</title>
                <link rel="stylesheet" href="concise/css/concise.min.css">
-               <link href='//fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
+               <link href="//fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <style>
                        body {