Skip to content

Commit

Permalink
By default add the 1.0.0 version to all modules generated with asgard…
Browse files Browse the repository at this point in the history
…:module:scaffold
  • Loading branch information
cgiupponi committed Aug 30, 2018
1 parent 09fcd83 commit 16bd1c0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Modules/Workshop/Scaffold/Module/ModuleScaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ private function cleanUpModuleJson()

$moduleJson = $this->loadProviders($moduleJson);
$moduleJson = $this->setModuleOrderOrder($moduleJson);
$moduleJson = $this->setModuleVersion($moduleJson);
$moduleJson = $this->removeStartPhpFile($moduleJson);

$this->finder->put($this->getModulesPath('module.json'), $moduleJson);
Expand Down Expand Up @@ -259,6 +260,16 @@ private function setModuleOrderOrder($content)
return str_replace('"order": 0,', '"order": 1,', $content);
}

/**
* Set the module version to 1.0.0 by default
* @param string $content
* @return string
*/
private function setModuleVersion($content)
{
return str_replace("\"active\"", "\"version\": \"1.0.0\",\n\t\"active\"", $content);
}

/**
* Remove the start.php start file
* Also removes the auto loading of that file
Expand Down Expand Up @@ -301,7 +312,7 @@ private function addDataToComposerFile()
$replace = <<<JSON
"description": "",
"type": "asgard-module",
"license": "MIT",
"license": "MIT",
"require": {
"php": ">=7.0.0",
"composer/installers": "~1.0",
Expand Down

0 comments on commit 16bd1c0

Please sign in to comment.