コード例 #1
0
ファイル: PerlSyntax.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('apply');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task perl syntax.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('executable', 'perl');
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('failonerror', $this->getFailOnError() ? 'true' : 'false');
     }
     $xml->startElement('arg');
     $xml->writeAttribute('value', '-c');
     $xml->endElement();
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #2
0
ファイル: Delete.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('delete');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task delete.', __METHOD__);
         return false;
     }
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('failonerror', $this->getFailOnError() ? 'true' : 'false');
     }
     if ($this->getIncludeEmptyDirs()) {
         $xml->writeAttribute('includeemptydirs', $this->getIncludeEmptyDirs() ? 'true' : 'false');
     }
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #3
0
ファイル: Mkdir.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Dir not set for mkdir task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('mkdir');
     $xml->writeAttribute('dir', $this->getDir());
     $xml->endElement();
     return $xml->flush();
 }
コード例 #4
0
ファイル: Property.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('property');
     if (!$this->getName() || !$this->getValue()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Name and value not set for type property.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('name', $this->getName());
     $xml->writeAttribute('value', $this->getValue());
     $xml->endElement();
     return $xml->flush();
 }
コード例 #5
0
ファイル: Properties.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getText()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Empty properties text.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $properties = parse_ini_string($this->getText());
     foreach ($properties as $key => $value) {
         $xml->startElement('property');
         $xml->writeAttribute('name', $key);
         $xml->writeAttribute('value', $value);
         $xml->endElement();
     }
     return $xml->flush();
 }
コード例 #6
0
ファイル: Echo.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     if (!$this->getMessage()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Message not set for echo task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('echo');
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
         if ($this->getAppend() !== null) {
             $xml->writeAttribute('append', $this->getAppend() ? 'true' : 'false');
         }
     } else {
         $xml->text($this->getMessage());
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #7
0
ファイル: Fileset.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     $xml = new XmlDoc();
     $xml->startElement('fileset');
     if (!$this->getDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Root dir not set for type fileset.', __METHOD__);
         return false;
     }
     if ($this->getDir()) {
         $xml->writeAttribute('dir', $this->getDir());
     }
     if ($this->getDefaultExcludes() !== null) {
         $xml->writeAttribute('defaultexcludes', $this->getDefaultExcludes() ? 'yes' : 'no');
     }
     if ($this->getId()) {
         $xml->writeAttribute('id', $this->getId());
     }
     if ($this->getInclude()) {
         $includes = $this->getInclude();
         foreach ($includes as $include) {
             $xml->startElement('include');
             $xml->writeAttribute('name', $include);
             $xml->endElement();
         }
     }
     if ($this->getExclude()) {
         $excludes = $this->getExclude();
         foreach ($excludes as $exclude) {
             $xml->startElement('exclude');
             $xml->writeAttribute('name', $exclude);
             $xml->endElement();
         }
     }
     $xml->endElement();
     $ret = $xml->flush();
     $xml = null;
     unset($xml);
     return $ret;
 }
コード例 #8
0
ファイル: Chmod.php プロジェクト: rasismeiro/cintient
 public function toPhing()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('chmod');
     if (!$this->getFile() && !$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task chmod.', __METHOD__);
         return false;
     }
     $mode = $this->getMode();
     if (empty($mode) || !preg_match('/^\\d{3}$/', $mode)) {
         SystemEvent::raise(SystemEvent::ERROR, 'No mode set for task chmod.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('mode', $mode);
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #9
0
ファイル: Exec.php プロジェクト: rasismeiro/cintient
 public function toPhing()
 {
     if (!$this->isActive()) {
         return '';
     }
     if (!$this->getExecutable()) {
         SystemEvent::raise(SystemEvent::ERROR, 'Executable not set for exec task.', __METHOD__);
         return false;
     }
     $xml = new XmlDoc();
     $xml->startElement('exec');
     if ($this->getOutputProperty()) {
         $xml->writeAttribute('outputProperty', $this->getOutputProperty());
     }
     if ($this->getBaseDir()) {
         $xml->writeAttribute('dir', $this->getBaseDir());
     }
     $args = '';
     if ($this->getArgs()) {
         $args = ' ' . implode(' ', $this->getArgs());
     }
     $xml->writeAttribute('command', $this->getExecutable() . $args);
     $xml->endElement();
     return $xml->flush();
 }
コード例 #10
0
ファイル: Project.php プロジェクト: rasismeiro/cintient
 public function toPhing()
 {
     $xml = new XmlDoc();
     $xml->startElement('project');
     if (!$this->getTargets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No targets set for the project.', __METHOD__);
         return false;
     }
     if (!$this->getBaseDir()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No basedir set for the project.', __METHOD__);
         return false;
     }
     if ($this->getBaseDir() !== null) {
         $xml->writeAttribute('basedir', $this->getBaseDir());
     }
     if ($this->getDefaultTarget() !== null) {
         $xml->writeAttribute('default', $this->getDefaultTarget());
     }
     if ($this->getName() !== null) {
         $xml->writeAttribute('name', $this->getName());
     }
     if ($this->getProperties()) {
         $properties = $this->getProperties();
         foreach ($properties as $property) {
             $xml->writeRaw($property->toPhing());
         }
     }
     if ($this->getTargets()) {
         $targets = $this->getTargets();
         foreach ($targets as $target) {
             $xml->writeRaw($target->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #11
0
ファイル: PhpLint.php プロジェクト: rasismeiro/cintient
 public function toPhing()
 {
     if (!$this->isActive()) {
         return '';
     }
     $xml = new XmlDoc();
     $xml->startElement('phplint');
     if (!$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task php lint.', __METHOD__);
         return false;
     }
     if ($this->getFailOnError() !== null) {
         $xml->writeAttribute('haltonfailure', $this->getFailOnError() ? 'true' : 'false');
     }
     if ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #12
0
ファイル: Chown.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('chown');
     if (!$this->getFile() && !$this->getFilesets()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No files set for task chown.', __METHOD__);
         return false;
     }
     if (!$this->getUser()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No user set for task chown.', __METHOD__);
         return false;
     }
     $xml->writeAttribute('user', $this->getUser());
     if ($this->getFile()) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #13
0
ファイル: Target.php プロジェクト: rasismeiro/cintient
 public function toPhing()
 {
     $xml = new XmlDoc();
     $xml->startElement('target');
     if (!$this->getName()) {
         SystemEvent::raise(SystemEvent::ERROR, 'No name set for the target.', __METHOD__);
         return false;
     }
     if ($this->getName() !== null) {
         $xml->writeAttribute('name', $this->getName());
     }
     if ($this->getProperties()) {
         $properties = $this->getProperties();
         foreach ($properties as $property) {
             $xml->writeRaw($property->toPhing());
         }
     }
     if ($this->getDependencies()) {
         $dependencies = $this->getDependencies();
         $value = '';
         for ($i = 0; $i < count($dependencies); $i++) {
             if ($i > 0) {
                 $value .= ',';
             }
             $value .= $dependencies[$i];
         }
         $xml->writeAttribute('depends', $value);
     }
     if ($this->getTasks()) {
         $tasks = $this->getTasks();
         foreach ($tasks as $task) {
             $xml->writeRaw($task->toPhing());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }
コード例 #14
0
ファイル: ReplaceRegexp.php プロジェクト: rasismeiro/cintient
 public function toAnt()
 {
     if (!$this->isActive()) {
         return true;
     }
     $xml = new XmlDoc();
     $xml->startElement('replaceregexp');
     if (empty($this->_filesets) && empty($this->_file)) {
         SystemEvent::raise(SystemEvent::INFO, 'No files set for task replaceregexp.', __METHOD__);
         return false;
     }
     if (empty($this->_match)) {
         SystemEvent::raise(SystemEvent::INFO, 'Match attribute is mandatory for task replaceregexp.', __METHOD__);
         return false;
     }
     if (empty($this->_replace)) {
         SystemEvent::raise(SystemEvent::INFO, 'Replace attribute is mandatory for task replaceregexp.', __METHOD__);
         return false;
     }
     /*
         // TODO: Check Ant for existence of failonerror attribute
         if ($this->getFailOnError() !== null) {
           $xml->writeAttribute('failonerror', ($this->getFailOnError()?'true':'false'));
         }*/
     $xml->writeAttribute('match', $this->getMatch());
     $xml->writeAttribute('replace', $this->getReplace());
     if (!empty($this->_flags)) {
         $xml->writeAttribute('flags', $this->getFlags());
     }
     if (!empty($this->_file)) {
         $xml->writeAttribute('file', $this->getFile());
     } elseif ($this->getFilesets()) {
         $filesets = $this->getFilesets();
         foreach ($filesets as $fileset) {
             $xml->writeRaw($fileset->toAnt());
         }
     }
     $xml->endElement();
     return $xml->flush();
 }