2013-05-03 17:02:53 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2013-05-16 03:16:56 +02:00
|
|
|
* PHPCI - Continuous Integration for PHP
|
|
|
|
*
|
|
|
|
* @copyright Copyright 2013, Block 8 Limited.
|
|
|
|
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
|
|
|
* @link http://www.phptesting.org/
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
|
|
|
|
namespace PHPCI\Model;
|
|
|
|
|
2013-10-10 02:01:06 +02:00
|
|
|
use b8\Store\Factory;
|
2013-05-16 16:40:40 +02:00
|
|
|
use PHPCI\Model\Base\BuildBase;
|
2013-05-03 17:02:53 +02:00
|
|
|
|
|
|
|
/**
|
2013-05-16 03:30:48 +02:00
|
|
|
* Build Model
|
2013-05-16 16:40:40 +02:00
|
|
|
* @uses PHPCI\Model\Base\BuildBase
|
2013-05-16 03:30:48 +02:00
|
|
|
* @author Dan Cryer <dan@block8.co.uk>
|
|
|
|
* @package PHPCI
|
|
|
|
* @subpackage Core
|
|
|
|
*/
|
2013-05-03 17:02:53 +02:00
|
|
|
class Build extends BuildBase
|
|
|
|
{
|
2013-10-10 02:01:06 +02:00
|
|
|
const STATUS_NEW = 0;
|
|
|
|
const STATUS_RUNNING = 1;
|
|
|
|
const STATUS_SUCCESS = 2;
|
|
|
|
const STATUS_FAILED = 3;
|
|
|
|
|
2014-02-25 11:16:58 +01:00
|
|
|
public $currentBuildPath = null;
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Get link to commit from another source (i.e. Github)
|
|
|
|
*/
|
2013-05-16 16:40:40 +02:00
|
|
|
public function getCommitLink()
|
|
|
|
{
|
|
|
|
return '#';
|
|
|
|
}
|
2013-05-10 13:28:43 +02:00
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
2014-02-25 23:36:20 +01:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getProjectTitle()
|
|
|
|
{
|
|
|
|
$project = $this->getProject();
|
|
|
|
return $project ? $project->getTitle() : "";
|
|
|
|
}
|
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Get link to branch from another source (i.e. Github)
|
|
|
|
*/
|
2013-05-16 16:40:40 +02:00
|
|
|
public function getBranchLink()
|
|
|
|
{
|
|
|
|
return '#';
|
|
|
|
}
|
2013-05-14 17:58:14 +02:00
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
|
|
|
* Send status updates to any relevant third parties (i.e. Github)
|
|
|
|
*/
|
2013-05-16 16:40:40 +02:00
|
|
|
public function sendStatusPostback()
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-05-14 18:49:39 +02:00
|
|
|
|
2013-05-16 18:17:29 +02:00
|
|
|
/**
|
2013-10-10 02:01:06 +02:00
|
|
|
* Store build metadata
|
|
|
|
*/
|
|
|
|
public function storeMeta($key, $value)
|
|
|
|
{
|
|
|
|
$value = json_encode($value);
|
|
|
|
Factory::getStore('Build')->setMeta($this->getProjectId(), $this->getId(), $key, $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this build successful?
|
|
|
|
*/
|
|
|
|
public function isSuccessful()
|
2013-05-16 16:40:40 +02:00
|
|
|
{
|
2013-10-10 02:01:06 +02:00
|
|
|
return ($this->getStatus() === self::STATUS_SUCCESS);
|
2013-05-16 16:40:40 +02:00
|
|
|
}
|
2013-05-03 17:02:53 +02:00
|
|
|
}
|