dapp 0.22.14 → 0.22.15

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: c2a7b9af7bc533b0ab816bf4b5a6ebc22a3fd596
4
- data.tar.gz: 9fe197382aec5851bcf0bd49c615328633d44c6d
3
+ metadata.gz: ada0cbea74d45cc601b5fc677937182f09402435
4
+ data.tar.gz: bca95e83b1a81f8955457afa53dc512196f96c87
5
5
  SHA512:
6
- metadata.gz: f9a7cb1f32ff27e410723ce1b57558ff3ca02395d743c3dcecec1c5d408c2176ba5e557799f31cd8b41919f30c69fcaa29490c164d236636e493e4cc1a119bbd
7
- data.tar.gz: bb9784a35025ffdd01cec49abbef022d76400f07772dd034066148d1a8619d91a79b66300a6c3c14cda825759882f6e8b148c73e146d424b961dec7c1eee864a
6
+ metadata.gz: c29702a13788871b7a6ffd099cf216902268e2bd5c73b2bdea3cb9f5ccf6ac478e7e8eb84e439d458982ec4ced276f01c235b80f870b3802837037b93d211f3b
7
+ data.tar.gz: 99c367343d1a038ad112e99fe6423f4921409b60fdf9aca06360212b7d6961969c270c0536f4cd74ee4f4e617420a27069c10c1a154a8195ab975953ccf0bbef
@@ -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!
@@ -138,29 +140,13 @@ module Dapp
138
140
  end
139
141
 
140
142
  def validate_artifact!(verifiable_artifact, artifact)
141
- verifiable_artifact[:include_paths].each do |verifiable_path|
142
- potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
143
- validate_artifact_path!(verifiable_artifact, potential_conflicts)
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
143
+ cases = []
144
+ cases << verifiable_artifact[:include_paths].any? do |verifiable_path|
145
+ !ignore_path?(verifiable_path, paths: artifact[:include_paths], exclude_paths: artifact[:exclude_paths])
152
146
  end
153
- end
147
+ cases << verifiable_artifact[:include_paths].empty? && artifact[:include_paths].empty?
154
148
 
155
- def validate_artifact_path!(verifiable_artifact, potential_conflicts)
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)
162
- end
163
- end
149
+ raise ::Dapp::Error::Config, code: :artifact_conflict if cases.any?
164
150
  end
165
151
 
166
152
  def _associated_artifacts
@@ -3,6 +3,8 @@ module Dapp
3
3
  module GitRepo
4
4
  # Base class for any Git repo (remote, gitkeeper, etc)
5
5
  class Base
6
+ include Helper::Trivia
7
+
6
8
  attr_reader :name
7
9
 
8
10
  def initialize(manager, name)
@@ -132,32 +134,6 @@ module Dapp
132
134
  def git(**kwargs)
133
135
  @git ||= Rugged::Repository.new(path.to_s, **kwargs)
134
136
  end
135
-
136
- private
137
-
138
- def ignore_path?(path, paths: [], exclude_paths: [])
139
- is_exclude_path = exclude_paths.any? { |p| check_path?(path, p) }
140
- is_include_path = begin
141
- paths.empty? ||
142
- paths.any? do |p|
143
- File.fnmatch?(p, path, File::FNM_PATHNAME) ||
144
- File.fnmatch?(File.join(p, '**', '*'), path, File::FNM_PATHNAME)
145
- end
146
- end
147
-
148
- is_exclude_path || !is_include_path
149
- end
150
-
151
- def check_path?(path, format)
152
- path_parts = path.split('/')
153
- checking_path = nil
154
-
155
- until path_parts.empty?
156
- checking_path = [checking_path, path_parts.shift].compact.join('/')
157
- return true if File.fnmatch?(format, checking_path, File::FNM_PATHNAME)
158
- end
159
- false
160
- end
161
137
  end
162
138
  end
163
139
  end
@@ -28,6 +28,41 @@ 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
+ def check_path?(path, format)
48
+ path_checker(path) { |checking_path| File.fnmatch(format, checking_path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
49
+ end
50
+
51
+ def check_subpath?(path, format)
52
+ path_checker(format) { |checking_path| File.fnmatch(checking_path, path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
53
+ end
54
+
55
+ def path_checker(path)
56
+ path_parts = path.split('/')
57
+ checking_path = nil
58
+
59
+ until path_parts.empty?
60
+ checking_path = [checking_path, path_parts.shift].compact.join('/')
61
+ return true if yield checking_path
62
+ end
63
+ false
64
+ end
65
+
31
66
  def self.class_to_lowercase(class_name = self)
32
67
  class_name.to_s.split('::').last.split(/(?=[[:upper:]]|[0-9])/).join('_').downcase.to_s
33
68
  end
@@ -13,8 +13,8 @@ module Dapp
13
13
  template_relative_path_pattern = Pathname(File.expand_path(template_path_pattern)).subpath_of(path('.helm'))
14
14
  template_relative_path_pattern ||= template_path_pattern
15
15
 
16
- File.fnmatch?(template_relative_path_pattern, template_path_without_chart_name, File::FNM_PATHNAME) ||
17
- File.fnmatch?(template_relative_path_pattern, template_path, File::FNM_PATHNAME)
16
+ File.fnmatch?(template_relative_path_pattern, template_path_without_chart_name, File::FNM_PATHNAME|File::FNM_DOTMATCH) ||
17
+ File.fnmatch?(template_relative_path_pattern, template_path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
18
18
  end
19
19
  end
20
20
  else
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = '0.22.14'.freeze
3
- BUILD_CACHE_VERSION = 26
2
+ VERSION = '0.22.15'.freeze
3
+ BUILD_CACHE_VERSION = 26.1
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.22.14
4
+ version: 0.22.15
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-25 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout