Merge fixes

This commit is contained in:
Dan Cryer 2014-12-18 10:45:21 +00:00
commit 72581aa01e
21 changed files with 618 additions and 97 deletions

View file

@ -7,7 +7,7 @@ RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C300EE8C E5267A6C 0
RUN apt-get update
# Install PHP:
RUN apt-get install -qy git-core php5-common php5-cli php5-curl php5-imap php5-mcrypt php5-mysqlnd
RUN apt-get install -qy git-core php5-common php5-cli php5-curl php5-imap php5-mysqlnd
# Give Git some fake user details to prevent it asking when trying to test merges:
RUN git config --global user.name "PHPCI"

View file

@ -47,11 +47,30 @@ class Application extends b8\Application
return false;
};
// Check settings for disable_authentication enabled and user_id
$skipAuth = function () {
$config = b8\Config::getInstance();
$state = (bool)$config->get('phpci.authentication_settings.state', false);
$id = $config->get('phpci.authentication_settings.user_id', 0);
if (false !== $state && 0 != (int)$id) {
$user = b8\Store\Factory::getStore('User')
->getByPrimaryKey($id);
if ($user) {
$_SESSION['phpci_user'] = $user;
return true;
}
}
return false;
};
// Handler for the route we're about to register, checks for a valid session where necessary:
$routeHandler = function (&$route, Response &$response) use (&$request, $validateSession) {
$routeHandler = function (&$route, Response &$response) use (&$request, $validateSession, $skipAuth) {
$skipValidation = in_array($route['controller'], array('session', 'webhook', 'build-status'));
if (!$skipValidation && !$validateSession()) {
if (!$skipValidation && !$validateSession() && !$skipAuth()) {
if ($request->isAjax()) {
$response->setResponseCode(401);
$response->setContent('');
@ -72,8 +91,10 @@ class Application extends b8\Application
}
/**
* Handle an incoming web request.
*/
* Handle an incoming web request.
*
* @return b8\b8\Http\Response|Response
*/
public function handleRequest()
{
try {

View file

@ -119,7 +119,7 @@ class InstallCommand extends Command
}
// Check required extensions are present:
$requiredExtensions = array('PDO', 'pdo_mysql', 'mcrypt');
$requiredExtensions = array('PDO', 'pdo_mysql');
foreach ($requiredExtensions as $extension) {
if (!extension_loaded($extension)) {

View file

@ -121,7 +121,7 @@ class BuildController extends \PHPCI\Controller
$data = null;
if ($key && $build) {
$data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $numBuilds);
$data = $this->buildStore->getMeta($key, $build->getProjectId(), $buildId, $build->getBranch(), $numBuilds);
}
die(json_encode($data));

View file

@ -26,7 +26,6 @@ class PluginController extends \PHPCI\Controller
{
protected $required = array(
'php',
'ext-mcrypt',
'ext-pdo',
'ext-pdo_mysql',
'block8/b8framework',

View file

@ -20,12 +20,17 @@ use Symfony\Component\Yaml\Parser;
/**
* Settings Controller
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Web
*/
class SettingsController extends Controller
{
/**
* @var array
*/
protected $settings;
/**
@ -35,8 +40,8 @@ class SettingsController extends Controller
{
parent::init();
$parser = new Parser();
$yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml');
$parser = new Parser();
$yaml = file_get_contents(APPLICATION_PATH . 'PHPCI/config.yml');
$this->settings = $parser->parse($yaml);
}
@ -49,6 +54,7 @@ class SettingsController extends Controller
$this->requireAdmin();
$this->layout->title = Lang::get('settings');
$this->view->settings = $this->settings;
$basicSettings = array();
@ -66,10 +72,16 @@ class SettingsController extends Controller
$emailSettings = $this->settings['phpci']['email_settings'];
}
$authenticationSettings = array();
if (isset($this->settings['phpci']['authentication_settings'])) {
$authenticationSettings = $this->settings['phpci']['authentication_settings'];
}
$this->view->basicSettings = $this->getBasicForm($basicSettings);
$this->view->buildSettings = $this->getBuildForm($buildSettings);
$this->view->github = $this->getGithubForm();
$this->view->emailSettings = $this->getEmailForm($emailSettings);
$this->view->authenticationSettings = $this->getAuthenticationForm($authenticationSettings);
$this->view->isWriteable = $this->canWriteConfig();
if (!empty($this->settings['phpci']['github']['token'])) {
@ -86,9 +98,9 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['github']['id'] = $this->getParam('githubid', '');
$this->settings['phpci']['github']['id'] = $this->getParam('githubid', '');
$this->settings['phpci']['github']['secret'] = $this->getParam('githubsecret', '');
$error = $this->storeSettings();
$error = $this->storeSettings();
if ($error) {
header('Location: ' . PHPCI_URL . 'settings?saved=2');
@ -106,7 +118,7 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['email_settings'] = $this->getParams();
$this->settings['phpci']['email_settings'] = $this->getParams();
$this->settings['phpci']['email_settings']['smtp_encryption'] = $this->getParam('smtp_encryption', 0);
$error = $this->storeSettings();
@ -148,6 +160,26 @@ class SettingsController extends Controller
$this->requireAdmin();
$this->settings['phpci']['basic'] = $this->getParams();
$error = $this->storeSettings();
if ($error) {
header('Location: ' . PHPCI_URL . 'settings?saved=2');
} else {
header('Location: ' . PHPCI_URL . 'settings?saved=1');
}
die;
}
/**
* Handle authentication settings
*/
public function authentication()
{
$this->requireAdmin();
$this->settings['phpci']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0);
$this->settings['phpci']['authentication_settings']['user_id'] = $_SESSION['phpci_user_id'];
$error = $this->storeSettings();
@ -165,14 +197,14 @@ class SettingsController extends Controller
*/
public function githubCallback()
{
$code = $this->getParam('code', null);
$code = $this->getParam('code', null);
$github = $this->settings['phpci']['github'];
if (!is_null($code)) {
$http = new HttpClient();
$url = 'https://github.com/login/oauth/access_token';
$http = new HttpClient();
$url = 'https://github.com/login/oauth/access_token';
$params = array('client_id' => $github['id'], 'client_secret' => $github['secret'], 'code' => $code);
$resp = $http->post($url, $params);
$resp = $http->post($url, $params);
if ($resp['success']) {
parse_str($resp['body'], $resp);
@ -192,12 +224,13 @@ class SettingsController extends Controller
/**
* Convert config to yaml and store to file.
*
* @return mixed
*/
protected function storeSettings()
{
$dumper = new Dumper();
$yaml = $dumper->dump($this->settings, 4);
$yaml = $dumper->dump($this->settings, 4);
file_put_contents(APPLICATION_PATH . 'PHPCI/config.yml', $yaml);
if (error_get_last()) {
@ -413,4 +446,40 @@ class SettingsController extends Controller
return $form;
}
/**
* Form for disabling user authentication while using a default user
*
* @param array $values
* @return Form
*/
protected function getAuthenticationForm($values = array())
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/authentication');
$form->addField(new Form\Element\Csrf('csrf'));
$field = new Form\Element\Checkbox('disable_authentication');
$field->setCheckedValue(1);
$field->setRequired(false);
$field->setLabel('Disable Authentication?');
$field->setContainerClass('form-group');
$field->setValue(0);
if (isset($values['state'])) {
$field->setValue((int)$values['state']);
}
$form->addField($field);
$field = new Form\Element\Submit();
$field->setValue('Save &raquo;');
$field->setClass('btn btn-success pull-right');
$form->addField($field);
$form->setValues($values);
return $form;
}
}

View file

@ -256,6 +256,21 @@ class WebhookController extends \PHPCI\Controller
try {
// build on merge request events
if (isset($payload['object_kind']) && $payload['object_kind'] == 'merge_request') {
$attributes = $payload['object_attributes'];
if ( $attributes['state'] == 'opened' || $attributes['state'] == 'reopened') {
$branch = $attributes['source_branch'];
$commit = $attributes['last_commit'];
$committer = $commit['author']['email'];
$this->createBuild($project, $commit['id'], $branch, $committer, $commit['message'] );
}
}
// build on push events
if (isset($payload['commits']) && is_array($payload['commits'])) {
// If we have a list of commits, then add them all as builds to be tested:

View file

@ -68,6 +68,8 @@ class Lint implements PHPCI\Plugin
$success = true;
$php = $this->phpci->findBinary('php');
$this->phpci->logExecOutput(false);
foreach ($this->directories as $dir) {
if (!$this->lintDirectory($php, $dir)) {
@ -76,6 +78,8 @@ class Lint implements PHPCI\Plugin
}
$this->phpci->quiet = false;
$this->phpci->logExecOutput(true);
return $success;
}

View file

@ -106,10 +106,11 @@ class PhpParallelLint implements \PHPCI\Plugin
*/
protected function getFlags()
{
$ignore = '';
if (count($this->ignore)) {
$ignore = ' --exclude ' . implode(' --exclude ', $this->ignore);
$ignoreFlags = array();
foreach ($this->ignore as $ignoreDir) {
$ignoreFlags[] = '--exclude "' . $this->phpci->buildPath . $ignoreDir . '"';
}
$ignore = implode(' ', $ignoreFlags);
return array($ignore);
}

266
PHPCI/Plugin/PhpTalLint.php Normal file
View file

@ -0,0 +1,266 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
/**
* PHPTAL Lint Plugin - Provides access to PHPTAL lint functionality.
* @author Stephen Ball <phpci@stephen.rebelinblue.com>
* @package PHPCI
* @subpackage Plugins
*/
class PhpTalLint implements PHPCI\Plugin
{
protected $directories;
protected $recursive = true;
protected $suffixes;
protected $ignore;
/**
* @var \PHPCI\Builder
*/
protected $phpci;
/**
* @var \PHPCI\Model\Build
*/
protected $build;
/**
* @var string The path to a file contain custom phptal_tales_ functions
*/
protected $tales;
/**
* @var int
*/
protected $allowed_warnings;
/**
* @var int
*/
protected $allowed_errors;
/**
* @var array The results of the lint scan
*/
protected $failedPaths = array();
/**
* Standard Constructor
*
* @param Builder $phpci
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$this->phpci = $phpci;
$this->build = $build;
$this->directories = array('');
$this->suffixes = array('zpt');
$this->ignore = $phpci->ignore;
$this->allowed_warnings = 0;
$this->allowed_errors = 0;
if (!empty($options['directory'])) {
$this->directories = array($options['directory']);
}
if (isset($options['suffixes'])) {
$this->suffixes = (array)$options['suffixes'];
}
$this->setOptions($options);
}
/**
* Handle this plugin's options.
* @param $options
*/
protected function setOptions($options)
{
foreach (array('directories', 'tales', 'allowed_warnings', 'allowed_errors') as $key) {
if (array_key_exists($key, $options)) {
$this->{$key} = $options[$key];
}
}
}
/**
* Executes phptal lint
*/
public function execute()
{
$this->phpci->quiet = true;
$this->phpci->logExecOutput(false);
foreach ($this->directories as $dir) {
$this->lintDirectory($dir);
}
$this->phpci->quiet = false;
$this->phpci->logExecOutput(true);
$errors = 0;
$warnings = 0;
foreach ($this->failedPaths as $path) {
if ($path['type'] == 'error') {
$errors++;
} else {
$warnings++;
}
}
$this->build->storeMeta('phptallint-warnings', $warnings);
$this->build->storeMeta('phptallint-errors', $errors);
$this->build->storeMeta('phptallint-data', $this->failedPaths);
$success = true;
if ($this->allowed_warnings != -1 && $warnings > $this->allowed_warnings) {
$success = false;
}
if ($this->allowed_errors != -1 && $errors > $this->allowed_errors) {
$success = false;
}
return $success;
}
/**
* Lint an item (file or directory) by calling the appropriate method.
* @param $item
* @param $itemPath
* @return bool
*/
protected function lintItem($item, $itemPath)
{
$success = true;
if ($item->isFile() && in_array(strtolower($item->getExtension()), $this->suffixes)) {
if (!$this->lintFile($itemPath)) {
$success = false;
}
} elseif ($item->isDir() && $this->recursive && !$this->lintDirectory($itemPath . '/')) {
$success = false;
}
return $success;
}
/**
* Run phptal lint against a directory of files.
* @param $path
* @return bool
*/
protected function lintDirectory($path)
{
$success = true;
$directory = new \DirectoryIterator($this->phpci->buildPath . $path);
foreach ($directory as $item) {
if ($item->isDot()) {
continue;
}
$itemPath = $path . $item->getFilename();
if (in_array($itemPath, $this->ignore)) {
continue;
}
if (!$this->lintItem($item, $itemPath)) {
$success = false;
}
}
return $success;
}
/**
* Run phptal lint against a specific file.
* @param $path
* @return bool
*/
protected function lintFile($path)
{
$success = true;
list($suffixes, $tales) = $this->getFlags();
// FIXME: Find a way to clean this up
$lint = dirname(__FILE__) . '/../../vendor/phptal/phptal/tools/phptal_lint.php';
$cmd = '/usr/bin/env php ' . $lint . ' %s %s "%s"';
$this->phpci->executeCommand($cmd, $suffixes, $tales, $this->phpci->buildPath . $path);
$output = $this->phpci->getLastOutput();
// FIXME: This is very messy, clean it up
if (preg_match('/Found (.+?) (error|warning)/i', $output, $matches)) {
$rows = explode(PHP_EOL, $output);
unset($rows[0]);
unset($rows[1]);
unset($rows[2]);
unset($rows[3]);
foreach ($rows as $row) {
$name = basename($path);
$row = str_replace('(use -i to include your custom modifier functions)', '', $row);
$message = str_replace($name . ': ', '', $row);
$parts = explode(' (line ', $message);
$message = trim($parts[0]);
$line = str_replace(')', '', $parts[1]);
$this->failedPaths[] = array(
'file' => $path,
'line' => $line,
'type' => $matches[2],
'message' => $message
);
}
$success = false;
}
return $success;
}
/**
* Process options and produce an arguments string for PHPTAL Lint.
* @return array
*/
protected function getFlags()
{
$tales = '';
if (!empty($this->tales)) {
$tales = ' -i ' . $this->phpci->buildPath . $this->tales;
}
$suffixes = '';
if (count($this->suffixes)) {
$suffixes = ' -e ' . implode(',', $this->suffixes);
}
return array($suffixes, $tales);
}
}

View file

@ -142,6 +142,11 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
*/
public function execute()
{
if (empty($this->xmlConfigFile) && empty($this->directory)) {
$this->phpci->logFailure('Neither configuration file nor test directory found.');
return false;
}
$success = true;
$this->phpci->logExecOutput(false);

View file

@ -115,12 +115,12 @@ class ProjectService
if ($project->getType() == 'gitlab') {
$info = array();
if (preg_match('`^(.*)@(.*):([0-9]+)?/?(.*)/(.*)\.git`', $reference, $matches)) {
if (preg_match('`^(.+)@(.+):([0-9]*)\/?(.+)\.git`', $reference, $matches)) {
$info['user'] = $matches[1];
$info['domain'] = $matches[2];
$info['port'] = $matches[3];
$project->setReference($matches[4] . '/' . $matches[5]);
$project->setReference($matches[4]);
}
$project->setAccessInformation($info);

View file

@ -114,21 +114,28 @@ class BuildStore extends BuildStoreBase
* @param $key
* @param $projectId
* @param null $buildId
* @param null $branch
* @param int $numResults
* @return array|null
*/
public function getMeta($key, $projectId, $buildId = null, $numResults = 1)
public function getMeta($key, $projectId, $buildId = null, $branch = null, $numResults = 1)
{
$select = '`build_id`, `meta_key`, `meta_value`';
$and = $numResults > 1 ? ' AND (`build_id` <= :buildId) ' : ' AND (`build_id` = :buildId) ';
$where = '`meta_key` = :key AND `project_id` = :projectId ' . $and;
$query = 'SELECT '.$select.' FROM `build_meta` WHERE '.$where.' ORDER BY id DESC LIMIT :numResults';
$select = '`bm`.`build_id`, `bm`.`meta_key`, `bm`.`meta_value`';
$and = $numResults > 1 ? ' AND (`bm`.`build_id` <= :buildId) ' : ' AND (`bm`.`build_id` = :buildId) ';
$where = '`bm`.`meta_key` = :key AND `bm`.`project_id` = :projectId ' . $and;
$from = ' `build_meta` AS `bm`';
if($branch !== null) {
$where .= ' AND `b`.`branch` = :branch AND `b`.`id`= `bm`.`build_id` ';
$from .= ', `build` AS `b`';
}
$query = 'SELECT '.$select.' FROM '.$from.' WHERE '.$where.' ORDER BY `bm`.id DESC LIMIT :numResults';
$stmt = Database::getConnection('read')->prepare($query);
$stmt->bindValue(':key', $key, \PDO::PARAM_STR);
$stmt->bindValue(':projectId', (int)$projectId, \PDO::PARAM_INT);
$stmt->bindValue(':buildId', (int)$buildId, \PDO::PARAM_INT);
$stmt->bindValue(':numResults', (int)$numResults, \PDO::PARAM_INT);
$stmt->bindValue(':branch', $branch, \PDO::PARAM_STR);
if ($stmt->execute()) {
$rtn = $stmt->fetchAll(\PDO::FETCH_ASSOC);

View file

@ -93,7 +93,7 @@
<?php if ($project->getSshPublicKey()): ?>
<div class="box box-info">
<div class="box-header"><h3 class="box-title"><a data-toggle="collapse" data-parent="#accordion" href="#publicCollapse"><?php Lang::out('public_key'); ?></a></h3></div>
<div class="box-body" style="word-break: break-word;"><?php print $project->getSshPublicKey(); ?></div>
<div class="box-body" style="word-break: break-all;"><?php print $project->getSshPublicKey(); ?></div>
</div>
<?php endif; ?>
</div>

View file

@ -114,4 +114,19 @@
<?php print $emailSettings; ?>
</div>
</div>
</div>
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">Authentication Settings</h3>
</div>
<div class="box-body clearfix">
<p class="alert alert-warning clearfix">
Be careful: This setting disables authentication and uses your current admin account for all actions within phpci with admin rights.
</p>
<?php print $authenticationSettings; ?>
</div>
</div>

View file

@ -15,7 +15,7 @@ We have a chat room for discussing PHPCI, you can access it here: [![Gitter](htt
* Clones your project from Github, Bitbucket or a local path
* Allows you to set up and tear down test databases.
* Installs your project's Composer dependencies.
* Runs through any combination of the [supported plugins](https://github.com/Block8/PHPCI/wiki#plugins).
* Runs through any combination of the [supported plugins](https://www.phptesting.org/wiki#plugins).
* You can mark directories for the plugins to ignore.
* You can mark certain plugins as being allowed to fail (but still run.)
@ -27,10 +27,10 @@ We have a chat room for discussing PHPCI, you can access it here: [![Gitter](htt
* Deployments.
## Getting Started:
We've got documentation on our wiki on [installing PHPCI](https://github.com/Block8/PHPCI/wiki/Installing-PHPCI) and [adding support for PHPCI to your projects](https://github.com/Block8/PHPCI/wiki/Adding-PHPCI-Support-to-Your-Projects).
We've got documentation on our website on [installing PHPCI](https://www.phptesting.org/install-phpci) and [adding support for PHPCI to your projects](https://www.phptesting.org/wiki/Adding-PHPCI-Support-to-Your-Projects).
##Contributing
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://github.com/Block8/PHPCI/wiki/Contributing-to-PHPCI) for more information on how to get involved.
Contributions from others would be very much appreciated! Please read our [guide to contributing](https://www.phptesting.org/wiki/Contributing-to-PHPCI) for more information on how to get involved.
##Questions?
Your best place to go is the [mailing list](https://groups.google.com/forum/#!forum/php-ci), if you're already a member of the mailing list, you can simply email php-ci@googlegroups.com.

View file

@ -20,12 +20,9 @@ if (empty($timezone)) {
// env for an alternative config path.
$configFile = dirname(__FILE__) . '/PHPCI/config.yml';
if (!file_exists($configFile)) {
$configEnv = getenv('phpci_config_file');
if (!empty($configEnv)) {
$configFile = $configEnv;
}
$configEnv = getenv('phpci_config_file');
if (!empty($configEnv)) {
$configFile = $configEnv;
}
// If we don't have a config file at all, fail at this point and tell the user to install:

View file

@ -30,7 +30,6 @@
"require": {
"php": ">=5.3.8",
"ext-mcrypt": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*",
"block8/b8framework": "~1.0",
@ -64,6 +63,7 @@
"atoum/atoum": "Atoum",
"jakub-onderka/php-parallel-lint": "Parallel Linting Tool",
"behat/behat": "Behat BDD Testing",
"hipchat/hipchat-php": "Hipchat integration"
"hipchat/hipchat-php": "Hipchat integration",
"phptal/phptal": "PHPTAL templating engine"
}
}

149
composer.lock generated
View file

@ -1,9 +1,10 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "650fe5576922dea4ac3b1be72d882a58",
"hash": "8b68ffb25f62f3245d64c9e97e8cd70e",
"packages": [
{
"name": "block8/b8framework",
@ -171,12 +172,12 @@
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Pimple.git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d",
"reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d",
"shasum": ""
},
@ -201,9 +202,7 @@
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
"email": "fabien@symfony.com"
}
],
"description": "Pimple is a simple Dependency Injection Container for PHP 5.3",
@ -311,16 +310,16 @@
},
{
"name": "swiftmailer/swiftmailer",
"version": "v5.3.0",
"version": "v5.3.1",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
"reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205"
"reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/b86b927dfefdb56ab0b22d1350033d9a38e9f205",
"reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205",
"url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/c5f963e7f9d6f6438fda4f22d5cc2db296ec621a",
"reference": "c5f963e7f9d6f6438fda4f22d5cc2db296ec621a",
"shasum": ""
},
"require": {
@ -359,7 +358,7 @@
"mail",
"mailer"
],
"time": "2014-10-04 05:53:18"
"time": "2014-12-05 14:17:14"
},
{
"name": "symfony/class-loader",
@ -721,25 +720,25 @@
},
{
"name": "pdepend/pdepend",
"version": "2.0.3",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/pdepend/pdepend.git",
"reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60"
"reference": "1b0acf162da4f30237987e61e177a57f78e3d87e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pdepend/pdepend/zipball/dc582a3c0180664a8fbfc5a34efaf4cc13fccc60",
"reference": "dc582a3c0180664a8fbfc5a34efaf4cc13fccc60",
"url": "https://api.github.com/repos/pdepend/pdepend/zipball/1b0acf162da4f30237987e61e177a57f78e3d87e",
"reference": "1b0acf162da4f30237987e61e177a57f78e3d87e",
"shasum": ""
},
"require": {
"symfony/config": "@stable",
"symfony/dependency-injection": "@stable",
"symfony/filesystem": "@stable"
"symfony/config": ">=2.4",
"symfony/dependency-injection": ">=2.4",
"symfony/filesystem": ">=2.4"
},
"require-dev": {
"phpunit/phpunit": "3.*@stable",
"phpunit/phpunit": "4.*@stable",
"squizlabs/php_codesniffer": "@stable"
},
"bin": [
@ -756,7 +755,7 @@
"BSD-3-Clause"
],
"description": "Official version of pdepend to be handled with Composer",
"time": "2014-10-08 06:54:50"
"time": "2014-12-04 12:38:39"
},
{
"name": "phpdocumentor/reflection-docblock",
@ -1252,16 +1251,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.3.5",
"version": "4.4.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1"
"reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2dab9d593997db4abcf58d0daf798eb4e9cecfe1",
"reference": "2dab9d593997db4abcf58d0daf798eb4e9cecfe1",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0",
"reference": "bbe7bcb83b6ec1a9eaabbe1b70d4795027c53ee0",
"shasum": ""
},
"require": {
@ -1278,8 +1277,9 @@
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.0",
"sebastian/diff": "~1.1",
"sebastian/environment": "~1.0",
"sebastian/environment": "~1.1",
"sebastian/exporter": "~1.0",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
"symfony/yaml": "~2.0"
},
@ -1292,7 +1292,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.3.x-dev"
"dev-master": "4.4.x-dev"
}
},
"autoload": {
@ -1301,10 +1301,6 @@
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"",
"../../symfony/yaml/"
],
"license": [
"BSD-3-Clause"
],
@ -1316,13 +1312,13 @@
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "http://www.phpunit.de/",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"time": "2014-11-11 10:11:09"
"time": "2014-12-05 06:49:03"
},
{
"name": "phpunit/phpunit-mock-objects",
@ -1381,16 +1377,16 @@
},
{
"name": "sebastian/comparator",
"version": "1.0.1",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef"
"reference": "c484a80f97573ab934e37826dba0135a3301b26a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef",
"reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/c484a80f97573ab934e37826dba0135a3301b26a",
"reference": "c484a80f97573ab934e37826dba0135a3301b26a",
"shasum": ""
},
"require": {
@ -1404,7 +1400,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
"dev-master": "1.1.x-dev"
}
},
"autoload": {
@ -1441,7 +1437,7 @@
"compare",
"equality"
],
"time": "2014-05-11 23:00:21"
"time": "2014-11-16 21:32:38"
},
{
"name": "sebastian/diff",
@ -1695,6 +1691,57 @@
],
"time": "2013-08-04 09:35:29"
},
{
"name": "sebastian/global-state",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "~4.2"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"time": "2014-10-06 09:23:50"
},
{
"name": "sebastian/version",
"version": "1.0.3",
@ -1732,16 +1779,16 @@
},
{
"name": "squizlabs/php_codesniffer",
"version": "1.5.5",
"version": "1.5.6",
"source": {
"type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "5d973e59cf58a0c847f298de84374c96b42b17b3"
"reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5d973e59cf58a0c847f298de84374c96b42b17b3",
"reference": "5d973e59cf58a0c847f298de84374c96b42b17b3",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5",
"reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5",
"shasum": ""
},
"require": {
@ -1803,7 +1850,7 @@
"phpcs",
"standards"
],
"time": "2014-09-25 03:33:46"
"time": "2014-12-04 22:32:15"
},
{
"name": "symfony/dependency-injection",
@ -1950,20 +1997,14 @@
"time": "2014-09-13 10:57:19"
}
],
"aliases": [
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [
],
"stability-flags": [],
"prefer-stable": false,
"platform": {
"php": ">=5.3.8",
"ext-mcrypt": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*"
},
"platform-dev": [
]
"platform-dev": []
}

View file

@ -0,0 +1,79 @@
var phptalPlugin = ActiveBuild.UiPlugin.extend({
id: 'build-phptal',
css: 'col-lg-6 col-md-12 col-sm-12 col-xs-12',
title: 'PHPTAL Lint',
lastData: null,
box: true,
rendered: false,
register: function() {
var self = this;
var query = ActiveBuild.registerQuery('phptallint-data', -1, {key: 'phptallint-data'})
$(window).on('phptallint-data', function(data) {
self.onUpdate(data);
});
$(window).on('build-updated', function() {
if (!self.rendered) {
query();
}
});
},
render: function() {
return $('<table class="table" id="phptal-data">' +
'<thead>' +
'<tr>' +
' <th>File</th>' +
' <th>Line</th>' +
' <th>Message</th>' +
'</tr>' +
'</thead><tbody></tbody></table>');
},
onUpdate: function(e) {
if (!e.queryData) {
$('#build-phptal').hide();
return;
}
this.rendered = true;
this.lastData = e.queryData;
var errors = this.lastData[0].meta_value;
var tbody = $('#phptal-data tbody');
tbody.empty();
if (errors.length == 0) {
$('#build-phptal').hide();
return;
}
for (var i in errors) {
var file = errors[i].file;
if (ActiveBuild.fileLinkTemplate) {
var fileLink = ActiveBuild.fileLinkTemplate.replace('{FILE}', file);
fileLink = fileLink.replace('{LINE}', errors[i].line);
file = '<a target="_blank" href="'+fileLink+'">' + file + '</a>';
}
var row = $('<tr>' +
'<td>'+file+'</td>' +
'<td>'+errors[i].line+'</td>' +
'<td>'+errors[i].message+'</td></tr>');
if (errors[i].type == 'error') {
row.addClass('danger');
}
tbody.append(row);
}
$('#build-phptal').show();
}
});
ActiveBuild.registerPlugin(new phptalPlugin());

View file

@ -8,7 +8,9 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({
'phpcs-errors': Lang.get('phpcs_errors'),
'phplint-errors': Lang.get('phplint_errors'),
'phpunit-errors': Lang.get('phpunit_errors'),
'phpdoccheck-warnings': Lang.get('phpdoccheck')
'phpdoccheck-warnings': Lang.get('phpdoccheck'),
'phptallint-errors': Lang.get('phptal_errors'),
'phptallint-warnings': Lang.get('phptal_warnings')
},
data: {},
displayOnUpdate: false,
@ -22,7 +24,7 @@ var warningsPlugin = ActiveBuild.UiPlugin.extend({
queries.push(ActiveBuild.registerQuery(key, -1, {num_builds: 10, key: key}));
}
$(window).on('phpmd-warnings phpcs-warnings phpcs-errors phplint-errors phpunit-errors phpdoccheck-warnings', function(data) {
$(window).on('phpmd-warnings phpcs-warnings phptallint-warnings phptallint-errors phpcs-errors phplint-errors phpunit-errors phpdoccheck-warnings', function(data) {
self.onUpdate(data);
});