Commit 2c671686 authored by Felix Flor's avatar Felix Flor

added new output option for bsd makefile dependecies

parent b3d534d9
......@@ -24,6 +24,9 @@ switch($argv[2]){
case "--console-full":
fullConsoleOutput($filesToCheck);
break;
case "--console-bsd":
bsdConsoleOutput($filesToCheck);
break;
case "--testfile":
createTestfileFromTemplate($filesToCheck, $argv[3], $argv[4]);
break;
......
......@@ -48,4 +48,5 @@ require_once __DIR__ . '/inc/func/getModulesInstalledStatus.func.php';
require_once __DIR__ . '/inc/output/basicConsoleOutput.func.php';
require_once __DIR__ . '/inc/output/fullConsoleOutput.func.php';
require_once __DIR__ . '/inc/output/bsdConsoleOutput.func.php';
require_once __DIR__ . '/inc/output/createTestfileFromTemplate.func.php';
......@@ -18,13 +18,13 @@ function checkGivenArguments($argv) {
if(!is_array($argv))
throw new \Exception ("APHPBreakdown: Invalid parameter type! Must: array, Is: " . gettype($argv));
$acceptedOutputArguments = array("--console-basic","--console-full", "--testfile");
$acceptedOutputArguments = array("--console-basic","--console-full", "--console-bsd", "--testfile");
$acceptedTemplateArguments = array("--basic", "--advanced");
$path = realpath($argv[1]);
if(!isset($path) || !isset($argv[2]))
exitWithErrorMessage("APHPBreakdown: Not enough arguments given!\n\t\t aphpbreakdown <PATH> <OPTIONS> [--testfile <TEMPLATE>] [--testfile <EXPORT_FILENAME>]\n\t\t <PATH> /path/to/dir\n\t\t <OPTIONS> --console-basic | --console-full | --testfile\n\t\t [--testfile <TEMPLATE>] --basic | --advanced\n\t\t [<EXPORT_FILENAME>] optional, no path, don't forget file extension\n");
exitWithErrorMessage("APHPBreakdown: Not enough arguments given!\n\t\t aphpbreakdown <PATH> <OPTIONS> [--testfile <TEMPLATE>] [--testfile <EXPORT_FILENAME>]\n\t\t <PATH> /path/to/dir\n\t\t <OPTIONS> --console-basic | --console-full | --console-bsd | --testfile\n\t\t [--testfile <TEMPLATE>] --basic | --advanced\n\t\t [<EXPORT_FILENAME>] optional, no path, don't forget file extension\n");
if(!is_dir($path))
exitWithErrorMessage("APHPBreakdown: There is no directory found on path \"$path\"\n");
......@@ -48,10 +48,10 @@ function checkGivenArguments($argv) {
exitWithErrorMessage("APHPBreakdown: There are sone or more Files which are not readable. Check the Output above for Details.\nChange the file Permissions. To do that use this command \"$ chmod u+r <FILE>\"\n");
if(!isset($argv[2]))
exitWithErrorMessage("APHPBreakdown: You have to give argument for output. ( aphpanalyse <PATH> <OUTPUT> [ --console-full | --testfile ] ).\n");
exitWithErrorMessage("APHPBreakdown: You have to give argument for output. ( aphpanalyse <PATH> <OUTPUT> [ --console-basic | --console-full | --console-bsd | --testfile ] ).\n");
if(!in_array($argv[2], $acceptedOutputArguments))
exitWithErrorMessage("APHPBreakdown: The Argument you have given is not valid. Avaible Options: <OUTPUT> [ --console-basic | --console-full | --testfile ].\n");
exitWithErrorMessage("APHPBreakdown: The Argument you have given is not valid. Avaible Options: <OUTPUT> [ --console-basic | --console-full | --console-bsd | --testfile ].\n");
if($argv[2] == "--testfile" && !isset($argv[3]))
exitWithErrorMessage("APHPBreakdown: Missing Argument for --testfile. Avaible Options: [<TEMPLATE>] [ --basic | --advanced ].\n");
......
<?php
namespace APHPBreakdown;
/**
*
* @param mixed[] $filesToCheck - contains all paths to files, one path per field
*
* @throws \Exception - if $filesToCheck is not of type array
*
* this function gives you the output for the analyse
*
**/
function bsdConsoleOutput($filesToCheck){
if(!is_array($filesToCheck))
throw new \Exception ("Invalid parameter type for \$filesToCheck! Must: array, Is: " . gettype($filesToCheck));
$startTime = time();
$neededModules = getNeededModules($filesToCheck);
$neddedModulesInstallStatus = getModulesInstalledStatus($neededModules);
$countAllFiles = count($filesToCheck);
$countAllModules = count($neededModules);
$endTime = time();
$time = $endTime - $startTime;
system("clear");
echo "\n APHPBreakdown : Results\n";
echo "======================================================\n\n";
echo " Checked Files: $countAllFiles\n";
echo " Needed Modules: $countAllModules\n\n";
echo " Modules for Makefile Dependencies:\n\n";
$i = 0;
foreach($neddedModulesInstallStatus as $module => $moduleStatus){
$module = strtoupper($module);
$filter = array("ZEND ");
$module = str_replace($filter, "", $module);
if($module != "CORE")
echo $module." ";
$i++;
if($i == 5){
echo "\\\n";
$i = 0;
}
}
echo "\n\n======================================================\n";
echo " Time to perform the test: $time sec.\n\n";
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment