File tree Expand file tree Collapse file tree 4 files changed +22
-21
lines changed
Expand file tree Collapse file tree 4 files changed +22
-21
lines changed Original file line number Diff line number Diff line change 1212 * @link http://paulorocha.tk/devbr
1313 */
1414
15- namespace Config ;
15+ namespace Config \ Lib ;
1616
1717/**
1818 * Config\Database Class
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ function __construct($config = null)
4646 {
4747 if (is_array ($ config )) {
4848 $ this ->config = $ config ;
49- } elseif (method_exists ('Config\Database ' , 'get ' )) {
50- $ this ->config = \Config \Database::get ($ config );
49+ } elseif (method_exists ('Config\Lib\ Database ' , 'get ' )) {
50+ $ this ->config = \Config \Lib \ Database::get ($ config );
5151 } else {
5252 trigger_error ('DataBase configurations not found! ' );
5353 }
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ public function __construct($config = null)
6363 $ this ->_dbConfig [$ i ] = $ d ;
6464 }
6565 }
66- } elseif (method_exists ('Config\Database ' , 'getUserConfig ' )) {
67- $ this ->_dbConfig = \Config \Database::getUserConfig ();
66+ } elseif (method_exists ('Config\Lib\ Database ' , 'getUserConfig ' )) {
67+ $ this ->_dbConfig = \Config \Lib \ Database::getUserConfig ();
6868 }
6969
7070 $ this ->_db = new Db ;
Original file line number Diff line number Diff line change 11<?php
2- if (php_sapi_name () !== 'cli ' ) {
3- exit ('It \'s no cli! ' );
2+
3+ if (php_sapi_name () !== 'cli ' || !defined ('_CONFIG ' )) {
4+ exit ("\n\tI can not run out of system! \n" );
45}
56
6- //Configurations - you can change...
7- $ name = 'Database ' ;
8- $ file = 'Database.php ' ;
9- $ configPath = defined ('_CONFIG ' ) ? _CONFIG : dirname (dirname (dirname (__DIR__ ))).'/Config/ ' ;
7+ $ thisConfig = __DIR__ .'/Config/ ' ;
108
11- //Checkin
12- if (is_file ($ configPath .$ file )) {
13- return "\n--- $ name configuration file already exists! " ;
14- }
15- if (!is_dir ($ configPath )) {
16- return "\n\n--- Configuration file for $ name not instaled! \n\n" ;
9+ if (!is_dir ($ thisConfig )) {
10+ return ;
1711}
1812
19- //Gravando o arquivo de configuração no CONFIG da aplicação
20- file_put_contents ($ configPath .$ file ,
21- file_get_contents (__DIR__ .'/config.php ' ));
13+ $ namespace = @json_decode (file_get_contents (__DIR__ .'/composer.json ' ))->name ;
14+ /* OPTIONAL
15+ * load composer.json and get the "name" of pack
16+ * $appConfig = _CONFIG.$namespace;
17+ */
18+
19+ $ appConfig = _CONFIG ;
20+
21+ //Coping all files (and directorys) in /Config
22+ $ copy = \Lib \Cli \Main::copyDirectoryContents ($ thisConfig , $ appConfig );
2223
2324//Return to application installer
24- return "\n--- $ name instaled! " ;
25+ return "\n--- " .( $ copy === true ? " $ namespace instaled! " : $ copy ) ;
You can’t perform that action at this time.
0 commit comments