Ejemplo n.º 1
0
 /**
  *
  */
 private function newLine()
 {
     $this->textOut->newLine();
     if ($this->autoFlush) {
         $this->textOut->flush();
     }
 }
Ejemplo n.º 2
0
 /**
  * Does the work.
  *
  * @throws BuildException if someting goes wrong with the build
  */
 public final function main()
 {
     if ($this->cvsRoot === null) {
         throw new BuildException("cvsroot is required");
     }
     if ($this->password === null) {
         throw new BuildException("password is required");
     }
     $this->log("cvsRoot: " . $this->cvsRoot, Project::MSG_DEBUG);
     $this->log("password: "******"passFile: " . $this->passFile->__toString(), Project::MSG_DEBUG);
     $reader = null;
     $writer = null;
     try {
         $buf = "";
         if ($this->passFile->exists()) {
             $reader = new BufferedReader(new FileReader($this->passFile));
             $line = null;
             while (($line = $reader->readLine()) !== null) {
                 if (!StringHelper::startsWith($this->cvsRoot, $line)) {
                     $buf .= $line . PHP_EOL;
                 }
             }
         }
         $pwdfile = $buf . $this->cvsRoot . " A" . $this->mangle($this->password);
         $this->log("Writing -> " . $pwdfile, Project::MSG_DEBUG);
         $writer = new BufferedWriter(new FileWriter($this->passFile));
         $writer->write($pwdfile);
         $writer->newLine();
         $writer->close();
         if ($reader) {
             $reader->close();
         }
     } catch (IOException $e) {
         if ($reader) {
             try {
                 $reader->close();
             } catch (Exception $e) {
             }
         }
         if ($writer) {
             try {
                 $writer->close();
             } catch (Exception $e) {
             }
         }
         throw new BuildException($e);
     }
 }
Ejemplo n.º 3
0
 private static function writeComments(BufferedWriter $bw, $comments)
 {
     $rows = explode("\n", $comments);
     $bw->write("#" . PHP_EOL);
     foreach ($rows as $row) {
         $bw->write(sprintf("#%s%s", trim($row), PHP_EOL));
     }
     $bw->write("#");
     $bw->newLine();
 }