changes to the help commands and how to install or uninstall the application.

Changes made on external(symfony) classes! To change the help format as needed
Fixed some typing mistakes
Esse commit está contido em:
Felipe N. Moura
2012-04-07 01:19:37 -03:00
commit 3887f5746c
15 arquivos alterados com 132 adições e 35 exclusões
+1
Ver Arquivo
@@ -9,6 +9,7 @@
$_REQ['request_method']= $_SERVER['REQUEST_METHOD'];
$_REQ['env']= 'http';
define('_MINDSRC_', getcwd());
switch($_REQ['request_method'])
{
case 'GET' : $_REQ['data']= $_GET;
+20
Ver Arquivo
@@ -60,6 +60,26 @@
}
break;
}
case '--help':
case '-h':
case '?':
case 'help':{
echo "theWebMind(or just mind):\n website: http://thewebmind.org\n Twitter: @thewebmind\n Docs: http://docs.thewebmind.org\n\n";
"The list of startup commands:\n".
" install : installs the application itself\n".
" uninstall: uninstalls the application, but do NOT remove projects,\n".
" users or history\n".
" remove : installs the application AND REMOVE every data it may\n".
" have created, including ALL projects, history and users.\n".
" --help :\n";
" -h :\n";
" help :\n";
" ? :\n";
" Shows this help content.\n\n";
echo "After installing, you can open the application by calling the 'mind' command anywhere.\n".
"You will also be able to send POST requisition to mind's server address sending the command you want to execute and its parameters.\n";
exit;
}
}
}
// if not installing, it should be redirected to mind3rd/API/shell.php
+1 -1
Ver Arquivo
@@ -37,7 +37,7 @@ class En implements l10n{
$this->messages['not_allowed_tip'] = "Try calling the command\n auth < login >\nA password will be required.\n";
$this->messages['no_such_file'] = Mind::message("\nMain: No such command '%s'", "[Fail]", false);
$this->messages['auth_fail'] = Mind::message("\nAuth: Wrong user or password", "[Fail]", false);
$this->messages['bye'] = "Logging out...\n";
$this->messages['bye'] = "Thank you! See you later!\nLogging out...\n";
$this->messages['thinking'] = "Please wait while I'm thinking...\n";
$this->messages['invalidCreateParams'] = Mind::message("Main: Invalid parameters", "[Fail]", false);
$this->messages['invalidOption'] = Mind::message("Invalid option '%s'", '[Fail]', false);
@@ -61,6 +61,8 @@ class Application
/**
* Constructor.
*
* CHANGED BY FELIPENMOURA
*
* @param string $name The name of the application
* @param string $version The version of the application
*/
@@ -84,11 +86,11 @@ class Application
new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
new InputOption('--help', '-h', InputOption::PARAMETER_NONE, 'Display this help message.'),
new InputOption('--quiet', '-q', InputOption::PARAMETER_NONE, 'Do not output any message.'),
new InputOption('--verbose', '-v', InputOption::PARAMETER_NONE, 'Increase verbosity of messages.'),
new InputOption('--version', '-V', InputOption::PARAMETER_NONE, 'Display this program version.'),
//new InputOption('--quiet', '-q', InputOption::PARAMETER_NONE, 'Do not output any message.'),
//new InputOption('--verbose', '-v', InputOption::PARAMETER_NONE, 'Increase verbosity of messages.'),
//new InputOption('--version', '-V', InputOption::PARAMETER_NONE, 'Display this program version.'),
new InputOption('--color', '-c', InputOption::PARAMETER_NONE, 'Force ANSI color output.'),
new InputOption('--no-interaction', '-n', InputOption::PARAMETER_NONE, 'Do not ask any interactive question.'),
//new InputOption('--no-interaction', '-n', InputOption::PARAMETER_NONE, 'Do not ask any interactive question.'),
));
}
@@ -45,13 +45,9 @@ class HelpCommand extends Command
->setAliases(array('?'))
->setDescription('Displays help for a command')
->setHelp(<<<EOF
The <info>help</info> command displays help for a given command:
<info>./symfony help test:all</info>
You can also output the help as XML by using the <comment>--xml</comment> option:
<info>./symfony help --xml test:all</info>
The <info>help</info> command displays help for a given command.
Use the comand <info>list</info> to see the list of commands.
Use <info>command</info> <comment>--help</comment> to see details about each command.
EOF
);
}
@@ -67,6 +67,14 @@ class Shell
{
$command = readline($this->application->getName().' > ');
/** changed by felipeNMoura **/
if($command == "\n" || $command == ""){
$this->output->write("");
continue;
}
/** end of changes made by felipnmoura **/
if (false === $command)
{
$this->output->writeln("\n");
+1 -1
Ver Arquivo
@@ -31,7 +31,7 @@ class Create extends MindCommand implements program
->setAction('action')
->setHelp(<<<EOT
You can create a new project by typing "create project name"
You can create your users typing "create user name" and then, adding the user to any specific group.
You can create your users typing "create user name" and then, adding the user to any specific project.
You need to be a super user to perform these actions
EOT
);
+1 -1
Ver Arquivo
@@ -18,7 +18,7 @@ class Info extends MindCommand implements program
{
$this
->setCommandName('info')
->setDescription('Performs some tests on theWebMind')
->setDescription('Shows some information about this instalation')
->setRestrict(true)
->setAction('action')
->setHelp(<<<EOT
+1 -1
Ver Arquivo
@@ -53,7 +53,7 @@
public function __construct()
{
$this->setCommandName('install')
->setDescription("This program will be able to install components to the application.")
->setDescription("Adds components to the application")
//->setFileName('modeloTeste') // use this if your class has NOT the same name as its file
->setRestrict(true)
->setAdminAccess()
+1
Ver Arquivo
@@ -28,6 +28,7 @@ EOT
public function action()
{
@session_destroy();
//\API\Program::execute('clear');
Mind::write('bye');
exit;
}
+18
Ver Arquivo
@@ -34,6 +34,19 @@ EOT
public function action()
{
GLOBAL $_MIND;
/*\API\Program::execute('clear');
echo "|==> |";
sleep(1);
\API\Program::execute('clear');
echo "|========> |";
sleep(1);
\API\Program::execute('clear');
echo "|===============> |";
sleep(1);
\API\Program::execute('clear');
echo "|=========================>|\n";
sleep(1);*/
ob_start();
$this->runStep1();
@@ -55,6 +68,11 @@ EOT
echo shell_exec($_MIND->conf['phpunit-src']." "._MINDSRC_."/Tests/");
}
ob_end_flush();
// gotoxy
// printf("\033[2;10f");
return true;
}
+54
Ver Arquivo
@@ -0,0 +1,54 @@
<?php
/**
* This file is part of TheWebMind 3rd generation.
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
* @license licenses/mind3rd.license
*/
use Symfony\Component\Console\Input\InputArgument,
Symfony\Component\Console\Input\InputOption,
Symfony\Component\Console;
/**
* This class represents a model for programs
*
* @author Felipe Nascimento de Moura <felipenmoura@gmail.com>
*/
class helpContent extends MindCommand implements program
{
public function executableFunction()
{
echo "theWebMind(or just mind):\n website: http://thewebmind.org\n Twitter: @thewebmind\n Docs: http://docs.thewebmind.org\n\n";
"The list of startup commands:\n".
" install : installs the application itself\n".
" uninstall: uninstalls the application, but do NOT remove projects,\n".
" users or history\n".
" remove : installs the application AND REMOVE every data it may\n".
" have created, including ALL projects, history and users.\n".
" --help :\n";
" -h :\n";
" help :\n";
" ? :\n";
" Shows this help content.\n\n";
echo "After installing, you can open the application by calling the 'mind' command anywhere.\n".
"You will also be able to send POST requisition to mind's server address sending the command you want to execute and its parameters.\n";
}
public function __construct()
{
$this->setCommandName('helps')
->setFileName('helpContent')
->setDescription("Shows the help content")
->setRestrict(false)
->setHelp("Shows the help content")
->setAction(function($class){
$class->executableFunction();
});
/*$this->addRequiredArgument('firstArgument',
'first, and required argument',
Array('X', 'Y', 'Z'));*/
$this->init();
}
}
+5 -3
Ver Arquivo
@@ -7,9 +7,9 @@
*/
// setting the general helperSet
$helperSet= false;
$helperSet= ($helperSet) ?: new Symfony\Component\Console\Helper\HelperSet();
$app->setHelperSet($helperSet);
$helperSet= true;
/*$helperSet= ($helperSet) ?: new Symfony\Component\Console\Helper\HelperSet();
$app->setHelperSet($helperSet);*/
if(isset($_SERVER['argv']))
{
@@ -21,6 +21,8 @@
/* let's load the plugins, if they are allowed */
Mind::$triggers= array_keys($app->getCommands());
//var_dump($app);
try {
$sh= new Symfony\Component\Console\Shell($app);
$sh->run();
+8 -13
Ver Arquivo
@@ -22,23 +22,18 @@ class UnixSetup extends Setup{
*/
public static function createExecFile()
{
/*
$uriToAdd= getcwd()."/";
//echo $uriToAdd."<br/>";
///usr/local/bin:/usr/bin:/bin
//echo shell_exec('echo $PATH');
echo "<br/>";
echo getenv('PATH').PATH_SEPARATOR.$uriToAdd;
echo "<br/>";
echo shell_exec('expert PATH=$PATH'.PATH_SEPARATOR.$uriToAdd);
echo shell_exec('echo $PATH');
echo "<br/>";
*/
self::$content= '<?php
$_REQ= Array();
$_REQ["env"]= "shell";
define("_MINDSRC_", "'.getcwd().'");
require("'.getcwd().'/mind3rd/API/utils/utils.php");';
if(sizeOf($_SERVER["argv"])>0 && isset($_SERVER["argv"][1])){
require("'.getcwd().'/mind");
}else{
require("'.getcwd().'/mind3rd/API/utils/utils.php");
}
';
echo " starting the installation...\n";
echo " creating the file...\n";
+1 -1
Ver Arquivo
@@ -28,7 +28,7 @@ abstract class WinSetup extends Setup{
* for readline on windows! Then, on windows, the system will run
* ONLY with HTTP requisitions...sorry guys!
*/
// <editor-fold defaultstate="collapsed" desc="Code responsible for the instalation in windows, but is not in use by now">
// <editor-fold defaultstate="collapsed" desc="Code responsible for the instalation in windows, but is not in use by now because some of the external console components does not work on Windows!">
/*
$runDir= str_replace('cmd.exe', '', getenv('COMSPEC'));
$phpBin= '';