dapp 0.26.7 → 0.26.8

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: c3505e2ebea991db664abc4a23e66afdf07fa6c6
4
- data.tar.gz: 078351c116d7f94b585559db68303cd888ae1d3b
3
+ metadata.gz: 6efd6e4823be7cddb1e21d5a7ff7ac3faa5c6a3b
4
+ data.tar.gz: 5fd4fc5e3e92d5d3ca76a6755c43901741025637
5
5
  SHA512:
6
- metadata.gz: 8eed4a2a01192400a139947f5d56d546f0c4c24825d948e13bbcd670576106461ce56771241da1a05a52051b2cdd0e9cdbaa89c86548e651a8b7f633af4a61a2
7
- data.tar.gz: f32334d18d707b91c5c92e890f13aea5e883691fed3b31b87dc9db931be7fb673257057349a5c28acdf5327564a50354cad1e0ed80814e213850abd154e449eb
6
+ metadata.gz: 544564aaa7da8b80e5476c77877a87ffa7766c002892da3299ac13295aa938d58b762cb1b415d8f28334a66a3c0478463895ab2abbfa33eab82f8721931d41a0
7
+ data.tar.gz: de71ce126fac80dde41218166e3c8034877f04c9d0448c8ad8db0c47fd18d6ec8033f95dcef5041d6911e509e2741d8d9ca7559a4a3acf668ef7f9caf08b8ced
@@ -4,8 +4,6 @@ module Dapp
4
4
  module Directive
5
5
  class Dimg < Base
6
6
  module Validation
7
- include Helper::Trivia
8
-
9
7
  def validate!
10
8
  directives_validate!
11
9
  validate_scratch!
@@ -141,13 +139,29 @@ module Dapp
141
139
  end
142
140
 
143
141
  def validate_artifact!(verifiable_artifact, artifact)
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])
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
147
153
  end
148
- cases << verifiable_artifact[:include_paths].empty? && artifact[:include_paths].empty?
154
+ end
149
155
 
150
- raise ::Dapp::Error::Config, code: :artifact_conflict if cases.any?
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
151
165
  end
152
166
 
153
167
  def _associated_artifacts
@@ -227,6 +227,22 @@ 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
230
246
  end
231
247
  end
232
248
  end
@@ -28,22 +28,6 @@ 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
-
47
31
  def check_path?(path, format)
48
32
  path_checker(path) { |checking_path| File.fnmatch(format, checking_path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
49
33
  end
data/lib/dapp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.26.7"
2
+ VERSION = "0.26.8"
3
3
  BUILD_CACHE_VERSION = 27
4
4
  end
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.26.7
4
+ version: 0.26.8
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-02-21 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout