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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }
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(); }