class Evrone::CI::SCM::Git::GitSSH
Attributes
deploy_key[R]
Public Class Methods
new(deploy_key)
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 13 def initialize(deploy_key) @deploy_key = deploy_key end
Public Instance Methods
create()
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 25 def create key_location location end
destroy()
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 30 def destroy key_location.unlink if key_location location.unlink @location = nil @key_location = nil end
key_location()
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 41 def key_location if deploy_key @key_location ||= write_tmp_file 'key', deploy_key, 0600 end end
location()
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 37 def location @location ||= write_tmp_file 'git', template, 0700 end
open() { |create| ... }
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 17 def open begin yield create ensure destroy end end
template()
click to toggle source
# File lib/evrone/ci/scm/git/git_ssh.rb, line 47 def template key = key_location ? "-i #{key_location.path}" : "" out = ['#!/bin/sh'] out << "exec /usr/bin/ssh -A -o StrictHostKeyChecking=no #{key} $@" out.join "\n" end