Example #1
0
 protected function readPackage($path)
 {
     $jsonLoader = new Package\Util\JSON\Loader(new Package\Util\Loader());
     $package = null;
     if (file_exists($path . DIRECTORY_SEPARATOR . 'composer.json')) {
         $package = $jsonLoader->load($path . DIRECTORY_SEPARATOR . 'composer.json');
     }
     if (null === $package && $this->noConvert) {
         throw new \RuntimeException('XML package are not supported. Please convert it before install');
     }
     if (null === $package) {
         try {
             $loader = new Package\PHP\Util\XML\Loader(new Package\Util\Loader());
             $pkgXml = new PackageXml($path);
             $pkgXml->dump();
             $jsonPath = $pkgXml->getJsonPath();
             $package = $jsonLoader->load($jsonPath);
         } catch (Exception $e) {
             /* pass for now, be compatible */
         }
     }
     if (null == $package) {
         /* Just ensure it's correct, */
         throw new \Exception("Couldn't read package info at '{$path}'");
     }
     $package->setRootDir(realpath($path));
     (new Header\Version($package))->updateJSON();
     return $package;
 }
Example #2
0
 protected function readPackage($path)
 {
     $jsonLoader = new Package\Util\JSON\Loader(new Package\Util\Loader());
     $package = null;
     if (file_exists($path . DIRECTORY_SEPARATOR . 'composer.json')) {
         $package = $jsonLoader->load($path . DIRECTORY_SEPARATOR . 'composer.json');
     }
     if (null === $package && $this->noConvert) {
         throw new \RuntimeException('XML package are not supported. Please convert it before install');
     }
     if (null === $package) {
         try {
             $loader = new Package\PHP\Util\XML\Loader(new Package\Util\Loader());
             $pkgXml = new PackageXml($path);
             $pkgXml->dump();
             $jsonPath = $pkgXml->getJsonPath();
             $package = $jsonLoader->load($jsonPath);
         } catch (Exception $e) {
             /* pass for now, be compatible */
         }
     }
     if (null == $package) {
         /* Just ensure it's correct, */
         throw new \Exception("Couldn't read package info at '{$path}'");
     }
     $package->setRootDir(realpath($path));
     /* We're not adding any versions into the composer.json for the source release.
        Instead we just set the package version and that's it. The version is to be
        contained in the extension sources, so no need to maintain it more than once.
        */
     $version = new Header\Version($package);
     $package->replaceVersion((new VersionParser())->normalize($version), $version);
     return $package;
 }
Example #3
0
 public function process()
 {
     $pkgXml = new PackageXml($this->path);
     $package = $pkgXml->getPackage();
     if ($this->cb) {
         $cb = $this->cb;
         $cb($package);
     }
 }
Example #4
0
 public function process()
 {
     $path = rtrim($this->path, '/\\');
     $pkgXml = new PackageXml($path);
     $package = $pkgXml->getPackage();
     $package->setRootDir($path);
     $pkgXml->convertChangeLog();
     $pkgXml->dump();
     if ($this->cb) {
         $cb = $this->cb;
         $cb($package);
     }
 }
Example #5
0
 public function execute($target, $no_convert)
 {
     $jsonLoader = new \Pickle\Package\Util\JSON\Loader(new \Pickle\Package\Util\Loader());
     $pickle_json = $target . DIRECTORY_SEPARATOR . 'composer.json';
     $package = null;
     if (file_exists($pickle_json)) {
         $package = $jsonLoader->load($pickle_json);
     }
     if (null === $package && $no_convert) {
         throw new \RuntimeException('XML package are not supported. Please convert it before install');
     }
     if (null === $package) {
         $pkgXml = new PackageXml($target);
         $pkgXml->dump();
         $jsonPath = $pkgXml->getJsonPath();
         unset($package);
         $package = $jsonLoader->load($jsonPath);
     }
     $package->setRootDir($target);
     $package->updateVersion();
     return $package;
 }
Example #6
0
 protected function readPackage($path)
 {
     $jsonLoader = new Package\Util\JSON\Loader(new Package\Util\Loader());
     $package = null;
     if (file_exists($path . DIRECTORY_SEPARATOR . 'composer.json')) {
         $package = $jsonLoader->load($path . DIRECTORY_SEPARATOR . 'composer.json');
     }
     if (null === $package && $this->noConvert) {
         throw new \RuntimeException('XML package are not supported. Please convert it before install');
     }
     if (null === $package) {
         try {
             $loader = new Package\PHP\Util\XML\Loader(new Package\Util\Loader());
             $pkgXml = new PackageXml($path);
             $pkgXml->dump();
             $jsonPath = $pkgXml->getJsonPath();
             $package = $jsonLoader->load($jsonPath);
         } catch (Exception $e) {
             /* pass for now, be compatible */
         }
     }
     if (null == $package) {
         /* Just ensure it's correct, */
         throw new \Exception("Couldn't read package info at '{$path}'");
     }
     $package->setRootDir(realpath($path));
     $this->composerJsonBak($package);
     /* For the binary release, json badly need the version informatio
        to show the meta info. If there's ever a binary release support
        for other platforms, this will need to be done, probably. */
     (new Header\Version($package))->updateJSON();
     return $package;
 }