Add the helper script tests/tweeper_file
[tweeper.git] / tests / tweeper_file
diff --git a/tests/tweeper_file b/tests/tweeper_file
new file mode 100755 (executable)
index 0000000..15de10c
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env php
+<?php
+
+require_once __DIR__ . '/../autoload.php';
+
+use Tweeper\Tweeper;
+
+date_default_timezone_set('UTC');
+
+$usage = "{$argv[0]}: <file> <host>\n";
+
+if ($argc < 3) {
+    fwrite(STDERR, $usage);
+    exit(1);
+}
+
+$file_url = 'file://' . realpath($argv[1]);
+$host = $argv[2];
+
+$tweeper = new Tweeper();
+$output = $tweeper->tweep($file_url, $host, false);
+if (is_null($output)) {
+    exit(1);
+}
+echo $output;