/** * Create package. */ public function create(array $args = array()) { $archBasename = $this->pkg->getSimpleName() . '-' . $this->pkg->getPrettyVersion(); /* Work around bug #67417 [NEW]: ::compress modifies archive basename creates temp file and rename it */ $tempName = getcwd() . '/pkl-tmp.tar'; if (file_exists($tempName)) { unlink($tempName); } $arch = new \PharData($tempName); $pkgDir = $this->pkg->getRootDir(); foreach ($this->pkg->getFiles() as $file) { if (is_file($file)) { $name = str_replace($pkgDir, '', $file); $arch->addFile($file, $name); } } if (file_exists($tempName)) { @unlink($tempName . '.gz'); } $arch->compress(\Phar::GZ); unset($arch); rename($tempName . '.gz', $archBasename . '.tgz'); unlink($tempName); if ($this->cb) { $cb = $this->cb; $cb($this->pkg); } }
/** * @param \Pickle\Base\Interfaces\Package $package * * @return array */ public function dump(Interfaces\Package $package) { $data = []; $data['name'] = $package->getPrettyName(); $stability = $package->getStability(); /* not appending stable is ok */ $version_tail = $stability && 'stable' != $stability ? "-{$stability}" : ''; $data['version'] = $package->getPrettyVersion() . $version_tail; $data['type'] = $package->getType(); if ($license = $package->getLicense()) { $data['license'] = $license; } if ($authors = $package->getAuthors()) { $data['authors'] = $authors; } if ($description = $package->getDescription()) { $data['description'] = $description; } if ($support = $package->getSupport()) { $data['support'] = $support; } if ($extra = $package->getExtra()) { $data['extra'] = $extra; } return $data; }
/** * @param \Pickle\Base\Interfaces\Package $package * * @return array */ public function dump(Interfaces\Package $package, $with_version = true) { $data = []; $data['name'] = $package->getPrettyName(); if ($with_version) { $data['version'] = $package->getPrettyVersion(); } $data['type'] = $package->getType(); if ($license = $package->getLicense()) { $data['license'] = $license; } if ($authors = $package->getAuthors()) { $data['authors'] = $authors; } if ($description = $package->getDescription()) { $data['description'] = $description; } if ($support = $package->getSupport()) { $data['support'] = $support; } if ($extra = $package->getExtra()) { $data['extra'] = $extra; } return $data; }
public function showInfo(OutputInterface $output, Interfaces\Package $package) { $table = new Table($output); $stability = $package->getStability(); $table->setRows([['<info>Package name</info>', $package->getPrettyName()], ['<info>Package version (current release)</info>', str_replace("-{$stability}", '', $package->getPrettyVersion())], ['<info>Package status</info>', $stability]])->render(); }