dapp 0.21.12 → 0.21.13
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 +4 -4
- data/config/en/net_status.yml +1 -1
- data/lib/dapp/dimg/config/directive/artifact_dimg.rb +0 -7
- data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +1 -0
- data/lib/dapp/dimg/config/directive/dimg/validation.rb +47 -10
- data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +3 -3
- data/lib/dapp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce5005fb6e0eb05a281c35ea110b15cf00fd663e
|
4
|
+
data.tar.gz: fceb0e4c395aef5bf854a76bb7f041bde0b1f65d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64714ff2147d0b123e3b2bdbdfb84a47db6fe140e47a272ae3fbcd5c7ecd408ae348a0b322b83e4bbcc0b2de082ba9be6f1ea9a41d352c2f4fc28f543653df57
|
7
|
+
data.tar.gz: 3485853cc5256deb0e044c29ba8ce931bd460db0c47776125bf95a8805cbfb0cd35fd5dca51e5df1916abf2d09d14bdb4bf4580729de441c2d1be85df68b1f9e
|
data/config/en/net_status.yml
CHANGED
@@ -80,7 +80,7 @@ en:
|
|
80
80
|
stage_artifact_double_associate: "Can't use `%{stage}` stage for artifact; already used in `%{conflict_stage}` stage!"
|
81
81
|
stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
|
82
82
|
git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
|
83
|
-
artifact_conflict: "Conflict between artifacts
|
83
|
+
artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
|
84
84
|
scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
|
85
85
|
scratch_artifact_required: "Scratch dimg without artifacts!"
|
86
86
|
scratch_artifact_associated: "Scratch artifact can't be associated: not expected `before`/`after` attribute!"
|
@@ -73,12 +73,39 @@ module Dapp
|
|
73
73
|
verifiable_artifact = artifacts.shift
|
74
74
|
artifacts.select { |a| a[:to] == verifiable_artifact[:to] }.each do |artifact|
|
75
75
|
next if verifiable_artifact[:index] == artifact[:index]
|
76
|
-
|
77
|
-
|
76
|
+
begin
|
77
|
+
validate_artifact!(verifiable_artifact, artifact)
|
78
|
+
validate_artifact!(artifact, verifiable_artifact)
|
79
|
+
rescue Error::Config => e
|
80
|
+
conflict_between_artifacts!(artifact, verifiable_artifact) if e.net_status[:code] == :artifact_conflict
|
81
|
+
raise
|
82
|
+
end
|
78
83
|
end
|
79
84
|
end
|
80
85
|
end
|
81
86
|
|
87
|
+
def conflict_between_artifacts!(*formatted_artifacts)
|
88
|
+
artifacts = formatted_artifacts.flatten.map { |formatted_artifact| formatted_artifact[:related_artifact] }
|
89
|
+
dappfile_context = artifacts.map do |artifact|
|
90
|
+
artifact_directive = []
|
91
|
+
artifact_directive << begin
|
92
|
+
if artifact.is_a? Artifact::Export
|
93
|
+
"artifact.export('#{artifact._cwd}') do"
|
94
|
+
else
|
95
|
+
"git#{"('#{artifact._url}')" if artifact.respond_to?(:_url)}.add('#{artifact._cwd}') do"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
[:include_paths, :exclude_paths].each do |directive|
|
99
|
+
next if (paths = artifact.send("_#{directive}")).empty?
|
100
|
+
artifact_directive << " #{directive} '#{paths.join("', '")}'"
|
101
|
+
end
|
102
|
+
artifact_directive << " to '#{artifact._to}'"
|
103
|
+
artifact_directive << 'end'
|
104
|
+
artifact_directive.join("\n")
|
105
|
+
end.join("\n\n")
|
106
|
+
raise Error::Config, code: :artifact_conflict, data: { dappfile_context: dappfile_context }
|
107
|
+
end
|
108
|
+
|
82
109
|
def validate_artifact_format(artifacts)
|
83
110
|
artifacts.map do |a|
|
84
111
|
path_format = proc { |path| File.expand_path(File.join('/', path, '/'))[1..-1] }
|
@@ -106,7 +133,8 @@ module Dapp
|
|
106
133
|
index: artifacts.index(a),
|
107
134
|
to: to,
|
108
135
|
include_paths: include_paths,
|
109
|
-
exclude_paths: exclude_paths
|
136
|
+
exclude_paths: exclude_paths,
|
137
|
+
related_artifact: a
|
110
138
|
}
|
111
139
|
end
|
112
140
|
end
|
@@ -115,17 +143,26 @@ module Dapp
|
|
115
143
|
verifiable_artifact[:include_paths].each do |verifiable_path|
|
116
144
|
potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
|
117
145
|
validate_artifact_path!(verifiable_artifact, potential_conflicts)
|
118
|
-
end
|
119
|
-
|
146
|
+
end
|
147
|
+
|
148
|
+
if verifiable_artifact[:include_paths].empty?
|
149
|
+
if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
|
150
|
+
raise Error::Config, code: :artifact_conflict
|
151
|
+
else
|
152
|
+
validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
|
153
|
+
end
|
154
|
+
end
|
120
155
|
end
|
121
156
|
|
122
157
|
def validate_artifact_path!(verifiable_artifact, potential_conflicts)
|
123
|
-
|
124
|
-
|
125
|
-
|
158
|
+
raise Error::Config, code: :artifact_conflict unless begin
|
159
|
+
potential_conflicts.all? do |path|
|
160
|
+
loop do
|
161
|
+
break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
|
162
|
+
end
|
163
|
+
verifiable_artifact[:exclude_paths].include?(path)
|
126
164
|
end
|
127
|
-
|
128
|
-
end.tap { |res| res || raise(Error::Config, code: :artifact_conflict) }
|
165
|
+
end
|
129
166
|
end
|
130
167
|
|
131
168
|
def _associated_artifacts
|
@@ -20,7 +20,7 @@ module Dapp
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def commit(value)
|
23
|
-
sub_directive_eval { @_commit = value }
|
23
|
+
sub_directive_eval { @_commit = value.to_s }
|
24
24
|
end
|
25
25
|
|
26
26
|
def _export
|
@@ -40,11 +40,11 @@ module Dapp
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def branch(value)
|
43
|
-
sub_directive_eval { @_branch = value }
|
43
|
+
sub_directive_eval { @_branch = value.to_s }
|
44
44
|
end
|
45
45
|
|
46
46
|
def commit(value)
|
47
|
-
sub_directive_eval { @_commit = value }
|
47
|
+
sub_directive_eval { @_commit = value.to_s }
|
48
48
|
end
|
49
49
|
|
50
50
|
def validate!
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Stolyarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -711,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
711
711
|
version: 2.5.0
|
712
712
|
requirements: []
|
713
713
|
rubyforge_project:
|
714
|
-
rubygems_version: 2.
|
714
|
+
rubygems_version: 2.6.11
|
715
715
|
signing_key:
|
716
716
|
specification_version: 4
|
717
717
|
summary: Build docker packaged apps using chef or shell
|