dapp 0.21.2 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa68d93baa4f34fd39023d92e84e77f87d71cc0218b6198b2527f7462244f12
|
4
|
+
data.tar.gz: 20b6b7ad98b9766e75a063359b0b138c3d118b84e3b548f2a204caea772df87e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea36eaca547f72db729ea8e68917d70dc9badc3fd029bf026eaa88855fabf120f22912e2905e798e558aba4d6ad35b964bcf0e9b4e3dce0fbadd49002d7a10f
|
7
|
+
data.tar.gz: 68ba6167d3753d9a30e9792eaf9959ae18d3e2200683bbe72d00fcaa1e11f5b0a75c982c9e4db4898e88361341b424581e6d1fa320f2faaeb837ddfd3fd07f8b
|
@@ -7,7 +7,10 @@ module Dapp
|
|
7
7
|
|
8
8
|
def initialize(url, **kwargs, &blk)
|
9
9
|
@_url = url
|
10
|
-
|
10
|
+
|
11
|
+
url_without_scheme = url.split("://", 2).last
|
12
|
+
url_without_creds = url_without_scheme.split(":", 2).last
|
13
|
+
@_name = url_without_creds.gsub(%r{.*?([^\/ ]+\/[^\/ ]+)\.git}, '\\1')
|
11
14
|
|
12
15
|
super(**kwargs, &blk)
|
13
16
|
end
|
@@ -9,19 +9,25 @@ module Dapp
|
|
9
9
|
|
10
10
|
@url = url
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
_with_lock do
|
13
|
+
dapp.log_secondary_process(dapp.t(code: 'process.git_artifact_clone', data: { url: url }), short: true) do
|
14
|
+
begin
|
15
|
+
if [:https, :ssh].include?(protocol) && !Rugged.features.include?(protocol)
|
16
|
+
raise Error::Rugged, code: :rugged_protocol_not_supported, data: { url: url, protocol: protocol }
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
Rugged::Repository.clone_at(url, path.to_s, bare: true, credentials: _rugged_credentials)
|
20
|
+
rescue Rugged::NetworkError, Rugged::SslError, Rugged::OSError => e
|
21
|
+
raise Error::Rugged, code: :rugged_remote_error, data: { message: e.message, url: url }
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end unless path.directory?
|
23
25
|
end
|
24
26
|
|
27
|
+
def _with_lock(&blk)
|
28
|
+
dapp.lock("remote_git_artifact.#{name}", default_timeout: 120, &blk)
|
29
|
+
end
|
30
|
+
|
25
31
|
def _rugged_credentials
|
26
32
|
@_rugged_credentials ||= begin
|
27
33
|
if protocol == :ssh
|
@@ -33,14 +39,27 @@ module Dapp
|
|
33
39
|
end
|
34
40
|
|
35
41
|
def path
|
36
|
-
Pathname(dimg.build_path('git_repo_remote', name
|
42
|
+
Pathname(dimg.build_path('git_repo_remote', name).to_s)
|
37
43
|
end
|
38
44
|
|
39
45
|
def fetch!(branch = nil)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
_with_lock do
|
47
|
+
branch ||= self.branch
|
48
|
+
|
49
|
+
cfg_path = path.join("config")
|
50
|
+
cfg = IniFile.load(cfg_path)
|
51
|
+
remote_origin_cfg = cfg['remote "origin"']
|
52
|
+
|
53
|
+
old_url = remote_origin_cfg["url"]
|
54
|
+
if old_url and old_url != url
|
55
|
+
remote_origin_cfg["url"] = url
|
56
|
+
cfg.write(filename: cfg_path)
|
57
|
+
end
|
58
|
+
|
59
|
+
dapp.log_secondary_process(dapp.t(code: 'process.git_artifact_fetch', data: { url: url }), short: true) do
|
60
|
+
git.fetch('origin', [branch], credentials: _rugged_credentials)
|
61
|
+
raise Error::Rugged, code: :branch_not_exist_in_remote_git_repository, data: { branch: branch, url: url } unless branch_exist?(branch)
|
62
|
+
end
|
44
63
|
end unless dimg.ignore_git_fetch || dapp.dry_run?
|
45
64
|
end
|
46
65
|
|
@@ -12,6 +12,12 @@ BANNER
|
|
12
12
|
long: '--namespace NAME',
|
13
13
|
default: nil
|
14
14
|
|
15
|
+
option :image_version,
|
16
|
+
long: '--image-version TAG',
|
17
|
+
description: "Custom tag (alias for --tag)",
|
18
|
+
default: [],
|
19
|
+
proc: proc { |v| composite_options(:image_versions) << v }
|
20
|
+
|
15
21
|
option :tag,
|
16
22
|
long: '--tag TAG',
|
17
23
|
description: 'Custom tag',
|
@@ -66,7 +72,10 @@ BANNER
|
|
66
72
|
def run(argv = ARGV)
|
67
73
|
self.class.parse_options(self, argv)
|
68
74
|
|
69
|
-
|
75
|
+
options = cli_options
|
76
|
+
options[:tag] = [*options.delete(:tag), *options.delete(:image_version)]
|
77
|
+
|
78
|
+
run_dapp_command(nil, options: options) do |dapp|
|
70
79
|
repo = if not cli_arguments[0].nil?
|
71
80
|
self.class.required_argument(self, 'repo')
|
72
81
|
else
|
data/lib/dapp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.21.
|
4
|
+
version: 0.21.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|