- if ($this->args->gzip) {
- $this->info("Compressing with gzip ... ");
- try {
- $package->compress(Phar::GZ);
- $this->info("OK\n");
- } catch (\Exception $e) {
- $this->error("%s\n", $e->getMessage());
+ $meta = array_merge(Metadata::all(), [
+ "name" => $this->args->name,
+ "release" => $this->args->release,
+ "license" => $license,
+ "stub" => "pharext_installer.php",
+ "type" => $this->args->zend ? "zend_extension" : "extension",
+ ]);
+ $file = (new Task\PharBuild($this->source, $meta))->run($this->verbosity());
+ } catch (\Exception $e) {
+ $this->error("%s\n", $e->getMessage());
+ exit(self::EBUILD);
+ }
+
+ try {
+ if ($this->args->sign) {
+ $this->info("Using private key to sign phar ...\n");
+ $pass = (new Task\Askpass)->run($this->verbosity());
+ $sign = new Task\PharSign($file, $this->args->sign, $pass);
+ $pkey = $sign->run($this->verbosity());
+ }
+
+ } 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");