dapp 0.23.5 → 0.23.6
Sign up to get free protection for your applications and to get access to all the features.
- 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: 4b7414b86082d6d690431f65221118dd25133296
|
4
|
+
data.tar.gz: cb0a237e5551ae18f7b95fceee867a233afb35e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02f5765c3636cfcdd0d81c75f181ff1285ea21f5af17865256918f08d780ea2064155dcc0df1eb1e96456689f6d783b6478fa99c6820468a4fd59b4849d107d4
|
7
|
+
data.tar.gz: 25d51ee250add4172c3b5c458cbfc9f20fd91d3b416ebb7d5ff450a10dcc6492ef069b0968ab85d3bb6c15846d8158aeaa0ecc508df4674aab02afa935a9869d
|
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!"
|
@@ -71,12 +71,39 @@ module Dapp
|
|
71
71
|
verifiable_artifact = artifacts.shift
|
72
72
|
artifacts.select { |a| a[:to] == verifiable_artifact[:to] }.each do |artifact|
|
73
73
|
next if verifiable_artifact[:index] == artifact[:index]
|
74
|
-
|
75
|
-
|
74
|
+
begin
|
75
|
+
validate_artifact!(verifiable_artifact, artifact)
|
76
|
+
validate_artifact!(artifact, verifiable_artifact)
|
77
|
+
rescue ::Dapp::Error::Config => e
|
78
|
+
conflict_between_artifacts!(artifact, verifiable_artifact) if e.net_status[:code] == :artifact_conflict
|
79
|
+
raise
|
80
|
+
end
|
76
81
|
end
|
77
82
|
end
|
78
83
|
end
|
79
84
|
|
85
|
+
def conflict_between_artifacts!(*formatted_artifacts)
|
86
|
+
artifacts = formatted_artifacts.flatten.map { |formatted_artifact| formatted_artifact[:related_artifact] }
|
87
|
+
dappfile_context = artifacts.map do |artifact|
|
88
|
+
artifact_directive = []
|
89
|
+
artifact_directive << begin
|
90
|
+
if artifact.is_a? Artifact::Export
|
91
|
+
"artifact.export('#{artifact._cwd}') do"
|
92
|
+
else
|
93
|
+
"git#{"('#{artifact._url}')" if artifact.respond_to?(:_url)}.add('#{artifact._cwd}') do"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
[:include_paths, :exclude_paths].each do |directive|
|
97
|
+
next if (paths = artifact.send("_#{directive}")).empty?
|
98
|
+
artifact_directive << " #{directive} '#{paths.join("', '")}'"
|
99
|
+
end
|
100
|
+
artifact_directive << " to '#{artifact._to}'"
|
101
|
+
artifact_directive << 'end'
|
102
|
+
artifact_directive.join("\n")
|
103
|
+
end.join("\n\n")
|
104
|
+
raise ::Dapp::Error::Config, code: :artifact_conflict, data: { dappfile_context: dappfile_context }
|
105
|
+
end
|
106
|
+
|
80
107
|
def validate_artifact_format(artifacts)
|
81
108
|
artifacts.map do |a|
|
82
109
|
path_format = proc { |path| File.expand_path(File.join('/', path, '/'))[1..-1] }
|
@@ -104,7 +131,8 @@ module Dapp
|
|
104
131
|
index: artifacts.index(a),
|
105
132
|
to: to,
|
106
133
|
include_paths: include_paths,
|
107
|
-
exclude_paths: exclude_paths
|
134
|
+
exclude_paths: exclude_paths,
|
135
|
+
related_artifact: a
|
108
136
|
}
|
109
137
|
end
|
110
138
|
end
|
@@ -113,17 +141,26 @@ module Dapp
|
|
113
141
|
verifiable_artifact[:include_paths].each do |verifiable_path|
|
114
142
|
potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
|
115
143
|
validate_artifact_path!(verifiable_artifact, potential_conflicts)
|
116
|
-
end
|
117
|
-
|
144
|
+
end
|
145
|
+
|
146
|
+
if verifiable_artifact[:include_paths].empty?
|
147
|
+
if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
|
148
|
+
raise ::Dapp::Error::Config, code: :artifact_conflict
|
149
|
+
else
|
150
|
+
validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
|
151
|
+
end
|
152
|
+
end
|
118
153
|
end
|
119
154
|
|
120
155
|
def validate_artifact_path!(verifiable_artifact, potential_conflicts)
|
121
|
-
|
122
|
-
|
123
|
-
|
156
|
+
raise ::Dapp::Error::Config, code: :artifact_conflict unless begin
|
157
|
+
potential_conflicts.all? do |path|
|
158
|
+
loop do
|
159
|
+
break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
|
160
|
+
end
|
161
|
+
verifiable_artifact[:exclude_paths].include?(path)
|
124
162
|
end
|
125
|
-
|
126
|
-
end.tap { |res| res || raise(::Dapp::Error::Config, code: :artifact_conflict) }
|
163
|
+
end
|
127
164
|
end
|
128
165
|
|
129
166
|
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
|
@@ -42,11 +42,11 @@ module Dapp
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def branch(value)
|
45
|
-
sub_directive_eval { @_branch = value }
|
45
|
+
sub_directive_eval { @_branch = value.to_s }
|
46
46
|
end
|
47
47
|
|
48
48
|
def commit(value)
|
49
|
-
sub_directive_eval { @_commit = value }
|
49
|
+
sub_directive_eval { @_commit = value.to_s }
|
50
50
|
end
|
51
51
|
|
52
52
|
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.23.
|
4
|
+
version: 0.23.6
|
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
|
@@ -721,7 +721,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
721
721
|
version: 2.5.0
|
722
722
|
requirements: []
|
723
723
|
rubyforge_project:
|
724
|
-
rubygems_version: 2.
|
724
|
+
rubygems_version: 2.6.11
|
725
725
|
signing_key:
|
726
726
|
specification_version: 4
|
727
727
|
summary: Build docker packaged apps using chef or shell
|