From 14f40e9b0ff333ae37430baff73d4f97da13ae89 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Fri, 10 May 2013 15:00:24 +0100 Subject: [PATCH] Updating PHPCI to use Composer-installed copies of the plugin requirements --- PHPCI/Plugin/Composer.php | 2 +- PHPCI/Plugin/Mysql.php | 4 +++- PHPCI/Plugin/PhpCodeSniffer.php | 2 +- PHPCI/Plugin/PhpCpd.php | 2 +- PHPCI/Plugin/PhpMessDetector.php | 2 +- PHPCI/Plugin/PhpUnit.php | 2 +- composer.json | 8 +++++++- cron.php | 3 +++ 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index a432da7a..0d470db4 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -17,6 +17,6 @@ class Composer implements \PHPCI\Plugin public function execute() { - return $this->phpci->executeCommand('composer --working-dir=' . $this->directory . ' ' . $this->action); + return $this->phpci->executeCommand(PHPCI_DIR . 'composer.phar --working-dir=' . $this->directory . ' ' . $this->action); } } \ No newline at end of file diff --git a/PHPCI/Plugin/Mysql.php b/PHPCI/Plugin/Mysql.php index 7793971f..12786e44 100644 --- a/PHPCI/Plugin/Mysql.php +++ b/PHPCI/Plugin/Mysql.php @@ -17,9 +17,11 @@ class Mysql implements \PHPCI\Plugin { $rtn = true; + $db = \b8\Database::getConnection('write')->getDetails(); + foreach($this->queries as $query) { - $rtn = !$this->phpci->executeCommand('mysql -uroot -e "'.$query.'"') ? false : $rtn; + $rtn = !$this->phpci->executeCommand('mysql -h'.PHPCI_DB_HOST.' -u'.$db['user'].(!empty($db['pass']) ? ' -p' . $db['pass'] : '').' -e "'.$query.'"') ? false : $rtn; } return $rtn; diff --git a/PHPCI/Plugin/PhpCodeSniffer.php b/PHPCI/Plugin/PhpCodeSniffer.php index a1d068ea..9b7095c3 100644 --- a/PHPCI/Plugin/PhpCodeSniffer.php +++ b/PHPCI/Plugin/PhpCodeSniffer.php @@ -27,6 +27,6 @@ class PhpCodeSniffer implements \PHPCI\Plugin $ignore = ' --ignore=' . implode(',', $ignore); } - return $this->phpci->executeCommand('phpcs --standard=' . $this->standard . $ignore. ' ' . $this->phpci->buildPath); + return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpcs --standard=' . $this->standard . $ignore. ' ' . $this->phpci->buildPath); } } \ No newline at end of file diff --git a/PHPCI/Plugin/PhpCpd.php b/PHPCI/Plugin/PhpCpd.php index 0308138a..30d9f0ae 100644 --- a/PHPCI/Plugin/PhpCpd.php +++ b/PHPCI/Plugin/PhpCpd.php @@ -27,6 +27,6 @@ class PhpCpd implements \PHPCI\Plugin $ignore = ' ' . implode('', $ignore); } - return $this->phpci->executeCommand('phpcpd ' . $ignore . ' ' . $this->phpci->buildPath); + return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpcpd ' . $ignore . ' ' . $this->phpci->buildPath); } } \ No newline at end of file diff --git a/PHPCI/Plugin/PhpMessDetector.php b/PHPCI/Plugin/PhpMessDetector.php index 1453c4ae..3a43415c 100644 --- a/PHPCI/Plugin/PhpMessDetector.php +++ b/PHPCI/Plugin/PhpMessDetector.php @@ -23,6 +23,6 @@ class PhpMessDetector implements \PHPCI\Plugin $ignore = ' --exclude ' . implode(',', $ignore); } - return $this->phpci->executeCommand('phpmd ' . $this->phpci->buildPath . ' text codesize,unusedcode,naming' . $ignore); + return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpmd ' . $this->phpci->buildPath . ' text codesize,unusedcode,naming' . $ignore); } } \ No newline at end of file diff --git a/PHPCI/Plugin/PhpUnit.php b/PHPCI/Plugin/PhpUnit.php index 08ff7afb..d34ee3d5 100644 --- a/PHPCI/Plugin/PhpUnit.php +++ b/PHPCI/Plugin/PhpUnit.php @@ -17,6 +17,6 @@ class PhpUnit implements \PHPCI\Plugin public function execute() { - return $this->phpci->executeCommand('phpunit ' . $this->args . ' ' . $this->phpci->buildPath . $this->directory); + return $this->phpci->executeCommand(PHPCI_BIN_DIR . 'phpunit ' . $this->args . ' ' . $this->phpci->buildPath . $this->directory); } } \ No newline at end of file diff --git a/composer.json b/composer.json index 8051ec2d..9840acbe 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "name": "block8/phpci", "description": "Simple continuous integration for PHP projects.", + "minimum-stability": "dev", "authors": [ { @@ -10,6 +11,11 @@ ], "require": { - "block8/b8framework": "dev-master" + "block8/b8framework": "dev-master", + "phpunit/phpunit": "3.*", + "phpmd/phpmd" : "1.*", + "sebastian/phpcpd": "1.*", + "squizlabs/php_codesniffer": "1.*", + "ext-yaml": "*" } } \ No newline at end of file diff --git a/cron.php b/cron.php index dcd2bfcf..80dbe7d8 100644 --- a/cron.php +++ b/cron.php @@ -5,6 +5,9 @@ ini_set('display_errors', 'on'); require_once('bootstrap.php'); +define('PHPCI_BIN_DIR', dirname(__FILE__) . '/vendor/bin/'); +define('PHPCI_DIR', dirname(__FILE__) . '/'); + $store = b8\Store\Factory::getStore('Build'); $result = $store->getByStatus(0);