dapp 0.26.6 → 0.26.7

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: 2cf103585b6af6f69328db17a5361fb4af9c78f4
4
- data.tar.gz: f2602f349771558cfcad3320b758f1fbbaa9e766
3
+ metadata.gz: c3505e2ebea991db664abc4a23e66afdf07fa6c6
4
+ data.tar.gz: 078351c116d7f94b585559db68303cd888ae1d3b
5
5
  SHA512:
6
- metadata.gz: 707366341a8cd92b8c1ca5d20d33c1bc48df7924d14d0af49a2939aa5927be075c2dbad3582ea35ea19f65f475ed5f9d2201b17c2cfb92a08bdc410c62ba5bc4
7
- data.tar.gz: d86ff224672bb834c6076c3066b3245cf0917e0b9473bfe5aba3aebea5a9de346b74f02686540c05b2ef1f9f01acd02e33eb6470af1abb44d6649b2b7c7bd66e
6
+ metadata.gz: 8eed4a2a01192400a139947f5d56d546f0c4c24825d948e13bbcd670576106461ce56771241da1a05a52051b2cdd0e9cdbaa89c86548e651a8b7f633af4a61a2
7
+ data.tar.gz: f32334d18d707b91c5c92e890f13aea5e883691fed3b31b87dc9db931be7fb673257057349a5c28acdf5327564a50354cad1e0ed80814e213850abd154e449eb
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.26.6"
2
+ VERSION = "0.26.7"
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.6
4
+ version: 0.26.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Stolyarov