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':
$reference = $this->build->getProject()->getReference();
$this->buildPath = $this->ciDir . 'build/' . $buildId;
// don't want no slash on the end
if(substr($reference, -1) == '/') {
$reference = substr($reference, 0, -1)
$reference = substr($reference, 0, -1);
}
if(is_link($this->buildPath) && is_file($this->buildPath)) {
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)) {
unlink($this->buildPath);
}
symlink($reference, $this->buildPath);
}
} else {
symlink($reference, $this->buildPath);
$this->executeCommand(
sprintf("cp -Rf %s %s/", $reference, $this->buildPath)
);
}
$this->buildPath .= '/';
break;
default:
mkdir($this->buildPath, 0777, true);

View file

@ -16,79 +16,61 @@ class ProjectBase extends Model
protected $_tableName = 'project';
protected $_modelName = 'Project';
protected $_data = array(
'id' => null,
'title' => null,
'reference' => null,
'git_key' => null,
'type' => null,
);
'id' => null,
'title' => null,
'reference' => null,
'git_key' => null,
'type' => null,
);
protected $_getters = array(
'id' => 'getId',
'title' => 'getTitle',
'reference' => 'getReference',
'git_key' => 'getGitKey',
'type' => 'getType',
);
'id' => 'getId',
'title' => 'getTitle',
'reference' => 'getReference',
'git_key' => 'getGitKey',
'type' => 'getType',
);
protected $_setters = array(
'id' => 'setId',
'title' => 'setTitle',
'reference' => 'setReference',
'git_key' => 'setGitKey',
'type' => 'setType',
'id' => 'setId',
'title' => 'setTitle',
'reference' => 'setReference',
'git_key' => 'setGitKey',
'type' => 'setType',
);
);
public $columns = array(
'id' => array(
'type' => 'int',
'length' => '11',
'id' => array(
'type' => 'int',
'length' => '11',
'primary_key' => true,
'auto_increment' => true,
'primary_key' => true,
'auto_increment' => true,
),
'title' => array(
'type' => 'varchar',
'length' => '250',
),
'title' => array(
'type' => 'varchar',
'length' => '250',
),
'reference' => array(
'type' => 'varchar',
'length' => '250',
),
'git_key' => array(
'type' => 'text',
'length' => '',
),
'type' => array(
'type' => 'varchar',
'length' => '50',
),
);
),
'reference' => array(
'type' => 'varchar',
'length' => '250',
),
'git_key' => array(
'type' => 'text',
'length' => '',
),
'type' => array(
'type' => 'varchar',
'length' => '50',
),
);
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
);
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
);
public $foreignKeys = array(
);
);
public function getId()
{