Skip to content

Commit

Permalink
Fix october dependencies to dev-master
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-kuendig committed Apr 10, 2019
1 parent 684a26e commit 897fd20
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions src/Downloader/OctoberCms.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,25 @@ 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;
}

/**
* Download the temporary Zip to the given file.
*
* @throws LogicException
* @throws RuntimeException
* @return $this
* @throws RuntimeException
* @throws LogicException
*/
protected function fetchZip()
{
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit 897fd20

Please sign in to comment.