diff --git a/src/PHPCensor/Model/Build.php b/src/PHPCensor/Model/Build.php index 51efac39..2af6da05 100644 --- a/src/PHPCensor/Model/Build.php +++ b/src/PHPCensor/Model/Build.php @@ -930,4 +930,50 @@ class Build extends Model { return false; } + + /** + * Create an SSH key file on disk for this build. + * + * @param string $cloneTo + * + * @return string + */ + protected function writeSshKey($cloneTo) + { + $keyPath = dirname($cloneTo . '/temp'); + $keyFile = $keyPath . '.key'; + + file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); + chmod($keyFile, 0600); + + return $keyFile; + } + + /** + * Create an SSH wrapper script for Svn to use, to disable host key checking, etc. + * + * @param string $cloneTo + * @param string $keyFile + * + * @return string + */ + protected function writeSshWrapper($cloneTo, $keyFile) + { + $path = dirname($cloneTo . '/temp'); + $wrapperFile = $path . '.sh'; + + $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; + + // Write out the wrapper script for this build: + $script = <<getProject()->getSshPrivateKey()); - chmod($keyFile, 0600); - - // Return the filename: - return $keyFile; - } - - /** - * Create an SSH wrapper script for Git to use, to disable host key checking, etc. - * @param $cloneTo - * @param $keyFile - * @return string - */ - protected function writeSshWrapper($cloneTo, $keyFile) - { - $path = dirname($cloneTo . '/temp'); - $wrapperFile = $path . '.sh'; - - $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; - - // Write out the wrapper script for this build: - $script = <<svnCommand . ' %s "%s"'; - + $cmd = $this->svnCommand . ' %s "%s"'; $keyFile = $this->writeSshKey($cloneTo); $sshWrapper = $this->writeSshWrapper($cloneTo, $keyFile); $cmd = 'export SVN_SSH="' . $sshWrapper . '" && ' . $cmd; @@ -123,48 +122,4 @@ class SubversionBuild extends Build return $success; } - - /** - * Create an SSH key file on disk for this build. - * @param $cloneTo - * @return string - */ - protected function writeSshKey($cloneTo) - { - $keyPath = dirname($cloneTo . '/temp'); - $keyFile = $keyPath . '.key'; - - // Write the contents of this project's svn key to the file: - file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); - chmod($keyFile, 0600); - - // Return the filename: - return $keyFile; - } - - /** - * Create an SSH wrapper script for Svn to use, to disable host key checking, etc. - * @param $cloneTo - * @param $keyFile - * @return string - */ - protected function writeSshWrapper($cloneTo, $keyFile) - { - $path = dirname($cloneTo . '/temp'); - $wrapperFile = $path . '.sh'; - - $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; - - // Write out the wrapper script for this build: - $script = <<