dapp 0.26.5 → 0.26.6

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: ccf825a07836692f74d5cc646cd70097b4523df2
4
- data.tar.gz: 7eeec05c6467aae9a5c93efcdab6e19fedec36e9
3
+ metadata.gz: 2cf103585b6af6f69328db17a5361fb4af9c78f4
4
+ data.tar.gz: f2602f349771558cfcad3320b758f1fbbaa9e766
5
5
  SHA512:
6
- metadata.gz: d61986ed6e35c8861cf2f503dd9db4abe534ea5a48ee8665598b1f9ec85c2ae7a72b0391c9b06aa8fc19583eadbf2d50add9b33f9392d673285b27c01b72e649
7
- data.tar.gz: 8a6c2d8e70fc68ffcbf0e93d97741741952988e72ea4f24f2ccc6565d5bf110671796f1f7b9f341483928e8aaaf005b2cf838dde3bf69e73e584f1067f87ed47
6
+ metadata.gz: 707366341a8cd92b8c1ca5d20d33c1bc48df7924d14d0af49a2939aa5927be075c2dbad3582ea35ea19f65f475ed5f9d2201b17c2cfb92a08bdc410c62ba5bc4
7
+ data.tar.gz: d86ff224672bb834c6076c3066b3245cf0917e0b9473bfe5aba3aebea5a9de346b74f02686540c05b2ef1f9f01acd02e33eb6470af1abb44d6649b2b7c7bd66e
@@ -37,10 +37,11 @@ module Dapp
37
37
 
38
38
  def prepare_docker_images(extra_args, **extra_fields)
39
39
  [].tap do |images|
40
- shellout!(%(#{host_docker} images --format="{{.ID}};{{.Repository}}:{{.Tag}};{{.CreatedAt}}" -f "dangling=false" -f "label=dapp=#{name}" --no-trunc #{extra_args}))
40
+ shellout!(%(#{host_docker} images --format='{{if ne "<none>" .Tag }}{{.ID}};{{.Repository}}:{{.Tag}};{{.CreatedAt}}{{ end }}' -f "dangling=false" -f "label=dapp=#{name}" --no-trunc #{extra_args}))
41
41
  .stdout
42
42
  .lines
43
43
  .map(&:strip)
44
+ .reject(&:empty?)
44
45
  .each do |l|
45
46
  id, name, created_at = l.split(';')
46
47
  images << { id: id, name: name, created_at: Time.parse(created_at), **extra_fields }
@@ -73,13 +74,19 @@ module Dapp
73
74
  remove_images_by_query(%(#{host_docker} images -f "dangling=true" -f "label=dapp" -q --no-trunc))
74
75
  end
75
76
 
77
+ def dapp_tagless_images_flush
78
+ remove_images_by_query(%(#{host_docker} images --format='{{if eq "<none>" .Tag }}{{.ID}}{{ end }}' -f "dangling=false" -f "label=dapp" -q --no-trunc))
79
+ end
80
+
76
81
  def remove_images_by_query(images_query)
77
82
  with_subquery(images_query) { |ids| remove_images(ids) }
78
83
  end
79
84
 
80
85
  def remove_images(images_ids_or_names)
81
- images_ids_or_names = ignore_used_images(images_ids_or_names.uniq)
82
- remove_base("#{host_docker} rmi%{force_option} %{ids}", images_ids_or_names, force: false)
86
+ ids_chunks(images_ids_or_names) do |chunk|
87
+ chunk = ignore_used_images(chunk)
88
+ remove_base("#{host_docker} rmi%{force_option} %{ids}", chunk, force: false)
89
+ end
83
90
  end
84
91
 
85
92
  def ignore_used_images(images_ids_or_names)
@@ -107,14 +114,20 @@ module Dapp
107
114
  end
108
115
 
109
116
  def remove_containers(ids)
110
- remove_base("#{host_docker} rm%{force_option} %{ids}", ids.uniq, force: true)
117
+ ids_chunks(ids) do |chunk|
118
+ remove_base("#{host_docker} rm%{force_option} %{ids}", chunk, force: true)
119
+ end
111
120
  end
112
121
 
113
- def remove_base(query_format, ids, force: false)
122
+ def ids_chunks(ids, &blk)
114
123
  return if ids.empty?
124
+ ids.uniq.each_slice(50, &blk)
125
+ end
126
+
127
+ def remove_base(query_format, ids, force: false)
115
128
  force_option = force ? ' -f' : ''
116
129
  log(ids.join("\n")) if log_verbose? || dry_run?
117
- ids.each_slice(50) { |chunk| run_command(format(query_format, force_option: force_option, ids: chunk.join(' '))) }
130
+ run_command(format(query_format, force_option: force_option, ids: ids.join(' ')))
118
131
  end
119
132
 
120
133
  def with_subquery(query)
@@ -17,6 +17,7 @@ module Dapp
17
17
  end
18
18
 
19
19
  dapp_dangling_images_flush
20
+ dapp_tagless_images_flush
20
21
  end
21
22
  end
22
23
  # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
@@ -72,17 +73,19 @@ module Dapp
72
73
  end
73
74
 
74
75
  def proper_cache_all_images_names
75
- shellout!(%(#{host_docker} images --format="{{.Repository}}:{{.Tag}}" -f "dangling=false" -f "label=dapp" -f "label=dapp-cache-version=#{::Dapp::BUILD_CACHE_VERSION}"))
76
+ shellout!(%(#{host_docker} images --format='{{if ne "<none>" .Tag }}{{.Repository}}:{{.Tag}}{{ end }}' -f "label=dapp" -f "label=dapp-cache-version=#{::Dapp::BUILD_CACHE_VERSION}"))
76
77
  .stdout
77
78
  .lines
78
79
  .map(&:strip)
80
+ .reject(&:empty?)
79
81
  end
80
82
 
81
83
  def dapp_images_names_by_label(label)
82
- shellout!(%(#{host_docker} images --format="{{.Repository}}:{{.Tag}}" -f "dangling=false" -f "label=dapp" -f "label=#{label}"))
84
+ shellout!(%(#{host_docker} images --format='{{if ne "<none>" .Tag }}{{.Repository}}:{{.Tag}}{{ end }}' -f "label=dapp" -f "label=#{label}"))
83
85
  .stdout
84
86
  .lines
85
87
  .map(&:strip)
88
+ .reject(&:empty?)
86
89
  end
87
90
  end
88
91
  end
@@ -121,7 +121,7 @@ module Dapp
121
121
  last_part_path = path_parts.shift
122
122
  test_path = [test_path, last_part_path].compact.join('/')
123
123
 
124
- non_match = !File.fnmatch(test_path, embedded_rel_path, File::FNM_PATHNAME)
124
+ non_match = !File.fnmatch(test_path, embedded_rel_path, File::FNM_PATHNAME|File::FNM_DOTMATCH)
125
125
  part_for_all = (last_part_path == '**')
126
126
 
127
127
  if non_match || part_for_all
@@ -232,8 +232,8 @@ module Dapp
232
232
  ignore_path_base(path, exclude_paths: exclude_paths) do
233
233
  paths.empty? ||
234
234
  paths.any? do |p|
235
- File.fnmatch?(p, path, File::FNM_PATHNAME) ||
236
- File.fnmatch?(File.join(p, '**', '*'), path, File::FNM_PATHNAME)
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
237
  end
238
238
  end
239
239
  end
@@ -29,11 +29,11 @@ module Dapp
29
29
  end
30
30
 
31
31
  def check_path?(path, format)
32
- path_checker(path) { |checking_path| File.fnmatch(format, checking_path, File::FNM_PATHNAME) }
32
+ path_checker(path) { |checking_path| File.fnmatch(format, checking_path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
33
33
  end
34
34
 
35
35
  def check_subpath?(path, format)
36
- path_checker(format) { |checking_path| File.fnmatch(checking_path, path, File::FNM_PATHNAME) }
36
+ path_checker(format) { |checking_path| File.fnmatch(checking_path, path, File::FNM_PATHNAME|File::FNM_DOTMATCH) }
37
37
  end
38
38
 
39
39
  def path_checker(path)
@@ -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.26.5"
3
- BUILD_CACHE_VERSION = 26
2
+ VERSION = "0.26.6"
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.5
4
+ version: 0.26.6
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-08 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