From bb679398d94a4d7c84d9bf632a4e0719ba84dd9b Mon Sep 17 00:00:00 2001 From: Thomas Steur <thomas.steur@gmail.com> Date: Wed, 9 Oct 2013 02:26:43 +0000 Subject: [PATCH] added extended git pull command --- core/Console.php | 2 ++ plugins/CoreConsole/GitPull.php | 38 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 plugins/CoreConsole/GitPull.php diff --git a/core/Console.php b/core/Console.php index 7b3e319c61..152ecee3e1 100644 --- a/core/Console.php +++ b/core/Console.php @@ -13,6 +13,7 @@ namespace Piwik; use Piwik\Plugins\CoreConsole\GenerateApi; use Piwik\Plugins\CoreConsole\GenerateController; use Piwik\Plugins\CoreConsole\GeneratePlugin; +use Piwik\Plugins\CoreConsole\GitPull; use Piwik\Plugins\CoreConsole\RunTests; use Piwik\Plugins\CoreConsole\WatchLog; use Symfony\Component\Console\Application; @@ -28,6 +29,7 @@ class Console $console->add(new GenerateApi()); $console->add(new GenerateController()); $console->add(new WatchLog()); + $console->add(new GitPull()); $console->run(); } diff --git a/plugins/CoreConsole/GitPull.php b/plugins/CoreConsole/GitPull.php new file mode 100644 index 0000000000..97f1363d38 --- /dev/null +++ b/plugins/CoreConsole/GitPull.php @@ -0,0 +1,38 @@ +<?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\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * @package CoreConsole + */ +class GitPull extends Command +{ + protected function configure() + { + $this->setName('git:pull'); + $this->setDescription('Pull Piwik repo and all submodules'); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $cmd = sprintf('cd %s && git checkout master && git pull && git submodule update --init --recursive', PIWIK_DOCUMENT_ROOT); + + $output->writeln('Executing command: ' . $cmd); + passthru($cmd); + } +} \ No newline at end of file -- GitLab