20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/daun/cli.rb', line 20
def checkout
rugged_daun = Daun::RuggedDaun.new(options[:directory])
credentials = nil
begin
origin_uri = GitCloneUrl.parse(rugged_daun.remote_url)
credentials =
case origin_uri
when URI::SshGit::Generic then
Rugged::Credentials::SshKey.new(
username: origin_uri.user,
privatekey: options[:ssh_private_key],
publickey: options[:ssh_public_key]
)
else
credentials = nil
end
rescue URI::InvalidComponentError
credentials = nil
end
rugged_daun.checkout credentials
end
|