Ticket #92: phing-inconsistent-newlines.diff
| File phing-inconsistent-newlines.diff, 114.0 KB (added by DougWarner <silfreed-phing@…>, 5 years ago) |
|---|
-
filters/util/IniFileTokenReader.php
diff -ru phing-orig/filters/util/IniFileTokenReader.php phing/filters/util/IniFileTokenReader.php
old new 48 48 /** 49 49 * Reads the next token from the INI file 50 50 * 51 * @throws IOException On error 51 * @throws IOException On error 52 52 * @return Token 53 53 */ 54 54 function readToken() { -
listener/AnsiColorLogger.php
diff -ru phing-orig/listener/AnsiColorLogger.php phing/listener/AnsiColorLogger.php
old new 197 197 } 198 198 199 199 /** 200 * @see DefaultLogger#printMessage 201 * @param string $message 202 * @param OutputStream $stream 200 * @see DefaultLogger#printMessage 201 * @param string $message 202 * @param OutputStream $stream 203 203 * @param int $priority 204 204 */ 205 205 protected final function printMessage($message, OutputStream $stream, $priority) { … … 226 226 case Project::MSG_DEBUG: 227 227 $message = $this->debugColor . $message . self::END_COLOR; 228 228 break; 229 } 230 229 } 230 231 231 $stream->write($message . $this->lSep); 232 232 } 233 233 } -
listener/DefaultLogger.php
diff -ru phing-orig/listener/DefaultLogger.php phing/listener/DefaultLogger.php
old new 60 60 * property <em>line.seperator</em>. 61 61 * @var string 62 62 */ 63 protected $lSep; 64 65 /** 66 * @var OutputStream Stream to use for standard output. 67 */ 68 protected $out; 69 70 /** 71 * @var OutputStream Stream to use for error output. 72 */ 63 protected $lSep; 64 65 /** 66 * @var OutputStream Stream to use for standard output. 67 */ 68 protected $out; 69 70 /** 71 * @var OutputStream Stream to use for error output. 72 */ 73 73 protected $err; 74 74 75 75 /** … … 98 98 * 99 99 * The default message level for DefaultLogger is Project::MSG_ERR. 100 100 * 101 * @param int $level The logging level for the logger. 101 * @param int $level The logging level for the logger. 102 102 * @see BuildLogger#setMessageOutputLevel() 103 103 */ 104 104 public function setMessageOutputLevel($level) { 105 105 $this->msgOutputLevel = (int) $level; 106 } 107 108 /** 109 * Sets the output stream. 110 * @param OutputStream $output 111 * @see BuildLogger#setOutputStream() 112 */ 113 public function setOutputStream(OutputStream $output) { 114 $this->out = $output; 115 } 116 117 /** 118 * Sets the error stream. 119 * @param OutputStream $err 120 * @see BuildLogger#setErrorStream() 121 */ 122 public function setErrorStream(OutputStream $err) { 123 $this->err = $err; 124 } 106 } 107 108 /** 109 * Sets the output stream. 110 * @param OutputStream $output 111 * @see BuildLogger#setOutputStream() 112 */ 113 public function setOutputStream(OutputStream $output) { 114 $this->out = $output; 115 } 116 117 /** 118 * Sets the error stream. 119 * @param OutputStream $err 120 * @see BuildLogger#setErrorStream() 121 */ 122 public function setErrorStream(OutputStream $err) { 123 $this->err = $err; 124 } 125 125 126 126 /** 127 127 * Sets the start-time when the build started. Used for calculating … … 156 156 $msg .= $error->getMessage(); 157 157 } 158 158 } 159 $msg .= $this->lSep . "Total time: " .self::formatTime(Phing::currentTimeMillis() - $this->startTime) . $this->lSep; 160 161 if ($error === null) { 162 $this->printMessage($msg, $this->out, Project::MSG_VERBOSE); 163 } else { 164 $this->printMessage($msg, $this->err, Project::MSG_ERR); 165 } 166 } 167 168 /** 169 * Get the message to return when a build failed. 170 * @return string The classic "BUILD FAILED" 171 */ 172 protected function getBuildFailedMessage() { 173 return "BUILD FAILED"; 174 } 175 176 /** 177 * Get the message to return when a build succeeded. 178 * @return string The classic "BUILD FINISHED" 179 */ 180 protected function getBuildSuccessfulMessage() { 181 return "BUILD FINISHED"; 182 } 159 $msg .= $this->lSep . "Total time: " .self::formatTime(Phing::currentTimeMillis() - $this->startTime) . $this->lSep; 160 161 if ($error === null) { 162 $this->printMessage($msg, $this->out, Project::MSG_VERBOSE); 163 } else { 164 $this->printMessage($msg, $this->err, Project::MSG_ERR); 165 } 166 } 167 168 /** 169 * Get the message to return when a build failed. 170 * @return string The classic "BUILD FAILED" 171 */ 172 protected function getBuildFailedMessage() { 173 return "BUILD FAILED"; 174 } 175 176 /** 177 * Get the message to return when a build succeeded. 178 * @return string The classic "BUILD FINISHED" 179 */ 180 protected function getBuildSuccessfulMessage() { 181 return "BUILD FINISHED"; 182 } 183 183 184 184 /** 185 185 * Prints the current target name … … 189 189 * @see BuildEvent::getTarget() 190 190 */ 191 191 public function targetStarted(BuildEvent $event) { 192 if (Project::MSG_INFO <= $this->msgOutputLevel) { 193 $msg = $this->lSep . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ':' . $this->lSep; 192 if (Project::MSG_INFO <= $this->msgOutputLevel) { 193 $msg = $this->lSep . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName() . ':' . $this->lSep; 194 194 $this->printMessage($msg, $this->out, $event->getPriority()); 195 195 } 196 196 } … … 231 231 * @access public 232 232 * @see BuildEvent::getMessage() 233 233 */ 234 public function messageLogged(BuildEvent $event) { 234 public function messageLogged(BuildEvent $event) { 235 235 $priority = $event->getPriority(); 236 236 if ($priority <= $this->msgOutputLevel) { 237 237 $msg = ""; … … 239 239 $name = $event->getTask(); 240 240 $name = $name->getTaskName(); 241 241 $msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT); 242 } 242 } 243 244 $msg .= $event->getMessage(); 243 245 244 $msg .= $event->getMessage(); 245 246 if ($priority != Project::MSG_ERR) { 247 $this->printMessage($msg, $this->out, $priority); 248 } else { 249 $this->printMessage($msg, $this->err, $priority); 246 if ($priority != Project::MSG_ERR) { 247 $this->printMessage($msg, $this->out, $priority); 248 } else { 249 $this->printMessage($msg, $this->err, $priority); 250 250 } 251 251 } 252 252 } … … 273 273 * Prints a message to console. 274 274 * 275 275 * @param string $message The message to print. 276 * Should not be <code>null</code>. 276 * Should not be <code>null</code>. 277 277 * @param resource $stream The stream to use for message printing. 278 278 * @param int $priority The priority of the message. 279 279 * (Ignored in this implementation.) 280 280 * @return void 281 281 */ 282 protected function printMessage($message, OutputStream $stream, $priority) { 282 protected function printMessage($message, OutputStream $stream, $priority) { 283 283 $stream->write($message . $this->lSep); 284 284 } 285 285 } -
listener/NoBannerLogger.php
diff -ru phing-orig/listener/NoBannerLogger.php phing/listener/NoBannerLogger.php
old new 42 42 $this->targetName = null; 43 43 } 44 44 45 function messageLogged(BuildEvent $event) { 45 function messageLogged(BuildEvent $event) { 46 46 47 47 if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim($event->getMessage() === "")) { 48 48 return; 49 } 49 } 50 50 51 if ($this->targetName !== null) { 52 $msg = $this->lSep . $event->getProject()->getName() . ' > ' . $this->targetName . ':' . $this->lSep; 51 if ($this->targetName !== null) { 52 $msg = $this->lSep . $event->getProject()->getName() . ' > ' . $this->targetName . ':' . $this->lSep; 53 53 $this->printMessage($msg, $this->out, $event->getPriority()); 54 54 $this->targetName = null; 55 55 } -
listener/PearLogListener.php
diff -ru phing-orig/listener/PearLogListener.php phing/listener/PearLogListener.php
old new 19 19 * <http://phing.info>. 20 20 */ 21 21 22 require_once 'phing/BuildListener.php'; 22 require_once 'phing/BuildListener.php'; 23 23 24 24 /** 25 25 * Writes build messages to PEAR Log. … … 68 68 * Whether logging has been configured. 69 69 * @var boolean 70 70 */ 71 protected $logConfigured = false; 72 73 /** 74 * @var Log PEAR Log object. 75 */ 76 protected $logger; 71 protected $logConfigured = false; 72 73 /** 74 * @var Log PEAR Log object. 75 */ 76 protected $logger; 77 77 78 78 /** 79 79 * Configure the logger. … … 89 89 if ($name === null) $name = 'phing.log'; 90 90 if ($ident === null) $ident = 'phing'; 91 91 if ($conf === null) $conf = array(); 92 93 include_once 'Log.php'; 94 if (!class_exists('Log')) { 95 throw new BuildException("Cannot find PEAR Log class for use by PearLogger."); 96 } 92 93 include_once 'Log.php'; 94 if (!class_exists('Log')) { 95 throw new BuildException("Cannot find PEAR Log class for use by PearLogger."); 96 } 97 97 98 98 $this->logger = Log::singleton($type, $name, $ident, $conf, self::$levelMap[$this->msgOutputLevel]); 99 99 } -
listener/XmlLogger.php
diff -ru phing-orig/listener/XmlLogger.php phing/listener/XmlLogger.php
old new 21 21 22 22 require_once 'phing/BuildLogger.php'; 23 23 require_once 'phing/listener/DefaultLogger.php'; 24 require_once 'phing/system/util/Timer.php'; 24 require_once 'phing/system/util/Timer.php'; 25 25 26 26 /** 27 27 * Generates a file in the current directory with … … 33 33 * @version $Id: XmlLogger.php 147 2007-02-06 20:32:22Z hans $ 34 34 * @package phing.listener 35 35 */ 36 class XmlLogger implements BuildLogger { 36 class XmlLogger implements BuildLogger { 37 37 38 38 /** XML element name for a build. */ 39 39 const BUILD_TAG = "build"; … … 55 55 const ERROR_ATTR = "error"; 56 56 /** XML element name for a stack trace. */ 57 57 const STACKTRACE_TAG = "stacktrace"; 58 59 /** 60 * @var DOMDocument The XML document created by this logger. 58 59 /** 60 * @var DOMDocument The XML document created by this logger. 61 61 */ 62 62 private $doc; 63 63 … … 66 66 private $taskStartTime = 0; 67 67 68 68 private $buildElement; 69 70 /** 71 * @var int 69 70 /** 71 * @var int 72 72 */ 73 73 private $msgOutputLevel = Project::MSG_DEBUG; 74 75 /** 76 * @var OutputStream Stream to use for standard output. 77 */ 78 private $out; 79 80 /** 81 * @var OutputStream Stream to use for error output. 82 */ 83 private $err; 74 75 /** 76 * @var OutputStream Stream to use for standard output. 77 */ 78 private $out; 79 80 /** 81 * @var OutputStream Stream to use for error output. 82 */ 83 private $err; 84 84 85 85 /** 86 86 * @var string Name of filename to create. … … 117 117 * @param BuildEvent $event An event with any relevant extra information. 118 118 * Will not be <code>null</code>. 119 119 */ 120 public function buildFinished(BuildEvent $event) { 120 public function buildFinished(BuildEvent $event) { 121 121 122 122 $this->buildTimer->stop(); 123 123 … … 134 134 $stacktrace->appendChild($errText); 135 135 $this->buildElement->appendChild($stacktrace); 136 136 } 137 138 $this->doc->appendChild($this->buildElement); 139 140 $outFilename = $event->getProject()->getProperty("XmlLogger.file"); 141 if ($outFilename == null) { 142 $outFilename = "log.xml"; 143 } 144 145 try { 146 $stream = $this->out; 147 if ($stream === null) { 148 $stream = new FileOutputStream($outFilename); 149 } 150 151 // Yes, we could just stream->write() but this will eventually be the better 152 // way to do this (when we need to worry about charset conversions. 153 $writer = new OutputStreamWriter($stream); 154 $writer->write($this->doc->saveXML()); 155 $writer->close(); 156 } catch (IOException $exc) { 157 try { 158 $stream->close(); // in case there is a stream open still ... 159 } catch (Exception $x) {} 160 throw new BuildException("Unable to write log file.", $exc); 161 } 162 } 163 137 138 $this->doc->appendChild($this->buildElement); 139 140 $outFilename = $event->getProject()->getProperty("XmlLogger.file"); 141 if ($outFilename == null) { 142 $outFilename = "log.xml"; 143 } 144 145 try { 146 $stream = $this->out; 147 if ($stream === null) { 148 $stream = new FileOutputStream($outFilename); 149 } 150 151 // Yes, we could just stream->write() but this will eventually be the better 152 // way to do this (when we need to worry about charset conversions. 153 $writer = new OutputStreamWriter($stream); 154 $writer->write($this->doc->saveXML()); 155 $writer->close(); 156 } catch (IOException $exc) { 157 try { 158 $stream->close(); // in case there is a stream open still ... 159 } catch (Exception $x) {} 160 throw new BuildException("Unable to write log file.", $exc); 161 } 162 } 163 164 164 165 165 /** 166 166 * Fired when a target starts building, remembers the current time and the name of the target. … … 188 188 $target = $event->getTarget(); 189 189 $elapsedTime = Phing::currentTimeMillis() - $this->targetTimerStart; 190 190 $this->targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); 191 $this->buildElement->appendChild($this->targetElement); 191 $this->buildElement->appendChild($this->targetElement); 192 192 $this->targetElement = null; 193 193 } 194 194 … … 204 204 $this->taskElement = $this->doc->createElement(XmlLogger::TASK_TAG); 205 205 $this->taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName()); 206 206 $this->taskElement->setAttribute(XmlLogger::LOCATION_ATTR, $task->getLocation()->toString()); 207 } 207 } 208 208 209 209 /** 210 210 * Fired when a task finishes building, this adds the time taken … … 217 217 $task = $event->getTask(); 218 218 $elapsedTime = Phing::currentTimeMillis() - $this->taskTimerStart; 219 219 $this->taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); 220 if ($this->targetElement) { // not all tasks are in targets 221 $this->targetElement->appendChild($this->taskElement); 222 } else { 223 $this->buildElement->appendChild($this->taskElement); 224 } 220 if ($this->targetElement) { // not all tasks are in targets 221 $this->targetElement->appendChild($this->taskElement); 222 } else { 223 $this->buildElement->appendChild($this->taskElement); 224 } 225 225 $this->taskElement = null; 226 226 } 227 227 … … 272 272 $this->buildElement->appendChild($messageElement); 273 273 } 274 274 } 275 276 /** 277 * Set the msgOutputLevel this logger is to respond to. 278 * 279 * Only messages with a message level lower than or equal to the given 280 * level are output to the log. 281 * 282 * <p> Constants for the message levels are in Project.php. The order of 283 * the levels, from least to most verbose, is: 284 * 285 * <ul> 286 * <li>Project::MSG_ERR</li> 287 * <li>Project::MSG_WARN</li> 288 * <li>Project::MSG_INFO</li> 289 * <li>Project::MSG_VERBOSE</li> 290 * <li>Project::MSG_DEBUG</li> 291 * </ul> 292 * 293 * The default message level for DefaultLogger is Project::MSG_ERR. 294 * 295 * @param int $level The logging level for the logger. 296 * @see BuildLogger#setMessageOutputLevel() 297 */ 298 public function setMessageOutputLevel($level) { 299 $this->msgOutputLevel = (int) $level; 300 } 301 302 /** 303 * Sets the output stream. 304 * @param OutputStream $output 305 * @see BuildLogger#setOutputStream() 306 */ 307 public function setOutputStream(OutputStream $output) { 308 $this->out = $output; 309 } 310 311 /** 312 * Sets the error stream. 313 * @param OutputStream $err 314 * @see BuildLogger#setErrorStream() 315 */ 316 public function setErrorStream(OutputStream $err) { 317 $this->err = $err; 318 } 275 276 /** 277 * Set the msgOutputLevel this logger is to respond to. 278 * 279 * Only messages with a message level lower than or equal to the given 280 * level are output to the log. 281 * 282 * <p> Constants for the message levels are in Project.php. The order of 283 * the levels, from least to most verbose, is: 284 * 285 * <ul> 286 * <li>Project::MSG_ERR</li> 287 * <li>Project::MSG_WARN</li> 288 * <li>Project::MSG_INFO</li> 289 * <li>Project::MSG_VERBOSE</li> 290 * <li>Project::MSG_DEBUG</li> 291 * </ul> 292 * 293 * The default message level for DefaultLogger is Project::MSG_ERR. 294 * 295 * @param int $level The logging level for the logger. 296 * @see BuildLogger#setMessageOutputLevel() 297 */ 298 public function setMessageOutputLevel($level) { 299 $this->msgOutputLevel = (int) $level; 300 } 301 302 /** 303 * Sets the output stream. 304 * @param OutputStream $output 305 * @see BuildLogger#setOutputStream() 306 */ 307 public function setOutputStream(OutputStream $output) { 308 $this->out = $output; 309 } 310 311 /** 312 * Sets the error stream. 313 * @param OutputStream $err 314 * @see BuildLogger#setErrorStream() 315 */ 316 public function setErrorStream(OutputStream $err) { 317 $this->err = $err; 318 } 319 319 320 320 } -
system/io/BufferedReader.php
diff -ru phing-orig/system/io/BufferedReader.php phing/system/io/BufferedReader.php
old new 53 53 } 54 54 55 55 /** 56 * Reads and returns a chunk of data. 56 * Reads and returns a chunk of data. 57 57 * @param int $len Number of bytes to read. Default is to read configured buffer size number of bytes. 58 58 * @return mixed buffer or -1 if EOF. 59 59 */ 60 60 function read($len = null) { 61 62 // if $len is specified, we'll use that; otherwise, use the configured buffer size. 61 62 // if $len is specified, we'll use that; otherwise, use the configured buffer size. 63 63 if ($len === null) $len = $this->bufferSize; 64 64 65 65 if ( ($data = $this->in->read($len)) !== -1 ) { -
system/io/BufferedWriter.php
diff -ru phing-orig/system/io/BufferedWriter.php phing/system/io/BufferedWriter.php
old new 55 55 56 56 public function getResource() { 57 57 return $this->out->getResource(); 58 }59 60 public function flush() {61 $this->out->flush();62 58 } 63 64 /** 65 * Close attached stream. 59 60 public function flush() { 61 $this->out->flush(); 62 } 63 64 /** 65 * Close attached stream. 66 66 */ 67 67 public function close() { 68 68 return $this->out->close(); -
system/io/FileInputStream.php
diff -ru phing-orig/system/io/FileInputStream.php phing/system/io/FileInputStream.php
old new 18 18 * and is licensed under the LGPL. For more information please see 19 19 * <http://phing.info>. 20 20 */ 21 22 require_once 'phing/system/io/InputStream.php'; 23 require_once 'phing/system/io/PhingFile.php'; 21 22 require_once 'phing/system/io/InputStream.php'; 23 require_once 'phing/system/io/PhingFile.php'; 24 24 25 25 /** 26 * Input stream subclass for file streams. 26 * Input stream subclass for file streams. 27 27 * 28 28 * @package phing.system.io 29 29 */ 30 30 class FileInputStream extends InputStream { 31 32 /** 33 * @var PhingFile The associated file. 34 */ 35 protected $file; 31 32 /** 33 * @var PhingFile The associated file. 34 */ 35 protected $file; 36 36 37 37 /** 38 38 * Construct a new FileInputStream. 39 * @param mixed $file 40 * @throws Exception - if invalid argument specified. 39 * @param mixed $file 40 * @throws Exception - if invalid argument specified. 41 41 * @throws IOException - if unable to open file. 42 42 */ 43 public function __construct($file, $append = false) { 44 if ($file instanceof PhingFile) { 45 $this->file = $file; 46 } elseif (is_string($file)) { 47 $this->file = new PhingFile($file); 48 } else { 49 throw new Exception("Invalid argument type for \$file."); 50 } 51 52 $stream = @fopen($this->file->getAbsolutePath(), "rb"); 53 if ($stream === false) { 54 throw new IOException("Unable to open " . $this->file->__toString() . " for reading: " . $php_errormsg); 55 } 56 43 public function __construct($file, $append = false) { 44 if ($file instanceof PhingFile) { 45 $this->file = $file; 46 } elseif (is_string($file)) { 47 $this->file = new PhingFile($file); 48 } else { 49 throw new Exception("Invalid argument type for \$file."); 50 } 51 52 $stream = @fopen($this->file->getAbsolutePath(), "rb"); 53 if ($stream === false) { 54 throw new IOException("Unable to open " . $this->file->__toString() . " for reading: " . $php_errormsg); 55 } 56 57 57 parent::__construct($stream); 58 58 } 59 60 /** 61 * Returns a string representation of the attached file. 62 * @return string 59 60 /** 61 * Returns a string representation of the attached file. 62 * @return string 63 63 */ 64 64 public function __toString() { 65 65 return $this->file->getPath(); 66 } 67 68 /** 69 * Mark is supported by FileInputStream. 70 * @return boolean TRUE 71 */ 72 public function markSupported() { 73 return true; 66 } 67 68 /** 69 * Mark is supported by FileInputStream. 70 * @return boolean TRUE 71 */ 72 public function markSupported() { 73 return true; 74 74 } 75 75 } 76 76 -
system/io/FileOutputStream.php
diff -ru phing-orig/system/io/FileOutputStream.php phing/system/io/FileOutputStream.php
old new 18 18 * and is licensed under the LGPL. For more information please see 19 19 * <http://phing.info>. 20 20 */ 21 22 require_once 'phing/system/io/OutputStream.php'; 23 require_once 'phing/system/io/PhingFile.php'; 21 22 require_once 'phing/system/io/OutputStream.php'; 23 require_once 'phing/system/io/PhingFile.php'; 24 24 25 25 /** 26 * Output stream subclass for file streams. 26 * Output stream subclass for file streams. 27 27 * 28 28 * @package phing.system.io 29 29 */ 30 30 class FileOutputStream extends OutputStream { 31 32 /** 33 * @var PhingFile The associated file. 34 */ 35 protected $file; 31 32 /** 33 * @var PhingFile The associated file. 34 */ 35 protected $file; 36 36 37 37 /** 38 38 * Construct a new FileOutputStream. 39 * @param mixed $file 40 * @param boolean $append Whether to append bytes to end of file rather than beginning. 41 * @throws Exception - if invalid argument specified. 39 * @param mixed $file 40 * @param boolean $append Whether to append bytes to end of file rather than beginning. 41 * @throws Exception - if invalid argument specified. 42 42 * @throws IOException - if unable to open file. 43 43 */ 44 public function __construct($file, $append = false) { 45 if ($file instanceof PhingFile) { 46 $this->file = $file; 47 } elseif (is_string($file)) { 48 $this->file = new PhingFile($file); 49 } else { 50 throw new Exception("Invalid argument type for \$file."); 51 } 52 if ($append) { 53 $stream = @fopen($this->file->getAbsolutePath(), "ab"); 54 } else { 55 $stream = @fopen($this->file->getAbsolutePath(), "wb"); 56 } 57 if ($stream === false) { 58 throw new IOException("Unable to open " . $this->file->__toString() . " for writing: " . $php_errormsg); 59 } 44 public function __construct($file, $append = false) { 45 if ($file instanceof PhingFile) { 46 $this->file = $file; 47 } elseif (is_string($file)) { 48 $this->file = new PhingFile($file); 49 } else { 50 throw new Exception("Invalid argument type for \$file."); 51 } 52 if ($append) { 53 $stream = @fopen($this->file->getAbsolutePath(), "ab"); 54 } else { 55 $stream = @fopen($this->file->getAbsolutePath(), "wb"); 56 } 57 if ($stream === false) { 58 throw new IOException("Unable to open " . $this->file->__toString() . " for writing: " . $php_errormsg); 59 } 60 60 parent::__construct($stream); 61 61 } 62 63 /** 64 * Returns a string representation of the attached file. 65 * @return string 62 63 /** 64 * Returns a string representation of the attached file. 65 * @return string 66 66 */ 67 67 public function __toString() { 68 68 return $this->file->getPath(); -
system/io/FileReader.php
diff -ru phing-orig/system/io/FileReader.php phing/system/io/FileReader.php
old new 20 20 */ 21 21 22 22 require_once 'phing/system/io/InputStreamReader.php'; 23 require_once 'phing/system/io/FileInputStream.php'; 23 require_once 'phing/system/io/FileInputStream.php'; 24 24 25 25 /** 26 26 * Convenience class for reading files. … … 28 28 */ 29 29 class FileReader extends InputStreamReader { 30 30 31 /** 32 * Construct a new FileReader. 33 * @param mixed $file PhingFile or string pathname. 34 */ 35 public function __construct($file) { 36 $in = new FileInputStream($file); 37 parent::__construct($in); 38 } 39 31 /** 32 * Construct a new FileReader. 33 * @param mixed $file PhingFile or string pathname. 34 */ 35 public function __construct($file) { 36 $in = new FileInputStream($file); 37 parent::__construct($in); 38 } 39 40 40 } 41 41 -
system/io/FileSystem.php
diff -ru phing-orig/system/io/FileSystem.php phing/system/io/FileSystem.php
old new 51 51 52 52 /** 53 53 * Static method to return the FileSystem singelton representing 54 * this platform's local filesystem driver. 54 * this platform's local filesystem driver. 55 55 * @return FileSystem 56 56 */ 57 57 public static function getFileSystem() { -
system/io/FileWriter.php
diff -ru phing-orig/system/io/FileWriter.php phing/system/io/FileWriter.php
old new 20 20 */ 21 21 22 22 require_once 'phing/system/io/OutputStreamWriter.php'; 23 require_once 'phing/system/io/FileOutputStream.php'; 23 require_once 'phing/system/io/FileOutputStream.php'; 24 24 25 25 /** 26 26 * Convenience class for performing file write operations. … … 34 34 * @param mixed $file PhingFile or string pathname. 35 35 * @param boolean $append Append to existing file? 36 36 */ 37 function __construct($file, $append = false) { 38 $out = new FileOutputStream($file, $append); 37 function __construct($file, $append = false) { 38 $out = new FileOutputStream($file, $append); 39 39 parent::__construct($out); 40 40 } 41 41 } -
system/io/FilterReader.php
diff -ru phing-orig/system/io/FilterReader.php phing/system/io/FilterReader.php
old new 26 26 * @package phing.system.io 27 27 */ 28 28 class FilterReader extends Reader { 29 30 /** 31 * @var Reader 29 30 /** 31 * @var Reader 32 32 */ 33 33 protected $in; 34 34 … … 59 59 60 60 public function close() { 61 61 return $this->in->close(); 62 } 62 } 63 63 64 64 function getResource() { 65 65 return $this->in->getResource(); -
system/io/InputStream.php
diff -ru phing-orig/system/io/InputStream.php phing/system/io/InputStream.php
old new 20 20 */ 21 21 22 22 /** 23 * Wrapper class for PHP stream that supports read operations. 23 * Wrapper class for PHP stream that supports read operations. 24 24 * 25 25 * @package phing.system.io 26 26 */ 27 27 class InputStream { 28 29 /** 30 * @var resource The attached PHP stream. 31 */ 32 protected $stream; 33 34 /** 35 * @var int Position of stream cursor. 28 29 /** 30 * @var resource The attached PHP stream. 36 31 */ 37 protected $currentPosition = 0; 38 39 /** 40 * @var int Marked position of stream cursor. 32 protected $stream; 33 34 /** 35 * @var int Position of stream cursor. 36 */ 37 protected $currentPosition = 0; 38 39 /** 40 * @var int Marked position of stream cursor. 41 41 */ 42 42 protected $mark = 0; 43 44 /** 45 * Construct a new InputStream. 46 * @param resource $stream Configured PHP stream for writing. 47 */ 48 public function __construct($stream) { 49 if (!is_resource($stream)) { 50 throw new IOException("Passed argument is not a valid stream."); 51 } 52 $this->stream = $stream; 53 } 54 55 /** 56 * Skip over $n bytes. 57 * @param int $n 43 44 /** 45 * Construct a new InputStream. 46 * @param resource $stream Configured PHP stream for writing. 47 */ 48 public function __construct($stream) { 49 if (!is_resource($stream)) { 50 throw new IOException("Passed argument is not a valid stream."); 51 } 52 $this->stream = $stream; 53 } 54 55 /** 56 * Skip over $n bytes. 57 * @param int $n 58 58 */ 59 59 public function skip($n) { 60 60 $start = $this->currentPosition; … … 78 78 * @param int $len Num chars to read. If not specified this stream will read until EOF. 79 79 * @return string chars read or -1 if eof. 80 80 */ 81 public function read($len = null) { 81 public function read($len = null) { 82 82 83 83 if ($this->eof()) { 84 84 return -1; 85 } 86 87 if ($len === null) { // we want to keep reading until we get an eof 88 $out = ""; 89 while(!$this->eof()) { 90 $out .= fread($this->stream, 8192); 91 $this->currentPosition = ftell($this->stream); 92 } 93 } else { 94 $out = fread($this->stream, $len); // adding 1 seems to ensure that next call to read() will return EOF (-1) 95 $this->currentPosition = ftell($this->stream); 85 } 86 87 if ($len === null) { // we want to keep reading until we get an eof 88 $out = ""; 89 while(!$this->eof()) { 90 $out .= fread($this->stream, 8192); 91 $this->currentPosition = ftell($this->stream); 92 } 93 } else { 94 $out = fread($this->stream, $len); // adding 1 seems to ensure that next call to read() will return EOF (-1) 95 $this->currentPosition = ftell($this->stream); 96 96 } 97 97 98 98 return $out; 99 99 } 100 101 /** 102 * Marks the current position in this input stream. 103 * @throws IOException - if the underlying stream doesn't support this method. 104 */ 105 public function mark() { 106 if (!$this->markSupported()) { 107 throw new IOException(get_class($this) . " does not support mark() and reset() methods."); 100 101 /** 102 * Marks the current position in this input stream. 103 * @throws IOException - if the underlying stream doesn't support this method. 104 */ 105 public function mark() { 106 if (!$this->markSupported()) { 107 throw new IOException(get_class($this) . " does not support mark() and reset() methods."); 108 108 } 109 109 $this->mark = $this->currentPosition; 110 } 111 112 /** 113 * Whether the input stream supports mark and reset methods. 114 * @return boolean 115 */ 116 public function markSupported() { 117 return false; 118 } 119 120 /** 121 * Repositions this stream to the position at the time the mark method was last called on this input stream. 122 * @throws IOException - if the underlying stream doesn't support this method. 123 */ 124 function reset() { 125 if (!$this->markSupported()) { 126 throw new IOException(get_class($this) . " does not support mark() and reset() methods."); 110 } 111 112 /** 113 * Whether the input stream supports mark and reset methods. 114 * @return boolean 115 */ 116 public function markSupported() { 117 return false; 118 } 119 120 /** 121 * Repositions this stream to the position at the time the mark method was last called on this input stream. 122 * @throws IOException - if the underlying stream doesn't support this method. 123 */ 124 function reset() { 125 if (!$this->markSupported()) { 126 throw new IOException(get_class($this) . " does not support mark() and reset() methods."); 127 127 } 128 128 // goes back to last mark, by default this would be 0 (i.e. rewind file). 129 129 fseek($this->stream, SEEK_SET, $this->mark); 130 130 $this->mark = 0; 131 131 } 132 133 /** 134 * Closes stream. 135 * @throws IOException if stream cannot be closed (note that calling close() on an already-closed stream will not raise an exception) 132 133 /** 134 * Closes stream. 135 * @throws IOException if stream cannot be closed (note that calling close() on an already-closed stream will not raise an exception) 136 136 */ 137 137 public function close() { 138 138 if ($this->stream === null) { … … 144 144 throw new IOException($msg); 145 145 } 146 146 $this->stream = null; 147 } 147 } 148 148 149 149 /** 150 150 * Whether eof has been reached with stream. … … 159 159 * 160 160 * @param string &$rBuffer String variable where read contents will be put. 161 161 * @return TRUE on success. 162 * @author Charlie Killian, charlie@tizac.com 163 * @throws IOException - if there is an error reading from stream. 162 * @author Charlie Killian, charlie@tizac.com 163 * @throws IOException - if there is an error reading from stream. 164 164 * @deprecated - Instead, use the read() method or a BufferedReader. 165 165 */ 166 166 public function readInto(&$rBuffer) { 167 $rBuffer = $this->read(); 167 $rBuffer = $this->read(); 168 168 $this->close(); 169 169 } 170 170 -
system/io/InputStreamReader.php
diff -ru phing-orig/system/io/InputStreamReader.php phing/system/io/InputStreamReader.php
old new 23 23 include_once 'phing/system/io/Reader.php'; 24 24 25 25 /** 26 * Writer class for OutputStream objects. 27 * 28 * Unlike the Java counterpart, this class does not (yet) handle 29 * character set transformations. This will be an important function 30 * of this class with move to supporting PHP6. 26 * Writer class for OutputStream objects. 27 * 28 * Unlike the Java counterpart, this class does not (yet) handle 29 * character set transformations. This will be an important function 30 * of this class with move to supporting PHP6. 31 31 * * @package phing.system.io 32 32 */ 33 33 class InputStreamReader extends Reader { 34 35 /**36 * @var InputStream37 */38 protected $inStream;39 34 40 /** 41 * Construct a new InputStreamReader. 42 * @param InputStream $$inStream InputStream to read from 43 */ 44 public function __construct(InputStream $inStream) { 45 $this->inStream = $inStream; 46 } 47 48 /** 49 * Close the stream. 50 */ 51 public function close() { 52 return $this->inStream->close(); 53 } 54 55 /** 56 * Skip over $n bytes. 57 * @param int $n 35 /** 36 * @var InputStream 37 */ 38 protected $inStream; 39 40 /** 41 * Construct a new InputStreamReader. 42 * @param InputStream $$inStream InputStream to read from 43 */ 44 public function __construct(InputStream $inStream) { 45 $this->inStream = $inStream; 46 } 47 48 /** 49 * Close the stream. 50 */ 51 public function close() { 52 return $this->inStream->close(); 53 } 54 55 /** 56 * Skip over $n bytes. 57 * @param int $n 58 58 */ 59 public function skip($n) { 59 public function skip($n) { 60 60 return $this->inStream->skip($n); 61 61 } 62 62 … … 65 65 * @param int $len Num chars to read. 66 66 * @return string chars read or -1 if eof. 67 67 */ 68 public function read($len = null) { 68 public function read($len = null) { 69 69 return $this->inStream->read($len); 70 70 } 71 72 /** 73 * Marks the current position in this input stream. 74 * @throws IOException - if the underlying stream doesn't support this method. 71 72 /** 73 * Marks the current position in this input stream. 74 * @throws IOException - if the underlying stream doesn't support this method. 75 75 */ 76 76 public function mark() { 77 77 $this->inStream->mark(); 78 } 79 80 /** 81 * Whether the attached stream supports mark/reset. 82 * @return boolean 83 */ 84 public function markSupported() { 85 return $this->inStream->markSupported(); 86 } 78 } 87 79 88 /** 89 * Repositions this stream to the position at the time the mark method was last called on this input stream. 90 * @throws IOException - if the underlying stream doesn't support this method. 80 /** 81 * Whether the attached stream supports mark/reset. 82 * @return boolean 83 */ 84 public function markSupported() { 85 return $this->inStream->markSupported(); 86 } 87 88 /** 89 * Repositions this stream to the position at the time the mark method was last called on this input stream. 90 * @throws IOException - if the underlying stream doesn't support this method. 91 91 */ 92 92 public function reset() { 93 93 $this->inStream->reset(); … … 109 109 * @param object &$rBuffer Reference. Variable of where to put contents. 110 110 * 111 111 * @return TRUE on success. Err object on failure. 112 * @author Charlie Killian, charlie@tizac.com 112 * @author Charlie Killian, charlie@tizac.com 113 113 * @deprecated Use read() or BufferedReader instead. 114 114 */ 115 115 public function readInto(&$rBuffer) { -
system/io/OutputStream.php
diff -ru phing-orig/system/io/OutputStream.php phing/system/io/OutputStream.php
old new 20 20 */ 21 21 22 22 /** 23 * Wrapper class for PHP stream that supports write operations. 23 * Wrapper class for PHP stream that supports write operations. 24 24 * 25 25 * @package phing.system.io 26 26 */ 27 27 class OutputStream { 28 29 /** 30 * @var resource The configured PHP stream. 28 29 /** 30 * @var resource The configured PHP stream. 31 31 */ 32 32 protected $stream; 33 33 … … 35 35 * Construct a new OutputStream. 36 36 * @param resource $stream Configured PHP stream for writing. 37 37 */ 38 public function __construct($stream) { 39 if (!is_resource($stream)) { 40 throw new IOException("Passed argument is not a valid stream."); 41 } 38 public function __construct($stream) { 39 if (!is_resource($stream)) { 40 throw new IOException("Passed argument is not a valid stream."); 41 } 42 42 $this->stream = $stream; 43 43 } 44 45 /** 46 * Closes attached stream, flushing output first. 47 * @throws IOException if cannot close stream (note that attempting to close an already closed stream will not raise an IOException) 48 * @return void 44 45 /** 46 * Closes attached stream, flushing output first. 47 * @throws IOException if cannot close stream (note that attempting to close an already closed stream will not raise an IOException) 48 * @return void 49 49 */ 50 public function close() { 51 if ($this->stream === null) { 52 return; 53 } 54 $this->flush(); 55 if (false === @fclose($this->stream)) { 56 $msg = "Cannot close " . $this->getResource() . ": $php_errormsg"; 57 throw new IOException($msg); 58 } 50 public function close() { 51 if ($this->stream === null) { 52 return; 53 } 54 $this->flush(); 55 if (false === @fclose($this->stream)) { 56 $msg = "Cannot close " . $this->getResource() . ": $php_errormsg"; 57 throw new IOException($msg); 58 } 59 59 $this->stream = null; 60 60 } 61 62 /** 63 * Flushes stream. 64 * 65 * @throws IOException if unable to flush data (e.g. stream is not open). 66 */ 67 public function flush() { 68 if (false === @fflush($this->stream)) { 69 throw new IOException("Could not flush stream: " . $php_errormsg); 70 } 61 62 /** 63 * Flushes stream. 64 * 65 * @throws IOException if unable to flush data (e.g. stream is not open). 66 */ 67 public function flush() { 68 if (false === @fflush($this->stream)) { 69 throw new IOException("Could not flush stream: " . $php_errormsg); 70 } 71 71 } 72 73 /** 74 * Writes data to stream. 75 * 76 * @param string $buf Binary/character data to write. 77 * @param int $off (Optional) offset. 78 * @param int $len (Optional) number of bytes/chars to write. 79 * @return void 80 * @throws IOException - if there is an error writing to stream 72 73 /** 74 * Writes data to stream. 75 * 76 * @param string $buf Binary/character data to write. 77 * @param int $off (Optional) offset. 78 * @param int $len (Optional) number of bytes/chars to write. 79 * @return void 80 * @throws IOException - if there is an error writing to stream 81 81 */ 82 82 public function write($buf, $off = null, $len = null) { 83 83 if ( $off === null && $len === null ) { 84 $to_write = $buf; 85 } elseif ($off !== null && $len === null) { 84 $to_write = $buf; 85 } elseif ($off !== null && $len === null) { 86 86 $to_write = substr($buf, $off); 87 87 } elseif ($off === null && $len !== null) { 88 $to_write = substr($buf, 0, $len); 89 } else { 90 $to_write = substr($buf, $off, $len); 91 } 88 $to_write = substr($buf, 0, $len); 89 } else { 90 $to_write = substr($buf, $off, $len); 91 } 92 92 93 93 $result = @fwrite($this->stream, $to_write); 94 94 … … 96 96 throw new IOException("Error writing to stream."); 97 97 } 98 98 } 99 100 /** 101 * Returns a string representation of the attached PHP stream. 102 * @return string 99 100 /** 101 * Returns a string representation of the attached PHP stream. 102 * @return string 103 103 */ 104 104 public function __toString() { 105 105 return (string) $this->stream; -
system/io/OutputStreamWriter.php
diff -ru phing-orig/system/io/OutputStreamWriter.php phing/system/io/OutputStreamWriter.php
old new 23 23 require_once 'phing/system/io/Writer.php'; 24 24 25 25 /** 26 * Writer class for OutputStream objects. 27 * 28 * Unlike the Java counterpart, this class does not (yet) handle 29 * character set transformations. This will be an important function 26 * Writer class for OutputStream objects. 27 * 28 * Unlike the Java counterpart, this class does not (yet) handle 29 * character set transformations. This will be an important function 30 30 * of this class with move to supporting PHP6. 31 31 * 32 32 * @package phing.system.io 33 33 */ 34 34 class OutputStreamWriter extends Writer { 35 36 /** 37 * @var OutputStream 35 36 /** 37 * @var OutputStream 38 38 */ 39 39 protected $outStream; 40 40 … … 45 45 public function __construct(OutputStream $outStream) { 46 46 $this->outStream = $outStream; 47 47 } 48 49 /** 50 * Close the stream. 48 49 /** 50 * Close the stream. 51 51 */ 52 public function close() { 52 public function close() { 53 53 return $this->outStream->close(); 54 54 } 55 56 /** 57 * Write char data to stream. 58 * 59 * @param unknown_type $buf 60 * @param unknown_type $off 61 * @param unknown_type $len 62 * @return unknown 55 56 /** 57 * Write char data to stream. 58 * 59 * @param unknown_type $buf 60 * @param unknown_type $off 61 * @param unknown_type $len 62 * @return unknown 63 63 */ 64 public function write($buf, $off = null, $len = null) { 64 public function write($buf, $off = null, $len = null) { 65 65 return $this->outStream->write($buf, $off, $len); 66 }67 68 /**69 * Flush output to the stream.70 */71 public function flush() {72 $this->outStream->flush();73 66 } 74 75 /** 76 * Gets a string representation of attached stream resource. 77 * 78 * @return string String representation of output stream 67 68 /** 69 * Flush output to the stream. 70 */ 71 public function flush() { 72 $this->outStream->flush(); 73 } 74 75 /** 76 * Gets a string representation of attached stream resource. 77 * 78 * @return string String representation of output stream 79 79 */ 80 public function getResource() { 80 public function getResource() { 81 81 return $this->outStream->__toString(); 82 82 } 83 83 } -
system/io/Reader.php
diff -ru phing-orig/system/io/Reader.php phing/system/io/Reader.php
old new 20 20 */ 21 21 22 22 /** 23 * Abstract class for reading character streams. 23 * Abstract class for reading character streams. 24 24 * 25 25 * @author Hans Lellelid <hans@xmpl.org> 26 26 * @author Yannick Lecaillez <yl@seasonfive.com> … … 30 30 abstract class Reader { 31 31 32 32 /** 33 * Read data from source. 33 * Read data from source. 34 34 * 35 35 * If length is specified, then only that number of chars is read, 36 * otherwise stream is read until EOF. 36 * otherwise stream is read until EOF. 37 37 * 38 38 * @param int $len 39 39 */ 40 40 abstract public function read($len = null); 41 41 42 42 /** 43 * Close stream. 43 * Close stream. 44 44 * @throws IOException if there is an error closing stream 45 45 */ 46 46 abstract public function close(); … … 75 75 * Whether marking is supported. 76 76 * @return boolean 77 77 */ 78 public function markSupported() { 79 return false; 78 public function markSupported() { 79 return false; 80 80 } 81 81 82 82 /** 83 83 * Is stream ready for reading. 84 84 * @return boolean 85 85 */ 86 public function ready() { 87 return true; 86 public function ready() { 87 return true; 88 88 } 89 89 90 90 } -
system/io/StringReader.php
diff -ru phing-orig/system/io/StringReader.php phing/system/io/StringReader.php
old new 24 24 * @package phing.system.io 25 25 */ 26 26 class StringReader extends Reader { 27 28 /** 29 * @var string 27 28 /** 29 * @var string 30 30 */ 31 private $_string; 32 33 /** 34 * @var int 31 private $_string; 32 33 /** 34 * @var int 35 35 */ 36 private $mark = 0; 37 38 /** 39 * @var int 36 private $mark = 0; 37 38 /** 39 * @var int 40 40 */ 41 41 private $currPos = 0; 42 42 -
system/io/Writer.php
diff -ru phing-orig/system/io/Writer.php phing/system/io/Writer.php
old new 20 20 */ 21 21 22 22 /** 23 * Abstract class for writing character streams. 23 * Abstract class for writing character streams. 24 24 * 25 25 * @package phing.system.io 26 26 */ 27 27 abstract class Writer { 28 29 /** 30 * Writes data to output stream. 31 * @param string $buf 32 * @param int $off 33 * @param int $len 28 29 /** 30 * Writes data to output stream. 31 * @param string $buf 32 * @param int $off 33 * @param int $len 34 34 */ 35 35 abstract public function write($buf, $off = null, $len = null); 36 37 /** 38 * Close the stream. 39 * @throws IOException - if there is an error closing stream. 36 37 /** 38 * Close the stream. 39 * @throws IOException - if there is an error closing stream. 40 40 */ 41 41 abstract public function close(); 42 43 /** 44 * Flush the stream, if supported by the stream. 45 */ 42 43 /** 44 * Flush the stream, if supported by the stream. 45 */ 46 46 public function flush() {} 47 47 48 48 /** -
tasks/ext/ioncube/IoncubeComment.php
diff -ru phing-orig/tasks/ext/ioncube/IoncubeComment.php phing/tasks/ext/ioncube/IoncubeComment.php
old new 1 <?php 2 /** 3 * $Id: IoncubeComment.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 /** 23 * Wrapper for comments for ionCube tasks 24 * 25 * @author Michiel Rook <michiel.rook@gmail.com> 26 * @version $Id: IoncubeComment.php 81 2006-07-06 13:07:29Z mrook $ 27 * @package phing.tasks.ext.ioncube 28 * @since 2.2.0 29 */ 30 class IoncubeComment 31 { 32 private $value = ""; 33 34 public function getValue() 35 { 36 return $this->value; 37 } 38 39 public function addText($txt) 40 { 41 $this->value = trim($txt); 42 } 43 } 1 <?php 2 /** 3 * $Id: IoncubeComment.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 /** 23 * Wrapper for comments for ionCube tasks 24 * 25 * @author Michiel Rook <michiel.rook@gmail.com> 26 * @version $Id: IoncubeComment.php 81 2006-07-06 13:07:29Z mrook $ 27 * @package phing.tasks.ext.ioncube 28 * @since 2.2.0 29 */ 30 class IoncubeComment 31 { 32 private $value = ""; 33 34 public function getValue() 35 { 36 return $this->value; 37 } 38 39 public function addText($txt) 40 { 41 $this->value = trim($txt); 42 } 43 } 44 44 ?> 45 No newline at end of file -
tasks/ext/ScpSendTask.php
diff -ru phing-orig/tasks/ext/ScpSendTask.php phing/tasks/ext/ScpSendTask.php
old new 1 <?php 2 /** 3 * $Id: ScpSendTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 24 /** 25 * SCPs a File to a remote server 26 * 27 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 28 * @version $Id: ScpSendTask.php 123 2006-09-14 20:19:08Z mrook $ 29 * @package phing.tasks.ext 30 * @since 2.3.0 31 */ 32 class ScpSendTask extends Task 33 { 34 private $localFile = ""; 35 36 private $remoteFile = ""; 37 38 private $username = ""; 39 40 private $password = ""; 41 42 private $host = ""; 43 44 private $port = 22; 45 46 private $mode = null; 47 48 private $_connection = null; 49 50 /** 51 * Sets the remote host 52 */ 53 function setHost($h) 54 { 55 $this->host = $h; 56 } 57 58 /** 59 * Returns the remote host 60 */ 61 function getHost() 62 { 63 return $this->host; 64 } 65 66 /** 67 * Sets the remote host port 68 */ 69 function setPort($p) 70 { 71 $this->port = $p; 72 } 73 74 /** 75 * Returns the remote host port 76 */ 77 function getPort() 78 { 79 return $this->port; 80 } 81 82 /** 83 * Sets the mode value 84 */ 85 function setMode($value) 86 { 87 $this->mode = $value; 88 } 89 90 /** 91 * Returns the mode value 92 */ 93 function getMode() 94 { 95 return $this->mode; 96 } 97 98 /** 99 * Sets the username of the user to scp 100 */ 101 function setUsername($username) 102 { 103 $this->username = $username; 104 } 105 106 /** 107 * Returns the username 108 */ 109 function getUsername() 110 { 111 return $this->username; 112 } 113 114 /** 115 * Sets the password of the user to scp 116 */ 117 function setPassword($password) 118 { 119 $this->password = $password; 120 } 121 122 /** 123 * Returns the password 124 */ 125 function getPassword() 126 { 127 return $this->password; 128 } 129 130 /** 131 * Sets the local path to scp from 132 */ 133 function setLocalFile($lFile) 134 { 135 $this->localFile = $lFile; 136 } 137 138 /** 139 * Returns the local path to scp from 140 */ 141 function getLocalFile($lFile) 142 { 143 return $this->localFile; 144 } 145 146 /** 147 * Sets the remote path to scp to 148 */ 149 function setRemoteFile($rFile) 150 { 151 $this->remoteFile = $rFile; 152 } 153 154 /** 155 * Returns the remote path to scp to 156 */ 157 function getRemoteFile($rFile) 158 { 159 return $this->remoteFile; 160 } 161 162 /** 163 * The init method: Do init steps. 164 */ 165 public function init() 166 { 167 if (function_exists('ssh2_connect')) { 168 $this->_connection = ssh2_connect($this->host, $this->port); 169 ssh2_auth_password($this->_connection, $this->username, $this->password); 170 } else { 171 print ("ERROR: SSH Extension is not installed"); 172 } 173 } 174 175 /** 176 * The main entry point method. 177 */ 178 public function main() 179 { 180 if (function_exists('ssh2_scp_send') && !is_null($this->_connection)) 181 { 182 if (!is_null($this->mode)) { 183 ssh2_scp_send($this->_connection, $this->localFile, $this->remoteFile, $this->mode); 184 } else { 185 ssh2_scp_send($this->_connection, $this->localFile, $this->remoteFile); 186 } 187 } else { 188 print ("ERROR: No SSH Connection Available"); 189 } 190 } 191 } 192 ?> 1 <?php 2 /** 3 * $Id: ScpSendTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 24 /** 25 * SCPs a File to a remote server 26 * 27 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 28 * @version $Id: ScpSendTask.php 123 2006-09-14 20:19:08Z mrook $ 29 * @package phing.tasks.ext 30 * @since 2.3.0 31 */ 32 class ScpSendTask extends Task 33 { 34 private $localFile = ""; 35 36 private $remoteFile = ""; 37 38 private $username = ""; 39 40 private $password = ""; 41 42 private $host = ""; 43 44 private $port = 22; 45 46 private $mode = null; 47 48 private $_connection = null; 49 50 /** 51 * Sets the remote host 52 */ 53 function setHost($h) 54 { 55 $this->host = $h; 56 } 57 58 /** 59 * Returns the remote host 60 */ 61 function getHost() 62 { 63 return $this->host; 64 } 65 66 /** 67 * Sets the remote host port 68 */ 69 function setPort($p) 70 { 71 $this->port = $p; 72 } 73 74 /** 75 * Returns the remote host port 76 */ 77 function getPort() 78 { 79 return $this->port; 80 } 81 82 /** 83 * Sets the mode value 84 */ 85 function setMode($value) 86 { 87 $this->mode = $value; 88 } 89 90 /** 91 * Returns the mode value 92 */ 93 function getMode() 94 { 95 return $this->mode; 96 } 97 98 /** 99 * Sets the username of the user to scp 100 */ 101 function setUsername($username) 102 { 103 $this->username = $username; 104 } 105 106 /** 107 * Returns the username 108 */ 109 function getUsername() 110 { 111 return $this->username; 112 } 113 114 /** 115 * Sets the password of the user to scp 116 */ 117 function setPassword($password) 118 { 119 $this->password = $password; 120 } 121 122 /** 123 * Returns the password 124 */ 125 function getPassword() 126 { 127 return $this->password; 128 } 129 130 /** 131 * Sets the local path to scp from 132 */ 133 function setLocalFile($lFile) 134 { 135 $this->localFile = $lFile; 136 } 137 138 /** 139 * Returns the local path to scp from 140 */ 141 function getLocalFile($lFile) 142 { 143 return $this->localFile; 144 } 145 146 /** 147 * Sets the remote path to scp to 148 */ 149 function setRemoteFile($rFile) 150 { 151 $this->remoteFile = $rFile; 152 } 153 154 /** 155 * Returns the remote path to scp to 156 */ 157 function getRemoteFile($rFile) 158 { 159 return $this->remoteFile; 160 } 161 162 /** 163 * The init method: Do init steps. 164 */ 165 public function init() 166 { 167 if (function_exists('ssh2_connect')) { 168 $this->_connection = ssh2_connect($this->host, $this->port); 169 ssh2_auth_password($this->_connection, $this->username, $this->password); 170 } else { 171 print ("ERROR: SSH Extension is not installed"); 172 } 173 } 174 175 /** 176 * The main entry point method. 177 */ 178 public function main() 179 { 180 if (function_exists('ssh2_scp_send') && !is_null($this->_connection)) 181 { 182 if (!is_null($this->mode)) { 183 ssh2_scp_send($this->_connection, $this->localFile, $this->remoteFile, $this->mode); 184 } else { 185 ssh2_scp_send($this->_connection, $this->localFile, $this->remoteFile); 186 } 187 } else { 188 print ("ERROR: No SSH Connection Available"); 189 } 190 } 191 } 192 ?> -
tasks/ext/simpletest/SimpleTestCountResultFormatter.php
diff -ru phing-orig/tasks/ext/simpletest/SimpleTestCountResultFormatter.php phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.php
old new 1 <?php 2 /** 3 * $Id: SimpleTestCountResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Dummy result formatter used to count SimpleTest results 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestCountResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestCountResultFormatter extends SimpleTestResultFormatter 33 { 34 const SUCCESS = 0; 35 const FAILURES = 1; 36 const ERRORS = 2; 37 38 function getRetCode() 39 { 40 if ($this->getExceptionCount() != 0) 41 { 42 return self::ERRORS; 43 } 44 else if ($this->getFailCount() != 0) 45 { 46 return self::FAILURES; 47 } 48 49 return self::SUCCESS; 50 } 51 } 1 <?php 2 /** 3 * $Id: SimpleTestCountResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Dummy result formatter used to count SimpleTest results 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestCountResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestCountResultFormatter extends SimpleTestResultFormatter 33 { 34 const SUCCESS = 0; 35 const FAILURES = 1; 36 const ERRORS = 2; 37 38 function getRetCode() 39 { 40 if ($this->getExceptionCount() != 0) 41 { 42 return self::ERRORS; 43 } 44 else if ($this->getFailCount() != 0) 45 { 46 return self::FAILURES; 47 } 48 49 return self::SUCCESS; 50 } 51 } 52 52 ?> 53 No newline at end of file -
tasks/ext/simpletest/SimpleTestFormatterElement.php
diff -ru phing-orig/tasks/ext/simpletest/SimpleTestFormatterElement.php phing/tasks/ext/simpletest/SimpleTestFormatterElement.php
old new 1 <?php 2 /** 3 * $Id: SimpleTestFormatterElement.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php'; 23 require_once 'phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php'; 24 require_once 'phing/tasks/ext/phpunit2/FormatterElement.php'; 25 26 /** 27 * Child class of "FormatterElement", overrides setType to provide other 28 * formatter classes for SimpleTest 29 * 30 * @author Michiel Rook <michiel.rook@gmail.com> 31 * @version $Id: SimpleTestFormatterElement.php 81 2006-07-06 13:07:29Z mrook $ 32 * @package phing.tasks.ext.simpletest 33 * @since 2.2.0 34 */ 35 class SimpleTestFormatterElement extends FormatterElement 36 { 37 function setType($type) 38 { 39 $this->type = $type; 40 41 if ($this->type == "xml") 42 { 43 $destFile = new PhingFile($this->toDir, 'testsuites.xml'); 44 //$this->formatter = new SimpleTestXmlResultFormatter(); 45 } 46 else 47 if ($this->type == "plain") 48 { 49 $this->formatter = new SimpleTestPlainResultFormatter(); 50 } 51 else 52 if ($this->type == "summary") 53 { 54 $this->formatter = new SimpleTestSummaryResultFormatter(); 55 } 56 else 57 { 58 throw new BuildException("Formatter '" . $this->type . "' not implemented"); 59 } 60 } 61 } 1 <?php 2 /** 3 * $Id: SimpleTestFormatterElement.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php'; 23 require_once 'phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php'; 24 require_once 'phing/tasks/ext/phpunit2/FormatterElement.php'; 25 26 /** 27 * Child class of "FormatterElement", overrides setType to provide other 28 * formatter classes for SimpleTest 29 * 30 * @author Michiel Rook <michiel.rook@gmail.com> 31 * @version $Id: SimpleTestFormatterElement.php 81 2006-07-06 13:07:29Z mrook $ 32 * @package phing.tasks.ext.simpletest 33 * @since 2.2.0 34 */ 35 class SimpleTestFormatterElement extends FormatterElement 36 { 37 function setType($type) 38 { 39 $this->type = $type; 40 41 if ($this->type == "xml") 42 { 43 $destFile = new PhingFile($this->toDir, 'testsuites.xml'); 44 //$this->formatter = new SimpleTestXmlResultFormatter(); 45 } 46 else 47 if ($this->type == "plain") 48 { 49 $this->formatter = new SimpleTestPlainResultFormatter(); 50 } 51 else 52 if ($this->type == "summary") 53 { 54 $this->formatter = new SimpleTestSummaryResultFormatter(); 55 } 56 else 57 { 58 throw new BuildException("Formatter '" . $this->type . "' not implemented"); 59 } 60 } 61 } 62 62 ?> 63 No newline at end of file -
tasks/ext/simpletest/SimpleTestPlainResultFormatter.php
diff -ru phing-orig/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.php
old new 1 <?php 2 /** 3 * $Id: SimpleTestPlainResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Prints plain text output of the test to a specified Writer. 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestPlainResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestPlainResultFormatter extends SimpleTestResultFormatter 33 { 34 private $inner = ""; 35 36 function getExtension() 37 { 38 return ".txt"; 39 } 40 41 function getPreferredOutfile() 42 { 43 return "testresults"; 44 } 45 46 function paintCaseStart($test_name) 47 { 48 parent::paintCaseStart($test_name); 49 50 $this->inner = ""; 51 } 52 53 function paintCaseEnd($test_name) 54 { 55 parent::paintCaseEnd($test_name); 56 57 /* Only count suites where more than one test was run */ 58 if ($this->getRunCount()) 59 { 60 $sb.= "Testsuite: $test_name\n"; 61 $sb.= "Tests run: " . $this->getRunCount(); 62 $sb.= ", Failures: " . $this->getFailureCount(); 63 $sb.= ", Errors: " . $this->getErrorCount(); 64 $sb.= ", Time elapsed: " . $this->getElapsedTime(); 65 $sb.= " sec\n"; 66 67 if ($this->out != NULL) 68 { 69 $this->out->write($sb); 70 $this->out->write($this->inner); 71 } 72 } 73 } 74 75 function paintError($message) 76 { 77 parent::paintError($message); 78 79 $this->formatError("ERROR", $message); 80 } 81 82 function paintFail($message) 83 { 84 parent::paintFail($message); 85 86 $this->formatError("FAILED", $message); 87 } 88 89 private function formatError($type, $message) 90 { 91 $this->inner.= $this->getTestName() . " " . $type . "\n"; 92 $this->inner.= $message . "\n"; 93 } 94 } 1 <?php 2 /** 3 * $Id: SimpleTestPlainResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Prints plain text output of the test to a specified Writer. 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestPlainResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestPlainResultFormatter extends SimpleTestResultFormatter 33 { 34 private $inner = ""; 35 36 function getExtension() 37 { 38 return ".txt"; 39 } 40 41 function getPreferredOutfile() 42 { 43 return "testresults"; 44 } 45 46 function paintCaseStart($test_name) 47 { 48 parent::paintCaseStart($test_name); 49 50 $this->inner = ""; 51 } 52 53 function paintCaseEnd($test_name) 54 { 55 parent::paintCaseEnd($test_name); 56 57 /* Only count suites where more than one test was run */ 58 if ($this->getRunCount()) 59 { 60 $sb.= "Testsuite: $test_name\n"; 61 $sb.= "Tests run: " . $this->getRunCount(); 62 $sb.= ", Failures: " . $this->getFailureCount(); 63 $sb.= ", Errors: " . $this->getErrorCount(); 64 $sb.= ", Time elapsed: " . $this->getElapsedTime(); 65 $sb.= " sec\n"; 66 67 if ($this->out != NULL) 68 { 69 $this->out->write($sb); 70 $this->out->write($this->inner); 71 } 72 } 73 } 74 75 function paintError($message) 76 { 77 parent::paintError($message); 78 79 $this->formatError("ERROR", $message); 80 } 81 82 function paintFail($message) 83 { 84 parent::paintFail($message); 85 86 $this->formatError("FAILED", $message); 87 } 88 89 private function formatError($type, $message) 90 { 91 $this->inner.= $this->getTestName() . " " . $type . "\n"; 92 $this->inner.= $message . "\n"; 93 } 94 } 95 95 ?> 96 No newline at end of file -
tasks/ext/simpletest/SimpleTestResultFormatter.php
diff -ru phing-orig/tasks/ext/simpletest/SimpleTestResultFormatter.php phing/tasks/ext/simpletest/SimpleTestResultFormatter.php
old new 1 <?php 2 /** 3 * $Id: SimpleTestResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'simpletest/scorer.php'; 23 24 require_once 'phing/system/io/Writer.php'; 25 26 /** 27 * This abstract class describes classes that format the results of a SimpleTest testrun. 28 * 29 * @author Michiel Rook <michiel.rook@gmail.com> 30 * @version $Id: SimpleTestResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 31 * @package phing.tasks.ext.phpunit2 32 * @since 2.2.0 33 */ 34 abstract class SimpleTestResultFormatter extends SimpleReporter 35 { 36 protected $out = NULL; 37 38 protected $project = NULL; 39 40 private $timer = NULL; 41 42 private $runCount = 0; 43 44 private $failureCount = 0; 45 46 private $errorCount = 0; 47 48 private $currentTest = ""; 49 50 /** 51 * Sets the writer the formatter is supposed to write its results to. 52 */ 53 function setOutput(Writer $out) 54 { 55 $this->out = $out; 56 } 57 58 /** 59 * Returns the extension used for this formatter 60 * 61 * @return string the extension 62 */ 63 function getExtension() 64 { 65 return ""; 66 } 67 68 /** 69 * Sets the project 70 * 71 * @param Project the project 72 */ 73 function setProject(Project $project) 74 { 75 $this->project = $project; 76 } 77 78 function getPreferredOutfile() 79 { 80 return ""; 81 } 82 83 function paintMethodStart($test_name) 84 { 85 parent::paintMethodStart($test_name); 86 87 $this->currentTest = $test_name; 88 } 89 90 function paintMethodEnd($test_name) 91 { 92 parent::paintMethodEnd($test_name); 93 94 $this->runCount++; 95 } 96 97 function paintCaseStart($test_name) 98 { 99 parent::paintCaseStart($test_name); 100 101 $this->runCount = 0; 102 $this->failureCount = 0; 103 $this->errorCount = 0; 104 105 $this->timer = new Timer(); 106 $this->timer->start(); 107 } 108 109 function paintCaseEnd($test_name) 110 { 111 parent::paintCaseEnd($test_name); 112 113 $this->timer->stop(); 114 } 115 116 function paintError($message) 117 { 118 parent::paintError($message); 119 120 $this->errorCount++; 121 } 122 123 function paintFail($message) 124 { 125 parent::paintFail($message); 126 127 $this->failureCount++; 128 } 129 130 function getRunCount() 131 { 132 return $this->runCount; 133 } 134 135 function getFailureCount() 136 { 137 return $this->failureCount; 138 } 139 140 function getErrorCount() 141 { 142 return $this->errorCount; 143 } 144 145 function getTestName() 146 { 147 return $this->currentTest; 148 } 149 150 function getElapsedTime() 151 { 152 if ($this->timer) 153 { 154 return $this->timer->getElapsedTime(); 155 } 156 else 157 { 158 return 0; 159 } 160 } 161 } 1 <?php 2 /** 3 * $Id: SimpleTestResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'simpletest/scorer.php'; 23 24 require_once 'phing/system/io/Writer.php'; 25 26 /** 27 * This abstract class describes classes that format the results of a SimpleTest testrun. 28 * 29 * @author Michiel Rook <michiel.rook@gmail.com> 30 * @version $Id: SimpleTestResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 31 * @package phing.tasks.ext.phpunit2 32 * @since 2.2.0 33 */ 34 abstract class SimpleTestResultFormatter extends SimpleReporter 35 { 36 protected $out = NULL; 37 38 protected $project = NULL; 39 40 private $timer = NULL; 41 42 private $runCount = 0; 43 44 private $failureCount = 0; 45 46 private $errorCount = 0; 47 48 private $currentTest = ""; 49 50 /** 51 * Sets the writer the formatter is supposed to write its results to. 52 */ 53 function setOutput(Writer $out) 54 { 55 $this->out = $out; 56 } 57 58 /** 59 * Returns the extension used for this formatter 60 * 61 * @return string the extension 62 */ 63 function getExtension() 64 { 65 return ""; 66 } 67 68 /** 69 * Sets the project 70 * 71 * @param Project the project 72 */ 73 function setProject(Project $project) 74 { 75 $this->project = $project; 76 } 77 78 function getPreferredOutfile() 79 { 80 return ""; 81 } 82 83 function paintMethodStart($test_name) 84 { 85 parent::paintMethodStart($test_name); 86 87 $this->currentTest = $test_name; 88 } 89 90 function paintMethodEnd($test_name) 91 { 92 parent::paintMethodEnd($test_name); 93 94 $this->runCount++; 95 } 96 97 function paintCaseStart($test_name) 98 { 99 parent::paintCaseStart($test_name); 100 101 $this->runCount = 0; 102 $this->failureCount = 0; 103 $this->errorCount = 0; 104 105 $this->timer = new Timer(); 106 $this->timer->start(); 107 } 108 109 function paintCaseEnd($test_name) 110 { 111 parent::paintCaseEnd($test_name); 112 113 $this->timer->stop(); 114 } 115 116 function paintError($message) 117 { 118 parent::paintError($message); 119 120 $this->errorCount++; 121 } 122 123 function paintFail($message) 124 { 125 parent::paintFail($message); 126 127 $this->failureCount++; 128 } 129 130 function getRunCount() 131 { 132 return $this->runCount; 133 } 134 135 function getFailureCount() 136 { 137 return $this->failureCount; 138 } 139 140 function getErrorCount() 141 { 142 return $this->errorCount; 143 } 144 145 function getTestName() 146 { 147 return $this->currentTest; 148 } 149 150 function getElapsedTime() 151 { 152 if ($this->timer) 153 { 154 return $this->timer->getElapsedTime(); 155 } 156 else 157 { 158 return 0; 159 } 160 } 161 } 162 162 ?> 163 No newline at end of file -
tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php
diff -ru phing-orig/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.php
old new 1 <?php 2 /** 3 * $Id: SimpleTestSummaryResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Prints short summary output of the test to Phing's logging system. 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestSummaryResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestSummaryResultFormatter extends SimpleTestResultFormatter 33 { 34 function paintCaseEnd($test_name) 35 { 36 parent::paintCaseEnd($test_name); 37 38 /* Only count suites where more than one test was run */ 39 if ($this->getRunCount()) 40 { 41 $sb.= "Tests run: " . $this->getRunCount(); 42 $sb.= ", Failures: " . $this->getFailureCount(); 43 $sb.= ", Errors: " . $this->getErrorCount(); 44 $sb.= ", Time elapsed: " . $this->getElapsedTime(); 45 $sb.= " sec\n"; 46 47 if ($this->out != NULL) 48 { 49 $this->out->write($sb); 50 } 51 } 52 } 53 } 1 <?php 2 /** 3 * $Id: SimpleTestSummaryResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/tasks/ext/simpletest/SimpleTestResultFormatter.php'; 23 24 /** 25 * Prints short summary output of the test to Phing's logging system. 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @version $Id: SimpleTestSummaryResultFormatter.php 81 2006-07-06 13:07:29Z mrook $ 29 * @package phing.tasks.ext.simpletest 30 * @since 2.2.0 31 */ 32 class SimpleTestSummaryResultFormatter extends SimpleTestResultFormatter 33 { 34 function paintCaseEnd($test_name) 35 { 36 parent::paintCaseEnd($test_name); 37 38 /* Only count suites where more than one test was run */ 39 if ($this->getRunCount()) 40 { 41 $sb.= "Tests run: " . $this->getRunCount(); 42 $sb.= ", Failures: " . $this->getFailureCount(); 43 $sb.= ", Errors: " . $this->getErrorCount(); 44 $sb.= ", Time elapsed: " . $this->getElapsedTime(); 45 $sb.= " sec\n"; 46 47 if ($this->out != NULL) 48 { 49 $this->out->write($sb); 50 } 51 } 52 } 53 } 54 54 ?> 55 No newline at end of file -
tasks/ext/svn/SvnBaseTask.php
diff -ru phing-orig/tasks/ext/svn/SvnBaseTask.php phing/tasks/ext/svn/SvnBaseTask.php
old new 1 <?php 2 /* 3 * $Id: SvnBaseTask.php 119 2006-09-14 20:02:22Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 include_once 'phing/Task.php'; 23 24 /** 25 * Base class for Subversion tasks 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnBaseTask.php 119 2006-09-14 20:02:22Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @see VersionControl_SVN 32 * @since 2.2.0 33 */ 34 abstract class SvnBaseTask extends Task 35 { 36 private $workingCopy = ""; 37 38 private $repositoryUrl = ""; 39 40 private $svnPath = "/usr/bin/svn"; 41 42 private $svn = NULL; 43 44 private $mode = ""; 45 46 private $svnArgs = array(); 47 48 private $svnSwitches = array(); 49 50 private $toDir = ""; 51 52 /** 53 * Initialize Task. 54 * This method includes any necessary SVN libraries and triggers 55 * appropriate error if they cannot be found. This is not done in header 56 * because we may want this class to be loaded w/o triggering an error. 57 */ 58 function init() { 59 include_once 'VersionControl/SVN.php'; 60 if (!class_exists('VersionControl_SVN')) { 61 throw new Exception("SvnLastRevisionTask depends on PEAR VersionControl_SVN package being installed."); 62 } 63 } 64 65 /** 66 * Sets the path to the workingcopy 67 */ 68 function setWorkingCopy($workingCopy) 69 { 70 $this->workingCopy = $workingCopy; 71 } 72 73 /** 74 * Returns the path to the workingcopy 75 */ 76 function getWorkingCopy() 77 { 78 return $this->workingCopy; 79 } 80 81 /** 82 * Sets the path/URI to the repository 83 */ 84 function setRepositoryUrl($repositoryUrl) 85 { 86 $this->repositoryUrl = $repositoryUrl; 87 } 88 89 /** 90 * Returns the path/URI to the repository 91 */ 92 function getRepositoryUrl() 93 { 94 return $this->repositoryUrl; 95 } 96 97 /** 98 * Sets the path to the SVN executable 99 */ 100 function setSvnPath($svnPath) 101 { 102 $this->svnPath = $svnPath; 103 } 104 105 /** 106 * Returns the path to the SVN executable 107 */ 108 function getSvnPath() 109 { 110 return $this->svnPath; 111 } 112 113 // 114 // Args 115 // 116 117 /** 118 * Sets the path to export/checkout to 119 */ 120 function setToDir($toDir) 121 { 122 $this->toDir = $toDir; 123 } 124 125 /** 126 * Returns the path to export/checkout to 127 */ 128 function getToDir() 129 { 130 return $this->toDir; 131 } 132 133 // 134 // Switches 135 // 136 137 /** 138 * Sets the force switch 139 */ 140 function setForce($value) 141 { 142 $this->svnSwitches['force'] = $value; 143 } 144 145 /** 146 * Returns the forec switch 147 */ 148 function getForce() 149 { 150 return isset( $this->svnSwitches['force'] ) ? $this->svnSwitches['force'] : ''; 151 } 152 153 /** 154 * Sets the username of the user to export 155 */ 156 function setUsername($value) 157 { 158 $this->svnSwitches['username'] = $value; 159 } 160 161 /** 162 * Returns the username 163 */ 164 function getUsername() 165 { 166 return isset( $this->svnSwitches['username'] ) ? $this->svnSwitches['username'] : ''; 167 } 168 169 /** 170 * Sets the password of the user to export 171 */ 172 function setPassword($value) 173 { 174 $this->svnSwitches['password'] = $value; 175 } 176 177 /** 178 * Returns the password 179 */ 180 function getPassword() 181 { 182 return isset( $this->svnSwitches['password'] ) ? $this->svnSwitches['password'] : ''; 183 } 184 185 /** 186 * Sets the password of the user to export 187 */ 188 function setNoCache($value) 189 { 190 $this->svnSwitches['no-auth-cache'] = $value; 191 } 192 193 /** 194 * Returns the password 195 */ 196 function getNoCache() 197 { 198 return isset( $this->svnSwitches['no-auth-cache'] ) ? $this->svnSwitches['no-auth-cache'] : ''; 199 } 200 201 /** 202 * Creates a VersionControl_SVN class based on $mode 203 * 204 * @param string The SVN mode to use (info, export, checkout, ...) 205 * @throws BuildException 206 */ 207 protected function setup($mode) 208 { 209 $this->mode = $mode; 210 211 // Set up runtime options. Will be passed to all 212 // subclasses. 213 $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC, 'svn_path' => $this->getSvnPath()); 214 215 // Pass array of subcommands we need to factory 216 $this->svn = VersionControl_SVN::factory($mode, $options); 217 218 if (!empty($this->repositoryUrl)) 219 { 220 $this->svnArgs = array($this->repositoryUrl); 221 } 222 else 223 if (!empty($this->workingCopy)) 224 { 225 if (is_dir($this->workingCopy)) 226 { 227 if (in_array(".svn", scandir($this->workingCopy))) 228 { 229 $this->svnArgs = array($this->workingCopy); 230 } 231 else 232 { 233 throw new BuildException("'".$this->workingCopy."' doesn't seem to be a working copy"); 234 } 235 } 236 else 237 { 238 throw new BuildException("'".$this->workingCopy."' is not a directory"); 239 } 240 } 241 } 242 243 /** 244 * Executes the constructed VersionControl_SVN instance 245 * 246 * @param array Additional arguments to pass to SVN. 247 * @param array Switches to pass to SVN. 248 * @return string Output generated by SVN. 249 */ 250 protected function run($args = array(), $switches = array()) 251 { 252 $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN'); 253 254 $tempArgs = $this->svnArgs; 255 256 $tempArgs = array_merge($tempArgs, $args); 257 258 $tempSwitches = $this->svnSwitches; 259 260 $tempSwitches = array_merge($tempSwitches, $switches); 261 262 if ($output = $this->svn->run($tempArgs, $tempSwitches)) 263 { 264 return $output; 265 } 266 else 267 { 268 if (count($errs = $svnstack->getErrors())) 269 { 270 $err = current($errs); 271 272 throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $err['message']); 273 } 274 } 275 } 276 } 1 <?php 2 /* 3 * $Id: SvnBaseTask.php 119 2006-09-14 20:02:22Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 include_once 'phing/Task.php'; 23 24 /** 25 * Base class for Subversion tasks 26 * 27 * @author Michiel Rook <michiel.rook@gmail.com> 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnBaseTask.php 119 2006-09-14 20:02:22Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @see VersionControl_SVN 32 * @since 2.2.0 33 */ 34 abstract class SvnBaseTask extends Task 35 { 36 private $workingCopy = ""; 37 38 private $repositoryUrl = ""; 39 40 private $svnPath = "/usr/bin/svn"; 41 42 private $svn = NULL; 43 44 private $mode = ""; 45 46 private $svnArgs = array(); 47 48 private $svnSwitches = array(); 49 50 private $toDir = ""; 51 52 /** 53 * Initialize Task. 54 * This method includes any necessary SVN libraries and triggers 55 * appropriate error if they cannot be found. This is not done in header 56 * because we may want this class to be loaded w/o triggering an error. 57 */ 58 function init() { 59 include_once 'VersionControl/SVN.php'; 60 if (!class_exists('VersionControl_SVN')) { 61 throw new Exception("SvnLastRevisionTask depends on PEAR VersionControl_SVN package being installed."); 62 } 63 } 64 65 /** 66 * Sets the path to the workingcopy 67 */ 68 function setWorkingCopy($workingCopy) 69 { 70 $this->workingCopy = $workingCopy; 71 } 72 73 /** 74 * Returns the path to the workingcopy 75 */ 76 function getWorkingCopy() 77 { 78 return $this->workingCopy; 79 } 80 81 /** 82 * Sets the path/URI to the repository 83 */ 84 function setRepositoryUrl($repositoryUrl) 85 { 86 $this->repositoryUrl = $repositoryUrl; 87 } 88 89 /** 90 * Returns the path/URI to the repository 91 */ 92 function getRepositoryUrl() 93 { 94 return $this->repositoryUrl; 95 } 96 97 /** 98 * Sets the path to the SVN executable 99 */ 100 function setSvnPath($svnPath) 101 { 102 $this->svnPath = $svnPath; 103 } 104 105 /** 106 * Returns the path to the SVN executable 107 */ 108 function getSvnPath() 109 { 110 return $this->svnPath; 111 } 112 113 // 114 // Args 115 // 116 117 /** 118 * Sets the path to export/checkout to 119 */ 120 function setToDir($toDir) 121 { 122 $this->toDir = $toDir; 123 } 124 125 /** 126 * Returns the path to export/checkout to 127 */ 128 function getToDir() 129 { 130 return $this->toDir; 131 } 132 133 // 134 // Switches 135 // 136 137 /** 138 * Sets the force switch 139 */ 140 function setForce($value) 141 { 142 $this->svnSwitches['force'] = $value; 143 } 144 145 /** 146 * Returns the forec switch 147 */ 148 function getForce() 149 { 150 return isset( $this->svnSwitches['force'] ) ? $this->svnSwitches['force'] : ''; 151 } 152 153 /** 154 * Sets the username of the user to export 155 */ 156 function setUsername($value) 157 { 158 $this->svnSwitches['username'] = $value; 159 } 160 161 /** 162 * Returns the username 163 */ 164 function getUsername() 165 { 166 return isset( $this->svnSwitches['username'] ) ? $this->svnSwitches['username'] : ''; 167 } 168 169 /** 170 * Sets the password of the user to export 171 */ 172 function setPassword($value) 173 { 174 $this->svnSwitches['password'] = $value; 175 } 176 177 /** 178 * Returns the password 179 */ 180 function getPassword() 181 { 182 return isset( $this->svnSwitches['password'] ) ? $this->svnSwitches['password'] : ''; 183 } 184 185 /** 186 * Sets the password of the user to export 187 */ 188 function setNoCache($value) 189 { 190 $this->svnSwitches['no-auth-cache'] = $value; 191 } 192 193 /** 194 * Returns the password 195 */ 196 function getNoCache() 197 { 198 return isset( $this->svnSwitches['no-auth-cache'] ) ? $this->svnSwitches['no-auth-cache'] : ''; 199 } 200 201 /** 202 * Creates a VersionControl_SVN class based on $mode 203 * 204 * @param string The SVN mode to use (info, export, checkout, ...) 205 * @throws BuildException 206 */ 207 protected function setup($mode) 208 { 209 $this->mode = $mode; 210 211 // Set up runtime options. Will be passed to all 212 // subclasses. 213 $options = array('fetchmode' => VERSIONCONTROL_SVN_FETCHMODE_ASSOC, 'svn_path' => $this->getSvnPath()); 214 215 // Pass array of subcommands we need to factory 216 $this->svn = VersionControl_SVN::factory($mode, $options); 217 218 if (!empty($this->repositoryUrl)) 219 { 220 $this->svnArgs = array($this->repositoryUrl); 221 } 222 else 223 if (!empty($this->workingCopy)) 224 { 225 if (is_dir($this->workingCopy)) 226 { 227 if (in_array(".svn", scandir($this->workingCopy))) 228 { 229 $this->svnArgs = array($this->workingCopy); 230 } 231 else 232 { 233 throw new BuildException("'".$this->workingCopy."' doesn't seem to be a working copy"); 234 } 235 } 236 else 237 { 238 throw new BuildException("'".$this->workingCopy."' is not a directory"); 239 } 240 } 241 } 242 243 /** 244 * Executes the constructed VersionControl_SVN instance 245 * 246 * @param array Additional arguments to pass to SVN. 247 * @param array Switches to pass to SVN. 248 * @return string Output generated by SVN. 249 */ 250 protected function run($args = array(), $switches = array()) 251 { 252 $svnstack = PEAR_ErrorStack::singleton('VersionControl_SVN'); 253 254 $tempArgs = $this->svnArgs; 255 256 $tempArgs = array_merge($tempArgs, $args); 257 258 $tempSwitches = $this->svnSwitches; 259 260 $tempSwitches = array_merge($tempSwitches, $switches); 261 262 if ($output = $this->svn->run($tempArgs, $tempSwitches)) 263 { 264 return $output; 265 } 266 else 267 { 268 if (count($errs = $svnstack->getErrors())) 269 { 270 $err = current($errs); 271 272 throw new BuildException("Failed to run the 'svn " . $this->mode . "' command: " . $err['message']); 273 } 274 } 275 } 276 } 277 277 ?> 278 No newline at end of file -
tasks/ext/svn/SvnCheckoutTask.php
diff -ru phing-orig/tasks/ext/svn/SvnCheckoutTask.php phing/tasks/ext/svn/SvnCheckoutTask.php
old new 1 <?php 2 /** 3 * $Id: SvnCheckoutTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Checks out a repository to a local directory 27 * 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnCheckoutTask.php 123 2006-09-14 20:19:08Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @since 2.3.0 32 */ 33 class SvnCheckoutTask extends SvnBaseTask 34 { 35 /** 36 * The main entry point 37 * 38 * @throws BuildException 39 */ 40 function main() 41 { 42 $this->setup('checkout'); 43 44 $this->log("Checking out SVN repository to '" . $this->getToDir() . "'"); 45 46 $this->run(array($this->getToDir())); 47 } 48 } 49 ?> 1 <?php 2 /** 3 * $Id: SvnCheckoutTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Checks out a repository to a local directory 27 * 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnCheckoutTask.php 123 2006-09-14 20:19:08Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @since 2.3.0 32 */ 33 class SvnCheckoutTask extends SvnBaseTask 34 { 35 /** 36 * The main entry point 37 * 38 * @throws BuildException 39 */ 40 function main() 41 { 42 $this->setup('checkout'); 43 44 $this->log("Checking out SVN repository to '" . $this->getToDir() . "'"); 45 46 $this->run(array($this->getToDir())); 47 } 48 } 49 ?> -
tasks/ext/svn/SvnExportTask.php
diff -ru phing-orig/tasks/ext/svn/SvnExportTask.php phing/tasks/ext/svn/SvnExportTask.php
old new 1 <?php 2 /** 3 * $Id: SvnExportTask.php 119 2006-09-14 20:02:22Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Exports/checks out a repository to a local directory 27 * with authentication 28 * 29 * @author Michiel Rook <michiel.rook@gmail.com> 30 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 31 * @version $Id: SvnExportTask.php 119 2006-09-14 20:02:22Z mrook $ 32 * @package phing.tasks.ext.svn 33 * @since 2.2.0 34 */ 35 class SvnExportTask extends SvnBaseTask 36 { 37 /** 38 * The main entry point 39 * 40 * @throws BuildException 41 */ 42 function main() 43 { 44 $this->setup('export'); 45 46 $this->log("Exporting SVN repository to '" . $this->getToDir() . "'"); 47 48 $this->run(array($this->getToDir())); 49 } 50 } 1 <?php 2 /** 3 * $Id: SvnExportTask.php 119 2006-09-14 20:02:22Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Exports/checks out a repository to a local directory 27 * with authentication 28 * 29 * @author Michiel Rook <michiel.rook@gmail.com> 30 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 31 * @version $Id: SvnExportTask.php 119 2006-09-14 20:02:22Z mrook $ 32 * @package phing.tasks.ext.svn 33 * @since 2.2.0 34 */ 35 class SvnExportTask extends SvnBaseTask 36 { 37 /** 38 * The main entry point 39 * 40 * @throws BuildException 41 */ 42 function main() 43 { 44 $this->setup('export'); 45 46 $this->log("Exporting SVN repository to '" . $this->getToDir() . "'"); 47 48 $this->run(array($this->getToDir())); 49 } 50 } 51 51 ?> 52 No newline at end of file -
tasks/ext/svn/SvnUpdateTask.php
diff -ru phing-orig/tasks/ext/svn/SvnUpdateTask.php phing/tasks/ext/svn/SvnUpdateTask.php
old new 1 <?php 2 /** 3 * $Id: SvnUpdateTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Updates a repository in local directory 27 * 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnUpdateTask.php 123 2006-09-14 20:19:08Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @since 2.3.0 32 */ 33 class SvnUpdateTask extends SvnBaseTask 34 { 35 /** 36 * The main entry point 37 * 38 * @throws BuildException 39 */ 40 function main() 41 { 42 $this->setup('update'); 43 44 $this->log("Updating SVN repository at '" . $this->getToDir() . "'"); 45 46 $this->run(array($this->getToDir())); 47 } 48 } 49 ?> 1 <?php 2 /** 3 * $Id: SvnUpdateTask.php 123 2006-09-14 20:19:08Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/Task.php'; 23 require_once 'phing/tasks/ext/svn/SvnBaseTask.php'; 24 25 /** 26 * Updates a repository in local directory 27 * 28 * @author Andrew Eddie <andrew.eddie@jamboworks.com> 29 * @version $Id: SvnUpdateTask.php 123 2006-09-14 20:19:08Z mrook $ 30 * @package phing.tasks.ext.svn 31 * @since 2.3.0 32 */ 33 class SvnUpdateTask extends SvnBaseTask 34 { 35 /** 36 * The main entry point 37 * 38 * @throws BuildException 39 */ 40 function main() 41 { 42 $this->setup('update'); 43 44 $this->log("Updating SVN repository at '" . $this->getToDir() . "'"); 45 46 $this->run(array($this->getToDir())); 47 } 48 } 49 ?> -
tasks/system/condition/ReferenceExistsCondition.php
diff -ru phing-orig/tasks/system/condition/ReferenceExistsCondition.php phing/tasks/system/condition/ReferenceExistsCondition.php
old new 1 <?php 2 /* 3 * $Id: ReferenceExistsCondition.php 43 2006-03-10 14:31:51Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/ProjectComponent.php'; require_once 'phing/tasks/system/condition/Condition.php'; 23 24 /** 25 * Condition that tests whether a given reference exists. 26 * 27 * @author Matthias Pigulla <mp@webfactory.de> (Phing) 28 * @version $Revision: 1.1 $ 29 * @package phing.tasks.system.condition */ 30 class ReferenceExistsCondition extends ProjectComponent implements Condition { 31 32 private $refid; 33 34 public function setRef($id) { 35 $this->refid = (string) $id; 36 } 37 38 /** 39 * Check whether the reference exists. 40 * @throws BuildException 41 */ 42 public function evaluate() { 43 if ($this->refid === null) { 44 throw new BuildException("No ref attribute specified for reference-exists " 45 . "condition"); 46 } 47 $refs = $this->project->getReferences(); 48 return isset($refs[$this->refid]); 49 } 50 51 } 52 1 <?php 2 /* 3 * $Id: ReferenceExistsCondition.php 43 2006-03-10 14:31:51Z mrook $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://phing.info>. 20 */ 21 22 require_once 'phing/ProjectComponent.php'; require_once 'phing/tasks/system/condition/Condition.php'; 23 24 /** 25 * Condition that tests whether a given reference exists. 26 * 27 * @author Matthias Pigulla <mp@webfactory.de> (Phing) 28 * @version $Revision: 1.1 $ 29 * @package phing.tasks.system.condition */ 30 class ReferenceExistsCondition extends ProjectComponent implements Condition { 31 32 private $refid; 33 34 public function setRef($id) { 35 $this->refid = (string) $id; 36 } 37 38 /** 39 * Check whether the reference exists. 40 * @throws BuildException 41 */ 42 public function evaluate() { 43 if ($this->refid === null) { 44 throw new BuildException("No ref attribute specified for reference-exists " 45 . "condition"); 46 } 47 $refs = $this->project->getReferences(); 48 return isset($refs[$this->refid]); 49 } 50 51 } 52
