Skip to content

Commit 0d93f31

Browse files
committed
add default env file
1 parent 2859c84 commit 0d93f31

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/Ubiquity

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Ubiquity {
4848

4949
use CmdTrait;
5050

51-
private static $version = '1.4.3';
51+
private static $version = '1.4.4';
5252

5353
private static $appName = 'Ubiquity devtools';
5454

@@ -343,8 +343,7 @@ class Ubiquity {
343343
}
344344
FileUtils::xcopy(self::$activeDir . "/devtools/project-files/app/controllers/IndexController.php", "app/controllers/IndexController.php");
345345

346-
// -------------Add themes----------------
347-
346+
self::openReplaceWrite(self::$activeDir . "/devtools/project-files/templates/.env.tpl", getcwd()."/.env", self::$configOptions);
348347
self::openReplaceWrite(self::$activeDir . "/devtools/project-files/templates/config.tpl", "app/config/config.php", self::$configOptions);
349348
self::openReplaceWrite(self::$activeDir . "/devtools/project-files/README.md", getcwd() . "/README.md", self::$configOptions);
350349

@@ -358,10 +357,17 @@ class Ubiquity {
358357
system("composer install");
359358
require_once ROOT . './../vendor/autoload.php';
360359
$dir = getcwd();
360+
// -------------Add themes----------------
361361
foreach ($vendorCopies as $theme => $vCopies) {
362362
InstallThemeCmd::copyVendorFiles($theme, $vCopies, $dir);
363363
}
364-
$config = require_once 'app/config/config.php';
364+
365+
ob_start();
366+
\Ubiquity\cache\CacheManager::initCache($config);
367+
$res = ob_get_clean();
368+
echo ConsoleFormatter::showMessage($res, 'info', 'cache initialization');
369+
370+
$config = require_once 'app/cache/config/config.cache.php';
365371
\Ubiquity\controllers\Startup::setConfig($config);
366372

367373
if (self::isBooleanTrue(self::$configOptions["%all-models%"])) {
@@ -371,10 +377,7 @@ class Ubiquity {
371377
$res = ob_get_clean();
372378
echo ConsoleFormatter::showMessage($res, 'success', 'models generation');
373379
}
374-
ob_start();
375-
\Ubiquity\cache\CacheManager::initCache($config);
376-
$res = ob_get_clean();
377-
echo ConsoleFormatter::showMessage($res, 'info', 'cache initialization');
380+
378381
echo ConsoleFormatter::showMessage("project <b>{$projectName}</b> successfully created.", 'success', 'new-project');
379382
} else {
380383
echo ConsoleFormatter::showMessage("Project <b>{$projectName}</b> is partialy created.\nYou will need to run `composer install` in the root folder of the project.\nThen `Ubiquity init-cache` to initialize the cache folders.\n", 'info');
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DB_NAME=%dbName%
2+
DB_USER=%user%
3+
DB_PASS=%password%

src/devtools/project-files/templates/config.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ return array(
44
"database"=>[
55
"type"=>"%dbType%",
66
"wrapper"=>"%dbWrapper%",
7-
"dbName"=>"%dbName%",
7+
"dbName"=>getenv('DB_NAME'),
88
"serverName"=>"%serverName%",
99
"port"=>"%port%",
10-
"user"=>"%user%",
11-
"password"=>"%password%",
10+
"user"=>getenv('DB_USER'),
11+
"password"=>getenv('DB_PASS'),
1212
"options"=>[],
1313
"cache"=>false
1414
],

0 commit comments

Comments
 (0)