dapp 0.21.13 → 0.21.14

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
- SHA1:
3
- metadata.gz: ce5005fb6e0eb05a281c35ea110b15cf00fd663e
4
- data.tar.gz: fceb0e4c395aef5bf854a76bb7f041bde0b1f65d
2
+ SHA256:
3
+ metadata.gz: f28c3e192eccbff3666e393d68fd873bd15399bfe67f13f9796b9d61b4341073
4
+ data.tar.gz: 222f635d8f20ef23bccf30551cc55f6838e42dfa7c97f3002e8bf9369f407268
5
5
  SHA512:
6
- metadata.gz: 64714ff2147d0b123e3b2bdbdfb84a47db6fe140e47a272ae3fbcd5c7ecd408ae348a0b322b83e4bbcc0b2de082ba9be6f1ea9a41d352c2f4fc28f543653df57
7
- data.tar.gz: 3485853cc5256deb0e044c29ba8ce931bd460db0c47776125bf95a8805cbfb0cd35fd5dca51e5df1916abf2d09d14bdb4bf4580729de441c2d1be85df68b1f9e
6
+ metadata.gz: a0e9b4d7a79ca9ed9dc34a180fb9640c094326b35277fae1ac678d39fd6179e462280ce4289439a7234967d4410a65087057dc1bb6fa6725fc175ba9c60a95ff
7
+ data.tar.gz: bf3cb068a94e4dd3d28faecc9731ee54064c3c918b4f4904714c07973531af215b99356a2f26acf85a22a65aacec1302eb7903ddc02cf420f52726e499619d5a
@@ -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!
@@ -140,29 +142,13 @@ module Dapp
140
142
  end
141
143
 
142
144
  def validate_artifact!(verifiable_artifact, artifact)
143
- verifiable_artifact[:include_paths].each do |verifiable_path|
144
- potential_conflicts = artifact[:include_paths].select { |path| path.start_with?(verifiable_path) }
145
- validate_artifact_path!(verifiable_artifact, potential_conflicts)
146
- end
147
-
148
- if verifiable_artifact[:include_paths].empty?
149
- if artifact[:include_paths].empty? || verifiable_artifact[:exclude_paths].empty?
150
- raise Error::Config, code: :artifact_conflict
151
- else
152
- validate_artifact_path!(verifiable_artifact, artifact[:include_paths])
153
- end
145
+ cases = []
146
+ cases << verifiable_artifact[:include_paths].any? do |verifiable_path|
147
+ !ignore_path?(verifiable_path, paths: artifact[:include_paths], exclude_paths: artifact[:exclude_paths])
154
148
  end
155
- end
149
+ cases << verifiable_artifact[:include_paths].empty? && artifact[:include_paths].empty?
156
150
 
157
- def validate_artifact_path!(verifiable_artifact, potential_conflicts)
158
- raise Error::Config, code: :artifact_conflict unless begin
159
- potential_conflicts.all? do |path|
160
- loop do
161
- break if verifiable_artifact[:exclude_paths].include?(path) || ((path = File.dirname(path)) == '.')
162
- end
163
- verifiable_artifact[:exclude_paths].include?(path)
164
- end
165
- end
151
+ raise Error::Config, code: :artifact_conflict if cases.any?
166
152
  end
167
153
 
168
154
  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)
@@ -127,32 +129,6 @@ module Dapp
127
129
  def git(**kwargs)
128
130
  @git ||= Rugged::Repository.new(path.to_s, **kwargs)
129
131
  end
130
-
131
- private
132
-
133
- def ignore_path?(path, paths: [], exclude_paths: [])
134
- is_exclude_path = exclude_paths.any? { |p| check_path?(path, p) }
135
- is_include_path = begin
136
- paths.empty? ||
137
- paths.any? do |p|
138
- File.fnmatch?(p, path, File::FNM_PATHNAME) ||
139
- File.fnmatch?(File.join(p, '**', '*'), path, File::FNM_PATHNAME)
140
- end
141
- end
142
-
143
- is_exclude_path || !is_include_path
144
- end
145
-
146
- def check_path?(path, format)
147
- path_parts = path.split('/')
148
- checking_path = nil
149
-
150
- until path_parts.empty?
151
- checking_path = [checking_path, path_parts.shift].compact.join('/')
152
- return true if File.fnmatch?(format, checking_path, File::FNM_PATHNAME)
153
- end
154
- false
155
- end
156
132
  end
157
133
  end
158
134
  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.21.13'.freeze
3
- BUILD_CACHE_VERSION = 24.1
2
+ VERSION = '0.21.14'.freeze
3
+ BUILD_CACHE_VERSION = 24.2
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.21.13
4
+ version: 0.21.14
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-21 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
@@ -711,7 +711,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
711
711
  version: 2.5.0
712
712
  requirements: []
713
713
  rubyforge_project:
714
- rubygems_version: 2.6.11
714
+ rubygems_version: 2.7.6
715
715
  signing_key:
716
716
  specification_version: 4
717
717
  summary: Build docker packaged apps using chef or shell