Skip to content

Commit

Permalink
April Blood
Browse files Browse the repository at this point in the history
  • Loading branch information
supremacia committed Apr 11, 2017
1 parent a8c2544 commit f3fd058
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
4 changes: 4 additions & 0 deletions Config/Lib/Router/About.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
\Lib\Router::this()->respond('get', 'about', function () {
include _HTML.'static/about.html';
});
4 changes: 2 additions & 2 deletions Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ static function getCtrl()
function run()
{
//Load configurations
if (class_exists('\Config\Router\Router')) {
new \Config\Router\Router;
if (class_exists('\Config\Lib\Router\Router')) {
new \Config\Lib\Router\Router;
}

//Resolve request
Expand Down
37 changes: 17 additions & 20 deletions install.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
<?php
if (php_sapi_name() !== 'cli') {
exit('It\'s no cli!');

if (php_sapi_name() !== 'cli' || !defined('_CONFIG')) {
exit("\n\tI can not run out of system!\n");
}

//Configurations - you can change...
$name = 'Router';
$file = 'Router.php';
$configPath = defined('_CONFIG') ? _CONFIG.'Router/' : dirname(dirname(dirname(__DIR__))).'/Config/Router/';
$thisConfig = __DIR__.'/Config/';

//Checkin
if (is_file($configPath.$file)) {
return "\n--- $name configuration file already exists!";
}
if (!is_dir($configPath)) {
@mkdir($configPath, 0777, true);
@chmod($configPath, 0777);
if (!is_writable($configPath)) {
return "\n\n--- Configuration file for $name not instaled!\n\n";
}
if (!is_dir($thisConfig)) {
return;
}

//Copiando o arquivo de configuração para o CONFIG da aplicação
//copy(__DIR__.'/Config/Router/Router.php', $configPath.$file);
copy(__DIR__.'/Config/Router', $configPath);
$namespace = @json_decode(file_get_contents(__DIR__.'/composer.json'))->name;
/* OPTIONAL
* load composer.json and get the "name" of pack
* $appConfig = _CONFIG.$namespace;
*/

$appConfig = _CONFIG;

//Coping all files (and directorys) in /Config
$copy = \Lib\Cli\Main::copyDirectoryContents($thisConfig, $appConfig);

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

0 comments on commit f3fd058

Please sign in to comment.