dapp 0.23.7 → 0.23.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 123bf18470301a972454d889d5e683be0b4038c7
4
- data.tar.gz: b39120ac9e4509a7db5538dda00b0f4145b96c97
3
+ metadata.gz: fc8797c9cce3b9447a9f108650e6ade4ad297ec0
4
+ data.tar.gz: d1dfadf79f8590532b00cf4a143d17a1adca329b
5
5
  SHA512:
6
- metadata.gz: 79fcf01ed18499f088142ac151215bfbb580262a22500f14b73030c0de1439c499ed8d1829e1801b9c18835f3c1e97a8546da07c5256f199a16427509a16021a
7
- data.tar.gz: f3ecd53bde57ce30d0256e011f4b74e8f51b613ac98db01079a1d525685cf24415e2a3c411acb120e5e6bd14f7b45b62004f9f6348304f9c3fa66c1bb364a57e
6
+ metadata.gz: 5d872ae2a7a8a924349f92a21e10a8b6b8fd6ff12a83874dbc67aea1a5766186c10748d4d6096d62b7321e93d20d9df0e5de1b728b61dfa642be88a190dc11a8
7
+ data.tar.gz: d136794c378a8b9e68c1a8f02a49e4deb0391b7662e008fbe2d90a052e4e7c2ac70754576180a9422bb4df8fd52d1e4d2e184ee66ba3d60948312aef587d45a3
@@ -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.23.7"
3
- BUILD_CACHE_VERSION = 26
2
+ VERSION = "0.23.8"
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.23.7
4
+ version: 0.23.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-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