134
135
136
137
138
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
|
# File 'lib/git.rb', line 134
def initialize(options = {})
@sshSessionFactory = Class.new(JschConfigSessionFactory) {
def initialize(options)
super()
@private_key_file = options[:private_key_file]
@private_key_passphrase = options[:private_key_passphrase]
@username = options[:username]
@password = options[:password]
@known_hosts_file = options[: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(options)
end
|