Merge remote-tracking branch 'upstream/master'

This commit is contained in:
japaveh 2013-07-25 23:21:13 +02:00
commit 89c0082ad4
10 changed files with 89 additions and 11 deletions

View file

@ -50,6 +50,7 @@ class InstallCommand extends Command
$conf['phpci']['email_settings']['smtp_address'] = $this->ask('(Optional) Smtp server address: ', true);
$conf['phpci']['email_settings']['smtp_port'] = $this->ask('(Optional) Smtp port: ', true);
$conf['phpci']['email_settings']['smtp_encryption'] = $this->ask('(Optional) Smtp encryption: ', true);
$conf['phpci']['email_settings']['smtp_username'] = $this->ask('(Optional) Smtp Username: ', true);
$conf['phpci']['email_settings']['smtp_password'] = $this->ask('(Optional) Smtp Password: ', true);
$conf['phpci']['email_settings']['from_address'] = $this->ask('(Optional) Email address to send from: ', true);

View file

@ -79,6 +79,7 @@ class BuildController extends \PHPCI\Controller
$build = $this->_buildStore->save($build);
header('Location: '.PHPCI_URL.'build/view/' . $build->getId());
exit;
}
/**
@ -94,6 +95,7 @@ class BuildController extends \PHPCI\Controller
$this->_buildStore->delete($build);
header('Location: '.PHPCI_URL.'project/view/' . $build->getProjectId());
exit;
}
/**

View file

@ -63,6 +63,7 @@ class ProjectController extends \PHPCI\Controller
$build = $this->_buildStore->save($build);
header('Location: '.PHPCI_URL.'build/view/' . $build->getId());
exit;
}
/**

View file

@ -25,11 +25,22 @@ class LocalBuild extends Build
* Create a working copy by cloning, copying, or similar.
*/
public function createWorkingCopy(Builder $builder, $buildPath)
{
{
$reference = $this->getProject()->getReference();
$reference = substr($reference, -1) == '/' ? substr($reference, 0, -1) : $reference;
$buildPath = substr($buildPath, 0, -1);
$yamlParser = new YamlParser();
if(is_file($reference.'/config')) {
//We're probably looing at a bare repository. We'll open the config and check
$gitConfig = parse_ini_file($reference.'/config',TRUE);
if($gitConfig["core"]["bare"]) {
// Looks like we're right. We need to extract the archive!
$guid = uniqid();
$builder->executeCommand('mkdir "/tmp/%s" && git --git-dir="%s" archive master | tar -x -C "/tmp/%s"', $guid, $reference, $guid);
$reference = '/tmp/'.$guid;
}
}
if (!is_file($reference . '/phpci.yml')) {
$builder->logFailure('Project does not contain a phpci.yml file.');

51
PHPCI/Plugin/Atoum.php Normal file
View file

@ -0,0 +1,51 @@
<?php
namespace PHPCI\Plugin;
class Atoum implements \PHPCI\Plugin
{
private $args;
private $config;
private $directory;
private $executable;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
if (isset($options['executable'])) {
$this->executable = $options['executable'];
}
else {
$this->executable = './vendor/bin/atoum';
}
if (isset($options['args'])) {
$this->args = $options['args'];
}
if (isset($options['config'])) {
$this->config = $options['config'];
}
if (isset($options['directory'])) {
$this->directory = $options['directory'];
}
}
public function execute()
{
$cmd = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->executable;
if ($this->args !== null) {
$cmd .= " {$this->args}";
}
if ($this->config !== null) {
$cmd .= " -c '{$this->config}'";
}
if ($this->directory !== null) {
$cmd .= " -d '{$this->directory}'";
}
return $this->phpci->executeCommand($cmd);
}
}

View file

@ -19,6 +19,7 @@ class Composer implements \PHPCI\Plugin
{
protected $directory;
protected $action;
protected $preferDist;
protected $phpci;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
@ -27,6 +28,7 @@ class Composer implements \PHPCI\Plugin
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $path . '/' . $options['directory'] : $path;
$this->action = isset($options['action']) ? $options['action'] : 'update';
$this->preferDist = isset($options['prefer_dist']) ? $options['prefer_dist'] : true;
}
/**
@ -34,7 +36,7 @@ class Composer implements \PHPCI\Plugin
*/
public function execute()
{
$cmd = PHPCI_DIR . 'composer.phar --prefer-dist --working-dir="%s" %s';
$cmd = PHPCI_DIR . 'composer.phar '. ($this->preferDist ? '--prefer-dist' : null) .' --working-dir="%s" %s';
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);
}
}

View file

@ -140,7 +140,8 @@ class Email implements \PHPCI\Plugin
/** @var \Swift_SmtpTransport $transport */
$transport = \Swift_SmtpTransport::newInstance(
$this->getMailConfig('smtp_address'),
$this->getMailConfig('smtp_port')
$this->getMailConfig('smtp_port'),
$this->getMailConfig('smtp_encryption')
);
$transport->setUsername($this->getMailConfig('smtp_username'));
$transport->setPassword($this->getMailConfig('smtp_password'));
@ -164,6 +165,8 @@ class Email implements \PHPCI\Plugin
return null;
case 'smtp_port':
return '25';
case 'smtp_encryption':
return null;
case 'from_address':
return "notifications-ci@phptesting.org";
default:

View file

@ -18,10 +18,16 @@ namespace PHPCI\Plugin;
class PhpMessDetector implements \PHPCI\Plugin
{
protected $directory;
/**
* Array of PHPMD rules. Possible values: codesize, unusedcode, naming, design, controversial
* @var array
*/
protected $rules;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
$this->rules = isset($options['rules']) ? (array)$options['rules'] : array('codesize', 'unusedcode', 'naming');
}
/**
@ -35,7 +41,7 @@ class PhpMessDetector implements \PHPCI\Plugin
$ignore = ' --exclude ' . implode(',', $this->phpci->ignore);
}
$cmd = PHPCI_BIN_DIR . 'phpmd "%s" text codesize,unusedcode,naming %s';
return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, $ignore);
$cmd = PHPCI_BIN_DIR . 'phpmd "%s" text %s %s';
return $this->phpci->executeCommand($cmd, $this->phpci->buildPath, implode(',', $this->rules), $ignore);
}
}

View file

@ -19,8 +19,10 @@
</ul>
</div>
<br>
<p class="alert alert-info">To automatically build this project when new commits are pushed, add the URL below
<?php if (in_array($project->getType(), array('github', 'bitbucket'))): ?>
<br>
<p class="alert alert-info">To automatically build this project when new commits are pushed, add the URL below
<?php endif; ?>
<?php
switch($project->getType())
@ -83,4 +85,4 @@ setInterval(function()
$('#latest-builds').load('<?= PHPCI_URL ?>project/builds/<?php print $project->getId(); ?>');
}, 10000);
</script>
<?php endif; ?>
<?php endif; ?>

View file

@ -3,14 +3,14 @@ PHPCI
PHPCI is a free and open source continuous integration tool specifically designed for PHP. We've built it with simplicity in mind, so whilst it doesn't do *everything* Jenkins can do, it is a breeze to set up and use.
_**Please be aware that this is a brand new project, in an alpha state, so there will be bugs and missing features.**_
_**Please be aware that PHPCI is a beta-release project, so whilst it is very stable, there may be bugs and/or missing features.**_
**Current Build Status**
![Build Status](http://phpci.block8.net/build-status/image/2)
##What it does:
* Clones your project from Github, Bitbucket or a local path (support for standard remote Git repositories coming soon.)
* 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 following plugins:
@ -28,7 +28,6 @@ _**Please be aware that this is a brand new project, in an alpha state, so there
* Multiple testing workers.
* Install PEAR or PECL extensions.
* Deployments.
* Success / Failure emails.
##Installing PHPCI:
####Pre-requisites: