예제 #1
0
 protected function setupConfigProperties(BuildInterface $build)
 {
     $options = array('workingdir', 'projectdir', 'statusdir');
     foreach ($options as $option) {
         $build->setProperty($option, $this->config->get($option));
     }
 }
예제 #2
0
 /**
  * Return the label for this build.
  *
  * @param Xinc_Build_Interface $build
  *
  * @return string
  */
 public function getLabel(BuildInterface $build)
 {
     $buildNo = $build->getNumber();
     if ($buildNo == null) {
         $buildNo = $this->_firstBuild;
     }
     $buildLabel = $this->_prefix . $buildNo;
     $build->setProperty('build.label', $buildLabel);
     return $buildLabel;
 }
예제 #3
0
 /**
  * loads properties from a property file.
  * 
  * @param BuildInterface $build
  * @param string $fileName
  */
 public function parsePropertyFile(BuildInterface $build, $fileName)
 {
     $activeProperty = false;
     $trimNextLine = false;
     $arr = array();
     $fh = fopen($fileName, 'r');
     if (is_resource($fh)) {
         while ($line = fgets($fh)) {
             if (preg_match('/^[!#].*/', $line)) {
                 // comment
             } elseif (preg_match("/^.*?([\\._-\\w]+?)\\s*[=:]+\\s*(.*)\$/", $line, $matches)) {
                 // we have a key definition
                 $activeProperty = true;
                 $key = $matches[1];
                 $valuePart = $matches[2];
                 $arr[$key] = trim($valuePart);
                 if ($arr[$key][strlen($arr[$key]) - 1] == '\\') {
                     $arr[$key] = substr($arr[$key], 0, -1);
                     $trimNextLine = true;
                 } else {
                     $trimNextLine = false;
                 }
             } elseif ($activeProperty) {
                 $trimmed = trim($line);
                 if (empty($trimmed)) {
                     $activeProperty = false;
                     continue;
                 } elseif ($trimNextLine) {
                     $line = $trimmed;
                 } else {
                     $line = rtrim($line);
                 }
                 $arr[$key] .= "\n" . $line;
                 if ($arr[$key][strlen($arr[$key]) - 1] == '\\') {
                     $arr[$key] = substr($arr[$key], 0, -1);
                     $trimNextLine = true;
                 } else {
                     $trimNextLine = false;
                 }
             }
         }
         foreach ($arr as $key => $value) {
             $build->debug('Setting property "${' . $key . '}" to "' . $value . '"');
             $build->setProperty($key, stripcslashes($value));
         }
     } else {
         $build->error('Cannot read from property file: ' . $fileName);
     }
 }