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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6efd6e4823be7cddb1e21d5a7ff7ac3faa5c6a3b
4
- data.tar.gz: 5fd4fc5e3e92d5d3ca76a6755c43901741025637
3
+ metadata.gz: a68a90c93c0fb793ac7a2e9fcb8b0c71f5bf4169
4
+ data.tar.gz: 82533b89393ec86b2ba58f59740414bcf3003ccf
5
5
  SHA512:
6
- metadata.gz: 544564aaa7da8b80e5476c77877a87ffa7766c002892da3299ac13295aa938d58b762cb1b415d8f28334a66a3c0478463895ab2abbfa33eab82f8721931d41a0
7
- data.tar.gz: de71ce126fac80dde41218166e3c8034877f04c9d0448c8ad8db0c47fd18d6ec8033f95dcef5041d6911e509e2741d8d9ca7559a4a3acf668ef7f9caf08b8ced
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
- verifiable_artifact[:include_paths].each do |verifiable_path|
143
- potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
144
- validate_artifact_path!(verifiable_artifact, potential_conflicts)
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
- end
148
+ cases << (verifiable_artifact[:include_paths].empty? && artifact[:include_paths].empty?)
155
149
 
156
- def validate_artifact_path!(verifiable_artifact, potential_conflicts)
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
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.26.8"
2
+ VERSION = "0.26.9"
3
3
  BUILD_CACHE_VERSION = 27
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.8
4
+ version: 0.26.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov