dapp 0.26.8 → 0.26.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dapp/dimg/config/directive/dimg/validation.rb +7 -21
- data/lib/dapp/dimg/git_repo/base.rb +0 -16
- data/lib/dapp/helper/trivia.rb +16 -0
- 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: a68a90c93c0fb793ac7a2e9fcb8b0c71f5bf4169
|
4
|
+
data.tar.gz: 82533b89393ec86b2ba58f59740414bcf3003ccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f7a1535aad1d2a404626e94eabff80e1589536dfa8c7e57ea3e5a1b29d15a3fa7f79aaa58f6fca599d19d5934c4880f1fb3b06944872071b3784f0d56de7444
|
7
|
+
data.tar.gz: cd73f8ce59fe326811f83617195b928e83e15190827a7834c81562c942667f7c873ea93189771747b32aa3bad54a310a85f62574a3a86e7ec39532a885c4ed3b
|
@@ -4,6 +4,8 @@ module Dapp
|
|
4
4
|
module Directive
|
5
5
|
class Dimg < Base
|
6
6
|
module Validation
|
7
|
+
include Helper::Trivia
|
8
|
+
|
7
9
|
def validate!
|
8
10
|
directives_validate!
|
9
11
|
validate_scratch!
|
@@ -139,29 +141,13 @@ module Dapp
|
|
139
141
|
end
|
140
142
|
|
141
143
|
def validate_artifact!(verifiable_artifact, artifact)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
end
|
146
|
-
|
147
|
-
if verifiable_artifact[:include_paths].empty?
|
148
|
-
if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
|
149
|
-
raise ::Dapp::Error::Config, code: :artifact_conflict
|
150
|
-
else
|
151
|
-
validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
|
152
|
-
end
|
144
|
+
cases = []
|
145
|
+
cases << verifiable_artifact[:include_paths].any? do |verifiable_path|
|
146
|
+
!ignore_path?(verifiable_path, paths: artifact[:include_paths], exclude_paths: artifact[:exclude_paths])
|
153
147
|
end
|
154
|
-
|
148
|
+
cases << (verifiable_artifact[:include_paths].empty? && artifact[:include_paths].empty?)
|
155
149
|
|
156
|
-
|
157
|
-
raise ::Dapp::Error::Config, code: :artifact_conflict unless begin
|
158
|
-
potential_conflicts.all? do |path|
|
159
|
-
loop do
|
160
|
-
break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
|
161
|
-
end
|
162
|
-
verifiable_artifact[:exclude_paths].include?(path)
|
163
|
-
end
|
164
|
-
end
|
150
|
+
raise ::Dapp::Error::Config, code: :artifact_conflict if cases.any?
|
165
151
|
end
|
166
152
|
|
167
153
|
def _associated_artifacts
|
@@ -227,22 +227,6 @@ module Dapp
|
|
227
227
|
paths.empty? || paths.any? { |p| check_path?(path, p) || check_subpath?(path, p) }
|
228
228
|
end
|
229
229
|
end
|
230
|
-
|
231
|
-
def ignore_path?(path, paths: [], exclude_paths: [])
|
232
|
-
ignore_path_base(path, exclude_paths: exclude_paths) do
|
233
|
-
paths.empty? ||
|
234
|
-
paths.any? do |p|
|
235
|
-
File.fnmatch?(p, path, File::FNM_PATHNAME|File::FNM_DOTMATCH) ||
|
236
|
-
File.fnmatch?(File.join(p, '**', '*'), path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
|
237
|
-
end
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
def ignore_path_base(path, exclude_paths: [])
|
242
|
-
is_exclude_path = exclude_paths.any? { |p| check_path?(path, p) }
|
243
|
-
is_include_path = yield
|
244
|
-
is_exclude_path || !is_include_path
|
245
|
-
end
|
246
230
|
end
|
247
231
|
end
|
248
232
|
end
|
data/lib/dapp/helper/trivia.rb
CHANGED
@@ -28,6 +28,22 @@ module Dapp
|
|
28
28
|
Pathname.new(File.join(base.to_s, *path.compact.map(&:to_s)))
|
29
29
|
end
|
30
30
|
|
31
|
+
def ignore_path?(path, paths: [], exclude_paths: [])
|
32
|
+
ignore_path_base(path, exclude_paths: exclude_paths) do
|
33
|
+
paths.empty? ||
|
34
|
+
paths.any? do |p|
|
35
|
+
File.fnmatch?(p, path, File::FNM_PATHNAME|File::FNM_DOTMATCH) ||
|
36
|
+
File.fnmatch?(File.join(p, '**', '*'), path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def ignore_path_base(path, exclude_paths: [])
|
42
|
+
is_exclude_path = exclude_paths.any? { |p| check_path?(path, p) }
|
43
|
+
is_include_path = yield
|
44
|
+
is_exclude_path || !is_include_path
|
45
|
+
end
|
46
|
+
|
31
47
|
def check_path?(path, format)
|
32
48
|
path_checker(path) { |checking_path| File.fnmatch(format, checking_path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
|
33
49
|
end
|
data/lib/dapp/version.rb
CHANGED