- $package->startBuffering();
- $package->buildFromIterator($this->source, $this->source->getBaseDir());
- $package->buildFromIterator($this->bundle(__DIR__));
- $package->addFile(__DIR__."/../pharext_installer.php", "pharext_installer.php");
- $package->setDefaultStub("pharext_installer.php");
- $package->setStub("#!/usr/bin/php -dphar.readonly=1\n".$package->getStub());
- $package->stopBuffering();
-
- if (!chmod($pkgtemp, 0777)) {
- $this->error(null);
- } elseif ($this->args->verbose) {
- $this->info("Created executable phar %s\n", $pkgtemp);
- } else {
- $this->info("OK\n");
- }
- if ($this->args->gzip) {
- $this->info("Compressing with gzip ... ");
- try {
- $package->compress(Phar::GZ)
- ->setDefaultStub("pharext_installer.php");
- $this->info("OK\n");
- } catch (\Exception $e) {
- $this->error("%s\n", $e->getMessage());
+ } catch (\Exception $e) {
+ $this->error("%s\n", $e->getMessage());
+ exit(self::ESIGN);
+ }
+
+ if ($this->args->gzip) {
+ try {
+ $gzip = (new Task\PharCompress($file, Phar::GZ))->run();
+ $move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
+ $name = $move->run($this->verbosity());
+
+ $this->info("Created gzipped phar %s\n", $name);
+
+ if ($this->args->sign) {
+ $sign = new Task\PharSign($name, $this->args->sign, $pass);
+ $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");