forked from matomo-org/matomo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs matomo-org#4121 added simple command line tool including a not y…
…et working tests and generatePlugin command
- Loading branch information
Showing
6 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
define('PIWIK_DOCUMENT_ROOT', dirname(__FILE__) == '/' ? '' : dirname(__FILE__)); | ||
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT); | ||
define('PIWIK_USER_PATH', PIWIK_DOCUMENT_ROOT); | ||
|
||
require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; | ||
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; | ||
|
||
$console = new Piwik\Console(); | ||
$console->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik | ||
* @package Piwik | ||
*/ | ||
namespace Piwik; | ||
|
||
use Piwik\Plugins\CoreConsole\GeneratePlugin; | ||
use Piwik\Plugins\CoreConsole\RunTests; | ||
use Symfony\Component\Console\Application; | ||
|
||
class Console | ||
{ | ||
public function run() | ||
{ | ||
$console = new Application(); | ||
|
||
$console->add(new RunTests()); | ||
$console->add(new GeneratePlugin()); | ||
|
||
$console->run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik | ||
* @package Piwik | ||
*/ | ||
namespace Piwik\Console; | ||
|
||
use Symfony\Component\Console\Command\Command as SymfonyCommand; | ||
|
||
class Command extends SymfonyCommand | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik_Plugins | ||
* @package CoreConsole | ||
*/ | ||
|
||
namespace Piwik\Plugins\CoreConsole; | ||
|
||
use Piwik\Console\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
/** | ||
* @package CoreConsole | ||
*/ | ||
class GeneratePlugin extends Command | ||
{ | ||
protected function configure() | ||
{ | ||
$this->setName('generate:plugin'); | ||
$this->setDescription('Generates a new plugin including all needed files'); | ||
$this->setDefinition(array( | ||
new InputArgument('name', InputArgument::REQUIRED, 'Plugin name ([a-Z0-9_-])'), | ||
new InputArgument('version', InputArgument::REQUIRED, 'Plugin version'), | ||
new InputArgument('description', InputArgument::REQUIRED, 'Plugin description, max 150 characters.') | ||
)); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$pluginName = $input->getArgument('name'); | ||
$version = $input->getArgument('version'); | ||
$description = $input->getArgument('description'); | ||
|
||
$output->writeln(sprintf('Dir listing for <info>%s</info>', $pluginName)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Piwik - Open source web analytics | ||
* | ||
* @link http://piwik.org | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later | ||
* | ||
* @category Piwik_Plugins | ||
* @package CoreConsole | ||
*/ | ||
|
||
namespace Piwik\Plugins\CoreConsole; | ||
|
||
use Piwik\Console\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
/** | ||
* @package CoreConsole | ||
*/ | ||
class RunTests extends Command | ||
{ | ||
protected function configure() | ||
{ | ||
$this->setName('tests'); | ||
$this->setDescription('Run Piwik PHPUnit tests'); | ||
$this->addArgument('options', InputArgument::OPTIONAL, 'All options will be forwarded to phpunit', ''); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$options = $input->getArgument('options'); | ||
echo '' . $options;return; | ||
$cmd = sprintf('cd %s/tests/PHPUnit && phpunit %s', PIWIK_DOCUMENT_ROOT, $options); | ||
|
||
$output->writeln('Executing command: ' . $cmd); | ||
passthru($cmd); | ||
} | ||
} |