Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--composer.json3
-rwxr-xr-xconsole11
-rw-r--r--core/Console.php28
-rw-r--r--core/Console/Command.php17
-rw-r--r--plugins/CoreConsole/GeneratePlugin.php43
-rw-r--r--plugins/CoreConsole/RunTests.php40
6 files changed, 141 insertions, 1 deletions
diff --git a/composer.json b/composer.json
index 6ea14e6d54..190c5de277 100644
--- a/composer.json
+++ b/composer.json
@@ -21,6 +21,7 @@
"require": {
"php": ">=5.3.0",
"twig/twig": "1.*",
- "leafo/lessphp": "0.3.*"
+ "leafo/lessphp": "0.3.*",
+ "symfony/console": ">=v2.3.5"
}
}
diff --git a/console b/console
new file mode 100755
index 0000000000..fd2581091f
--- /dev/null
+++ b/console
@@ -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(); \ No newline at end of file
diff --git a/core/Console.php b/core/Console.php
new file mode 100644
index 0000000000..6ee652182e
--- /dev/null
+++ b/core/Console.php
@@ -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();
+ }
+}
diff --git a/core/Console/Command.php b/core/Console/Command.php
new file mode 100644
index 0000000000..45954b7432
--- /dev/null
+++ b/core/Console/Command.php
@@ -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
+{
+}
diff --git a/plugins/CoreConsole/GeneratePlugin.php b/plugins/CoreConsole/GeneratePlugin.php
new file mode 100644
index 0000000000..db7717f850
--- /dev/null
+++ b/plugins/CoreConsole/GeneratePlugin.php
@@ -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));
+ }
+} \ No newline at end of file
diff --git a/plugins/CoreConsole/RunTests.php b/plugins/CoreConsole/RunTests.php
new file mode 100644
index 0000000000..f2178b45e1
--- /dev/null
+++ b/plugins/CoreConsole/RunTests.php
@@ -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);
+ }
+} \ No newline at end of file