dapp 0.7.31 → 0.7.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dapp/git_repo/base.rb +2 -2
- data/lib/dapp/git_repo/own.rb +1 -1
- data/lib/dapp/git_repo/remote.rb +28 -9
- data/lib/dapp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8e2d54d5e6eb7e5eede29862e0cc68e6c1e7ffa
|
4
|
+
data.tar.gz: 320dea6138d6c2b1efc4b9bae2eded54b471d005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72d073adb207a6c08a81e9f5f09f5ebacdaf3d3289ee5a0578cab6615e135c0691a8de5832a46b60740d51289f5b9603095f847bd3bd44c2fa786de3672cfbe1
|
7
|
+
data.tar.gz: 1be7e0b1f1223a1625a67f32de3cd30f2c92357897b390f8787dfc3989d2981220a9b2d85ca7ef5b365fed1f66411dc4e69ee4a6d1bf57eaa15a06f0a3a3afef
|
data/lib/dapp/git_repo/base.rb
CHANGED
data/lib/dapp/git_repo/own.rb
CHANGED
data/lib/dapp/git_repo/remote.rb
CHANGED
@@ -9,27 +9,46 @@ module Dapp
|
|
9
9
|
|
10
10
|
dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_clone', data: { name: name }), short: true) do
|
11
11
|
begin
|
12
|
-
Rugged::Repository.clone_at(
|
13
|
-
url, path,
|
14
|
-
bare: true,
|
15
|
-
credentials: proc do |_, username|
|
16
|
-
@_rugged_credentials = Rugged::Credentials::SshKeyFromAgent.new(username: username)
|
17
|
-
end
|
18
|
-
)
|
12
|
+
Rugged::Repository.clone_at(url, path, bare: true, credentials: _rugged_credentials)
|
19
13
|
rescue Rugged::NetworkError, Rugged::SslError => e
|
20
14
|
raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
|
21
15
|
end
|
22
16
|
end unless File.directory?(path)
|
23
17
|
end
|
24
18
|
|
19
|
+
def _rugged_credentials
|
20
|
+
@_rugged_credentials ||= begin
|
21
|
+
ssh_url = begin
|
22
|
+
URI.parse(@url)
|
23
|
+
false
|
24
|
+
rescue URI::InvalidURIError
|
25
|
+
true
|
26
|
+
end
|
27
|
+
|
28
|
+
if ssh_url
|
29
|
+
host_with_user = @url.split(':', 2).first
|
30
|
+
username = host_with_user.split('@', 2).reverse.last
|
31
|
+
Rugged::Credentials::SshKeyFromAgent.new(username: username)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def path
|
37
|
+
dimg.build_path('git_repo_remote', name, Digest::MD5.hexdigest(@url)).to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
def container_path
|
41
|
+
dimg.container_tmp_path('git_repo_remote', name, Digest::MD5.hexdigest(@url)).to_s
|
42
|
+
end
|
43
|
+
|
25
44
|
def git_bare
|
26
|
-
@git_bare ||= Rugged::Repository.new(path, bare: true, credentials:
|
45
|
+
@git_bare ||= Rugged::Repository.new(path, bare: true, credentials: _rugged_credentials)
|
27
46
|
end
|
28
47
|
|
29
48
|
def fetch!(branch = nil)
|
30
49
|
branch ||= self.branch
|
31
50
|
dimg.project.log_secondary_process(dimg.project.t(code: 'process.git_artifact_fetch', data: { name: name }), short: true) do
|
32
|
-
git_bare.fetch('origin', [branch], credentials:
|
51
|
+
git_bare.fetch('origin', [branch], credentials: _rugged_credentials)
|
33
52
|
raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } unless branch_exist?(branch)
|
34
53
|
end unless dimg.ignore_git_fetch || dimg.project.dry_run?
|
35
54
|
end
|
data/lib/dapp/version.rb
CHANGED