From b98a8419d4bf12698665331a22d3ca93efaebf51 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 7 Dec 2016 12:51:13 +0100 Subject: [PATCH] Fixed `xfw build` + added statistics + log --- exporter/Builder.php | 27 +++- exporter/packages.json | 136 +++++++++--------- .../api/1.0/core/Authentification.php | 0 .../api/1.0/core/Checker.php | 0 .../api/1.0/core/ModuleRequest.php | 0 .../api/1.0/core/ModuleResponse.php | 0 .../api/1.0/module/module.php | 0 .../api/2.0/core/Authentification.php | 0 .../api/2.0/core/Checker.php | 0 .../api/2.0/core/ModuleFactory.php | 0 .../api/2.0/core/Request.php | 0 .../api/2.0/core/Response.php | 0 .../api/2.0/module/RESTexample.php | 0 .../api/2.2/core/Authentification.php | 0 .../api/2.2/core/Checker.php | 0 .../api/2.2/core/ModuleFactory.php | 0 .../api/2.2/core/Request.php | 0 .../api/2.2/core/Response.php | 0 .../api/2.2/module/RESTexample.php | 0 .../database/1.0/core/Database.php | 0 .../database/1.0/core/Repo.php | 0 .../database/2.0/core/DatabaseDriver.php | 0 .../database/2.0/core/Repo.php | 0 .../error/1.0/core/Error.php | 0 .../2.0 => packages/error/2.0/core}/Err.php | 0 .../2.0 => packages/error/2.0/core}/Error.php | 0 .../http/1.0/core/HttpRequest.php | 0 .../lightdb/1.0/core/lightdb.php | 0 .../orm/0.8.1/core/Rows.php | 0 .../orm/0.8.1/core/SQLBuilder.php | 0 .../orm/0.8.1/core/Table.php | 0 .../orm/0.8.2/core/Rows.php | 0 .../orm/0.8.2/core/SQLBuilder.php | 0 .../orm/0.8.2/core/Table.php | 0 .../router/1.0/core/Route.php | 0 .../router/1.0/core/Router.php | 0 36 files changed, 89 insertions(+), 74 deletions(-) rename src/{modules => packages}/api/1.0/core/Authentification.php (100%) rename src/{modules => packages}/api/1.0/core/Checker.php (100%) rename src/{modules => packages}/api/1.0/core/ModuleRequest.php (100%) rename src/{modules => packages}/api/1.0/core/ModuleResponse.php (100%) rename src/{modules => packages}/api/1.0/module/module.php (100%) rename src/{modules => packages}/api/2.0/core/Authentification.php (100%) rename src/{modules => packages}/api/2.0/core/Checker.php (100%) rename src/{modules => packages}/api/2.0/core/ModuleFactory.php (100%) rename src/{modules => packages}/api/2.0/core/Request.php (100%) rename src/{modules => packages}/api/2.0/core/Response.php (100%) rename src/{modules => packages}/api/2.0/module/RESTexample.php (100%) rename src/{modules => packages}/api/2.2/core/Authentification.php (100%) rename src/{modules => packages}/api/2.2/core/Checker.php (100%) rename src/{modules => packages}/api/2.2/core/ModuleFactory.php (100%) rename src/{modules => packages}/api/2.2/core/Request.php (100%) rename src/{modules => packages}/api/2.2/core/Response.php (100%) rename src/{modules => packages}/api/2.2/module/RESTexample.php (100%) rename src/{modules => packages}/database/1.0/core/Database.php (100%) rename src/{modules => packages}/database/1.0/core/Repo.php (100%) rename src/{modules => packages}/database/2.0/core/DatabaseDriver.php (100%) rename src/{modules => packages}/database/2.0/core/Repo.php (100%) rename src/{modules => packages}/error/1.0/core/Error.php (100%) rename src/{modules/error/2.0 => packages/error/2.0/core}/Err.php (100%) rename src/{modules/error/2.0 => packages/error/2.0/core}/Error.php (100%) rename src/{modules => packages}/http/1.0/core/HttpRequest.php (100%) rename src/{modules => packages}/lightdb/1.0/core/lightdb.php (100%) rename src/{modules => packages}/orm/0.8.1/core/Rows.php (100%) rename src/{modules => packages}/orm/0.8.1/core/SQLBuilder.php (100%) rename src/{modules => packages}/orm/0.8.1/core/Table.php (100%) rename src/{modules => packages}/orm/0.8.2/core/Rows.php (100%) rename src/{modules => packages}/orm/0.8.2/core/SQLBuilder.php (100%) rename src/{modules => packages}/orm/0.8.2/core/Table.php (100%) rename src/{modules => packages}/router/1.0/core/Route.php (100%) rename src/{modules => packages}/router/1.0/core/Router.php (100%) diff --git a/exporter/Builder.php b/exporter/Builder.php index 358a919..fb1be7c 100755 --- a/exporter/Builder.php +++ b/exporter/Builder.php @@ -33,25 +33,40 @@ /* [1] Builds project's base file structure =========================================================*/ /* (1) Copy from src/files */ + echo "(1) Building file structure\n"; shell_exec("cp -r ".__ROOT__."/src/files/* ".$this->root); /* [2] Browse each package to load =========================================================*/ - foreach($this->packages as $package=>$version){ - $path = "/$package/$version"; + echo "(2) Building packages\n"; + $count = 1; + foreach($this->packages as $package=>$version){ + $path = "$package/$version"; + + echo " ($count) $package:$version\n"; /* (1) Copy package folder if it exists */ - if( file_exists(__ROOT__."/src/packages$path/") && is_dir(__ROOT__."/src/packages$path/") && count(scandir(__ROOT__."/src/packages$path/")) > 2 ) - shell_exec("cp -r ".__ROOT__."/src/packages$path ".$this->root."/build/$package"); + if( file_exists(__ROOT__."/src/packages/$path") && is_dir(__ROOT__."/src/packages/$path") && count(scandir(__ROOT__."/src/packages/$path")) > 2 ) + shell_exec("cp -r ".__ROOT__."/src/packages/$path ".$this->root."/build/$package"); /* (2) Copy package config if it exists */ - if( file_exists(__ROOT__."/src/config$path/") && is_dir(__ROOT__."/src/config$path/") && count(scandir(__ROOT__."/src/config$path/")) > 2 ) - shell_exec("cp -r ".__ROOT__."/src/config$path/* ".$this->root."/config/"); + if( file_exists(__ROOT__."/src/config/$path") && is_dir(__ROOT__."/src/config/$path") && count(scandir(__ROOT__."/src/config/$path")) > 2 ) + shell_exec("cp -r ".__ROOT__."/src/config/$path/* ".$this->root."/config/"); + $count++; } + echo "(*) Build finished\n"; + + /* [3] Start stats + =========================================================*/ + echo "\n\nStatistics:\n"; + echo shell_exec("du -hs ".$this->root."/*;"); + echo "--\n"; + echo shell_exec("du -hs ".$this->root."/;"); + } diff --git a/exporter/packages.json b/exporter/packages.json index 4ec4086..e97658d 100755 --- a/exporter/packages.json +++ b/exporter/packages.json @@ -1,69 +1,69 @@ { - "available": { - "error": { - "1.0": [], - "2.0": [] - }, - "http": { - "1.0": [] - }, - "api": { - "1.0": { - "error": [ - "1.0" - ] - }, - "2.0": { - "error": [ - "2.0" - ] - }, - "2.1": { - "error": [ - "2.0" - ], - "http": [ - "1.0" - ] - } - }, - "orm": { - "0.8.1": { - "database": [ - "1.0" - ] - }, - "0.8.2": { - "database": [ - "2.0" - ] - } - }, - "database": { - "1.0": { - "error": [ - "1.0" - ] - }, - "2.0": { - "error": [ - "2.0" - ] - } - }, - "lightdb": { - "1.0": [] - }, - "router": { - "1.0": [] - } - }, - "installed": { - "api": "2.1", - "error": "2.0", - "http": "1.0", - "orm": "0.8.2", - "database": "2.0", - "router": "1.0" - } -} \ No newline at end of file + "available": { + "error": { + "1.0": [], + "2.0": [] + }, + "http": { + "1.0": [] + }, + "api": { + "1.0": { + "error": [ + "1.0" + ] + }, + "2.0": { + "error": [ + "2.0" + ] + }, + "2.2": { + "error": [ + "2.0" + ], + "http": [ + "1.0" + ] + } + }, + "orm": { + "0.8.1": { + "database": [ + "1.0" + ] + }, + "0.8.2": { + "database": [ + "2.0" + ] + } + }, + "database": { + "1.0": { + "error": [ + "1.0" + ] + }, + "2.0": { + "error": [ + "2.0" + ] + } + }, + "lightdb": { + "1.0": [] + }, + "router": { + "1.0": [] + } + }, + "installed": { + "api": "2.2", + "error": "2.0", + "http": "1.0", + "orm": "0.8.2", + "database": "2.0", + "router": "1.0" + } +} diff --git a/src/modules/api/1.0/core/Authentification.php b/src/packages/api/1.0/core/Authentification.php similarity index 100% rename from src/modules/api/1.0/core/Authentification.php rename to src/packages/api/1.0/core/Authentification.php diff --git a/src/modules/api/1.0/core/Checker.php b/src/packages/api/1.0/core/Checker.php similarity index 100% rename from src/modules/api/1.0/core/Checker.php rename to src/packages/api/1.0/core/Checker.php diff --git a/src/modules/api/1.0/core/ModuleRequest.php b/src/packages/api/1.0/core/ModuleRequest.php similarity index 100% rename from src/modules/api/1.0/core/ModuleRequest.php rename to src/packages/api/1.0/core/ModuleRequest.php diff --git a/src/modules/api/1.0/core/ModuleResponse.php b/src/packages/api/1.0/core/ModuleResponse.php similarity index 100% rename from src/modules/api/1.0/core/ModuleResponse.php rename to src/packages/api/1.0/core/ModuleResponse.php diff --git a/src/modules/api/1.0/module/module.php b/src/packages/api/1.0/module/module.php similarity index 100% rename from src/modules/api/1.0/module/module.php rename to src/packages/api/1.0/module/module.php diff --git a/src/modules/api/2.0/core/Authentification.php b/src/packages/api/2.0/core/Authentification.php similarity index 100% rename from src/modules/api/2.0/core/Authentification.php rename to src/packages/api/2.0/core/Authentification.php diff --git a/src/modules/api/2.0/core/Checker.php b/src/packages/api/2.0/core/Checker.php similarity index 100% rename from src/modules/api/2.0/core/Checker.php rename to src/packages/api/2.0/core/Checker.php diff --git a/src/modules/api/2.0/core/ModuleFactory.php b/src/packages/api/2.0/core/ModuleFactory.php similarity index 100% rename from src/modules/api/2.0/core/ModuleFactory.php rename to src/packages/api/2.0/core/ModuleFactory.php diff --git a/src/modules/api/2.0/core/Request.php b/src/packages/api/2.0/core/Request.php similarity index 100% rename from src/modules/api/2.0/core/Request.php rename to src/packages/api/2.0/core/Request.php diff --git a/src/modules/api/2.0/core/Response.php b/src/packages/api/2.0/core/Response.php similarity index 100% rename from src/modules/api/2.0/core/Response.php rename to src/packages/api/2.0/core/Response.php diff --git a/src/modules/api/2.0/module/RESTexample.php b/src/packages/api/2.0/module/RESTexample.php similarity index 100% rename from src/modules/api/2.0/module/RESTexample.php rename to src/packages/api/2.0/module/RESTexample.php diff --git a/src/modules/api/2.2/core/Authentification.php b/src/packages/api/2.2/core/Authentification.php similarity index 100% rename from src/modules/api/2.2/core/Authentification.php rename to src/packages/api/2.2/core/Authentification.php diff --git a/src/modules/api/2.2/core/Checker.php b/src/packages/api/2.2/core/Checker.php similarity index 100% rename from src/modules/api/2.2/core/Checker.php rename to src/packages/api/2.2/core/Checker.php diff --git a/src/modules/api/2.2/core/ModuleFactory.php b/src/packages/api/2.2/core/ModuleFactory.php similarity index 100% rename from src/modules/api/2.2/core/ModuleFactory.php rename to src/packages/api/2.2/core/ModuleFactory.php diff --git a/src/modules/api/2.2/core/Request.php b/src/packages/api/2.2/core/Request.php similarity index 100% rename from src/modules/api/2.2/core/Request.php rename to src/packages/api/2.2/core/Request.php diff --git a/src/modules/api/2.2/core/Response.php b/src/packages/api/2.2/core/Response.php similarity index 100% rename from src/modules/api/2.2/core/Response.php rename to src/packages/api/2.2/core/Response.php diff --git a/src/modules/api/2.2/module/RESTexample.php b/src/packages/api/2.2/module/RESTexample.php similarity index 100% rename from src/modules/api/2.2/module/RESTexample.php rename to src/packages/api/2.2/module/RESTexample.php diff --git a/src/modules/database/1.0/core/Database.php b/src/packages/database/1.0/core/Database.php similarity index 100% rename from src/modules/database/1.0/core/Database.php rename to src/packages/database/1.0/core/Database.php diff --git a/src/modules/database/1.0/core/Repo.php b/src/packages/database/1.0/core/Repo.php similarity index 100% rename from src/modules/database/1.0/core/Repo.php rename to src/packages/database/1.0/core/Repo.php diff --git a/src/modules/database/2.0/core/DatabaseDriver.php b/src/packages/database/2.0/core/DatabaseDriver.php similarity index 100% rename from src/modules/database/2.0/core/DatabaseDriver.php rename to src/packages/database/2.0/core/DatabaseDriver.php diff --git a/src/modules/database/2.0/core/Repo.php b/src/packages/database/2.0/core/Repo.php similarity index 100% rename from src/modules/database/2.0/core/Repo.php rename to src/packages/database/2.0/core/Repo.php diff --git a/src/modules/error/1.0/core/Error.php b/src/packages/error/1.0/core/Error.php similarity index 100% rename from src/modules/error/1.0/core/Error.php rename to src/packages/error/1.0/core/Error.php diff --git a/src/modules/error/2.0/Err.php b/src/packages/error/2.0/core/Err.php similarity index 100% rename from src/modules/error/2.0/Err.php rename to src/packages/error/2.0/core/Err.php diff --git a/src/modules/error/2.0/Error.php b/src/packages/error/2.0/core/Error.php similarity index 100% rename from src/modules/error/2.0/Error.php rename to src/packages/error/2.0/core/Error.php diff --git a/src/modules/http/1.0/core/HttpRequest.php b/src/packages/http/1.0/core/HttpRequest.php similarity index 100% rename from src/modules/http/1.0/core/HttpRequest.php rename to src/packages/http/1.0/core/HttpRequest.php diff --git a/src/modules/lightdb/1.0/core/lightdb.php b/src/packages/lightdb/1.0/core/lightdb.php similarity index 100% rename from src/modules/lightdb/1.0/core/lightdb.php rename to src/packages/lightdb/1.0/core/lightdb.php diff --git a/src/modules/orm/0.8.1/core/Rows.php b/src/packages/orm/0.8.1/core/Rows.php similarity index 100% rename from src/modules/orm/0.8.1/core/Rows.php rename to src/packages/orm/0.8.1/core/Rows.php diff --git a/src/modules/orm/0.8.1/core/SQLBuilder.php b/src/packages/orm/0.8.1/core/SQLBuilder.php similarity index 100% rename from src/modules/orm/0.8.1/core/SQLBuilder.php rename to src/packages/orm/0.8.1/core/SQLBuilder.php diff --git a/src/modules/orm/0.8.1/core/Table.php b/src/packages/orm/0.8.1/core/Table.php similarity index 100% rename from src/modules/orm/0.8.1/core/Table.php rename to src/packages/orm/0.8.1/core/Table.php diff --git a/src/modules/orm/0.8.2/core/Rows.php b/src/packages/orm/0.8.2/core/Rows.php similarity index 100% rename from src/modules/orm/0.8.2/core/Rows.php rename to src/packages/orm/0.8.2/core/Rows.php diff --git a/src/modules/orm/0.8.2/core/SQLBuilder.php b/src/packages/orm/0.8.2/core/SQLBuilder.php similarity index 100% rename from src/modules/orm/0.8.2/core/SQLBuilder.php rename to src/packages/orm/0.8.2/core/SQLBuilder.php diff --git a/src/modules/orm/0.8.2/core/Table.php b/src/packages/orm/0.8.2/core/Table.php similarity index 100% rename from src/modules/orm/0.8.2/core/Table.php rename to src/packages/orm/0.8.2/core/Table.php diff --git a/src/modules/router/1.0/core/Route.php b/src/packages/router/1.0/core/Route.php similarity index 100% rename from src/modules/router/1.0/core/Route.php rename to src/packages/router/1.0/core/Route.php diff --git a/src/modules/router/1.0/core/Router.php b/src/packages/router/1.0/core/Router.php similarity index 100% rename from src/modules/router/1.0/core/Router.php rename to src/packages/router/1.0/core/Router.php