Class: RJGit::RubyGit::RJGitSSHConfigCallback
- Inherits:
-
Object
- Object
- RJGit::RubyGit::RJGitSSHConfigCallback
- Includes:
- TransportConfigCallback
- Defined in:
- lib/git.rb
Instance Method Summary collapse
- #configure(ssh_transport) ⇒ Object
-
#initialize(options = {}) ⇒ RJGitSSHConfigCallback
constructor
A new instance of RJGitSSHConfigCallback.
Constructor Details
#initialize(options = {}) ⇒ RJGitSSHConfigCallback
Returns a new instance of RJGitSSHConfigCallback.
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/git.rb', line 139 def initialize( = {}) @sshSessionFactory = Class.new(JschConfigSessionFactory) { def initialize() super() @private_key_file = [:private_key_file] @private_key_passphrase = [:private_key_passphrase] @username = [:username] @password = [:password] @known_hosts_file = [:known_hosts_file] end def configure(host, session) session.setUserName(@username) if @username session.setPassword(@password) if @password end def createDefaultJSch(fs) default_j_sch = super(fs) if @private_key_file default_j_sch.removeAllIdentity() if @private_key_passphrase default_j_sch.addIdentity(@private_key_file, @private_key_passphrase) else default_j_sch.addIdentity(@private_key_file) end end if @known_hosts_file default_j_sch.setKnownHosts(@known_hosts_file) end return default_j_sch end }.new() end |
Instance Method Details
#configure(ssh_transport) ⇒ Object
174 175 176 |
# File 'lib/git.rb', line 174 def configure(ssh_transport) ssh_transport.setSshSessionFactory(@sshSessionFactory) end |