From 897fd20716f019c0d38e0fc2a85a88129f3b5907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=BCndig?= Date: Wed, 10 Apr 2019 09:49:19 +0200 Subject: [PATCH] Fix october dependencies to dev-master --- src/Downloader/OctoberCms.php | 41 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/Downloader/OctoberCms.php b/src/Downloader/OctoberCms.php index 74008be..a38fd7c 100644 --- a/src/Downloader/OctoberCms.php +++ b/src/Downloader/OctoberCms.php @@ -33,14 +33,15 @@ public function __construct() */ public function download($force = false) { - if($this->alreadyInstalled($force)) { + if ($this->alreadyInstalled($force)) { throw new \LogicException('-> October is already installed. Use --force to reinstall.'); } - + $this->fetchZip() ->extract() ->fetchHtaccess() - ->cleanUp(); + ->cleanUp() + ->setMaster(); return $this; } @@ -48,9 +49,9 @@ public function download($force = false) /** * Download the temporary Zip to the given file. * - * @throws LogicException - * @throws RuntimeException * @return $this + * @throws RuntimeException + * @throws LogicException */ protected function fetchZip() { @@ -89,12 +90,38 @@ protected function fetchHtaccess() return $this; } + + /** + * Since we don't want any unstable updates we fix + * the libraries to the master branch. + * + * @return $this + */ + protected function setMaster() + { + $json = getcwd() . DS . 'composer.json'; + + $contents = file_get_contents($json); + + $contents = preg_replace_callback( + '/october\/(?:rain|system|backend|cms)":\s"([^"]+)"/m', + function ($treffer) { + return str_replace($treffer[1], 'dev-master', $treffer[0]); + }, + $contents + ); + + file_put_contents($json, $contents); + + return $this; + } + /** * Remove the Zip file, move folder contents one level up. * - * @throws LogicException - * @throws \Symfony\Component\Process\Exception\RuntimeException * @return $this + * @throws \Symfony\Component\Process\Exception\RuntimeException + * @throws LogicException */ protected function cleanUp() {