Skip to content

Commit f3fd058

Browse files
committed
April Blood
1 parent a8c2544 commit f3fd058

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

Config/Lib/Router/About.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
\Lib\Router::this()->respond('get', 'about', function () {
3+
include _HTML.'static/about.html';
4+
});

Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ static function getCtrl()
160160
function run()
161161
{
162162
//Load configurations
163-
if (class_exists('\Config\Router\Router')) {
164-
new \Config\Router\Router;
163+
if (class_exists('\Config\Lib\Router\Router')) {
164+
new \Config\Lib\Router\Router;
165165
}
166166

167167
//Resolve request

install.php

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
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 = 'Router';
8-
$file = 'Router.php';
9-
$configPath = defined('_CONFIG') ? _CONFIG.'Router/' : dirname(dirname(dirname(__DIR__))).'/Config/Router/';
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-
@mkdir($configPath, 0777, true);
17-
@chmod($configPath, 0777);
18-
if (!is_writable($configPath)) {
19-
return "\n\n--- Configuration file for $name not instaled!\n\n";
20-
}
9+
if (!is_dir($thisConfig)) {
10+
return;
2111
}
2212

23-
//Copiando o arquivo de configuração para o CONFIG da aplicação
24-
//copy(__DIR__.'/Config/Router/Router.php', $configPath.$file);
25-
copy(__DIR__.'/Config/Router', $configPath);
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);
2623

2724
//Return to application installer
28-
return "\n--- $name instaled!";
25+
return "\n---".($copy === true ? " $namespace instaled!" : $copy);

0 commit comments

Comments
 (0)