optional symlink defaulting to cp

This commit is contained in:
Gabriel Baker 2013-05-14 18:16:33 +01:00
parent 0bf1d9a813
commit 177a524475
2 changed files with 71 additions and 67 deletions

View file

@ -133,15 +133,37 @@ class Builder
case 'local': case 'local':
$reference = $this->build->getProject()->getReference(); $reference = $this->build->getProject()->getReference();
$this->buildPath = $this->ciDir . 'build/' . $buildId; $this->buildPath = $this->ciDir . 'build/' . $buildId;
// don't want no slash on the end // don't want no slash on the end
if(substr($reference, -1) == '/') { if(substr($reference, -1) == '/') {
$reference = substr($reference, 0, -1) $reference = substr($reference, 0, -1);
} }
if(!is_file($reference . '/phpci.yml'))
{
$this->logFailure('Project does not contain a phpci.yml file.');
return false;
}
$this->config = yaml_parse_file($reference . '/phpci.yml');
if ( array_key_exists('prebuild', $this->config)
&& is_array($this->config['prebuild'])
&& array_key_exists('preferSymlink', $this->config['prebuild'])
&& true === $this->config['prebuild']['preferSymlink'] ) {
if(is_link($this->buildPath) && is_file($this->buildPath)) { if(is_link($this->buildPath) && is_file($this->buildPath)) {
} else { unlink($this->buildPath);
}
symlink($reference, $this->buildPath); symlink($reference, $this->buildPath);
} }
$this->buildPath .= '/'; } else {
$this->executeCommand(
sprintf("cp -Rf %s %s/", $reference, $this->buildPath)
);
}
break; break;
default: default:
mkdir($this->buildPath, 0777, true); mkdir($this->buildPath, 0777, true);

View file

@ -28,8 +28,6 @@ class ProjectBase extends Model
'reference' => 'getReference', 'reference' => 'getReference',
'git_key' => 'getGitKey', 'git_key' => 'getGitKey',
'type' => 'getType', 'type' => 'getType',
); );
protected $_setters = array( protected $_setters = array(
@ -38,8 +36,8 @@ class ProjectBase extends Model
'reference' => 'setReference', 'reference' => 'setReference',
'git_key' => 'setGitKey', 'git_key' => 'setGitKey',
'type' => 'setType', 'type' => 'setType',
); );
public $columns = array( public $columns = array(
'id' => array( 'id' => array(
'type' => 'int', 'type' => 'int',
@ -52,44 +50,28 @@ class ProjectBase extends Model
'title' => array( 'title' => array(
'type' => 'varchar', 'type' => 'varchar',
'length' => '250', 'length' => '250',
), ),
'reference' => array( 'reference' => array(
'type' => 'varchar', 'type' => 'varchar',
'length' => '250', 'length' => '250',
), ),
'git_key' => array( 'git_key' => array(
'type' => 'text', 'type' => 'text',
'length' => '', 'length' => '',
), ),
'type' => array( 'type' => array(
'type' => 'varchar', 'type' => 'varchar',
'length' => '50', 'length' => '50',
), ),
); );
public $indexes = array( public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'), 'PRIMARY' => array('unique' => true, 'columns' => 'id'),
); );
public $foreignKeys = array( public $foreignKeys = array(
); );
public function getId() public function getId()
{ {
$rtn = $this->_data['id']; $rtn = $this->_data['id'];