dapp 0.35.8 → 0.35.9

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
  SHA256:
3
- metadata.gz: 33bab5acf415233033262234c2d2598088a72ca24d18232334eacf07d8c2977e
4
- data.tar.gz: 59c997eff632e0ee05fb08b16e9eff632818ffee48a7c2bd79eae1f75f8b367c
3
+ metadata.gz: f580bf383e4b07e491cb75f22906262bae4610897e414e3026eadbac2d69147d
4
+ data.tar.gz: 10779775e0563815a1da1c2cf20748864d38deec3277de137c35536f1acee452
5
5
  SHA512:
6
- metadata.gz: 41bbb70dd7c36c03586a1440a7a619b4c9fd8e19fa9ee9dcea2973b8c41bca94d85b054a92d393ef1925d23ad76a52426d8fd8da46c6454689e33843f9cca5d0
7
- data.tar.gz: a0b79ff5ee6aa51da64a46e388b2639e53d79a26ac510cb762aa755b8760522dc514eee3a299dc210e15103eced837f720df0fb0c304290cbe57c51f01a5d229
6
+ metadata.gz: e21db3e15a5551e9700ec2d6e90cf29c9cd044c4be3b6368580b31309503b9f25cd121662f36b0473ec29e0239543501522045c1c90c719ec613aa70c2770ac7
7
+ data.tar.gz: 2b9641ed486716218d8240d0711acb3255171d659d0f60f5e77f4718fd13bfd114adb5f4643b08000268417bdf37458b1590f6df0516baeaafbb3f2151c83fa3
@@ -251,6 +251,7 @@ require 'dapp/dimg/dapp/command/push'
251
251
  require 'dapp/dimg/dapp/command/run'
252
252
  require 'dapp/dimg/dapp/command/spush'
253
253
  require 'dapp/dimg/dapp/command/tag'
254
+ require 'dapp/dimg/dapp/command/ruby2go_cleanup'
254
255
  require 'dapp/dimg/dapp/command/stages/common'
255
256
  require 'dapp/dimg/dapp/command/stages/cleanup_local'
256
257
  require 'dapp/dimg/dapp/command/stages/cleanup_repo'
@@ -25,6 +25,10 @@ module Dapp
25
25
  _ruby2go("git-repo", args_hash)
26
26
  end
27
27
 
28
+ def ruby2go_cleanup(args_hash)
29
+ _ruby2go("cleanup", args_hash)
30
+ end
31
+
28
32
  def ruby2go_init
29
33
  @_call_after_before_terminate << proc {
30
34
  FileUtils.rmtree(@_ruby2go_tmp_dir) if @_ruby2go_tmp_dir
@@ -3,73 +3,25 @@ module Dapp
3
3
  module Dapp
4
4
  module Command
5
5
  module Mrproper
6
- # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
7
6
  def mrproper
8
- log_step_with_indent(:mrproper) do
9
- raise ::Dapp::Error::Command, code: :mrproper_required_option if mrproper_command_without_any_option?
10
-
11
- if proper_all?
12
- proper_all
13
- elsif proper_dev_mode_cache?
14
- proper_dev_mode_cache
15
- elsif proper_cache_version?
16
- proper_cache_version
17
- end
18
-
19
- dapp_dangling_images_flush_by_label('dapp')
20
- dapp_tagless_images_flush
7
+ ruby2go_cleanup_command(:reset, ruby2go_cleanup_reset_options)
8
+ end
9
+
10
+ def ruby2go_cleanup_reset_options
11
+ {
12
+ mode: {
13
+ all: !!options[:proper_all],
14
+ dev_mode_cache: !!options[:proper_dev_mode_cache],
15
+ cache_version: proper_cache_version?
16
+ },
17
+ cache_version: ::Dapp::BUILD_CACHE_VERSION.to_s,
18
+ common_options: {
19
+ dry_run: dry_run?
20
+ },
21
+ }.tap do |json|
22
+ break JSON.dump(json)
21
23
  end
22
24
  end
23
- # rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
24
-
25
- protected
26
-
27
- def mrproper_command_without_any_option?
28
- !(proper_all? || proper_dev_mode_cache? || proper_cache_version?)
29
- end
30
-
31
- def proper_all?
32
- !!options[:proper_all]
33
- end
34
-
35
- def proper_dev_mode_cache?
36
- !!options[:proper_dev_mode_cache]
37
- end
38
-
39
- def proper_all
40
- flush_by_label('dapp')
41
- end
42
-
43
- def proper_dev_mode_cache
44
- flush_by_label('dapp-dev-mode')
45
- end
46
-
47
- def flush_by_label(label)
48
- dapp_containers_flush_by_label(label)
49
- dapp_images_flush_by_label(label)
50
- end
51
-
52
- def dapp_images_flush_by_label(label)
53
- log_step_with_indent('proper images') do
54
- remove_images(dapp_images_names_by_label(label), force: true)
55
- end
56
- end
57
-
58
- def proper_cache_version
59
- log_proper_cache do
60
- proper_cache_all_images_names.tap do |proper_cache_images|
61
- remove_images(dapp_images_names_by_label('dapp').select { |image_name| !proper_cache_images.include?(image_name) }, force: true)
62
- end
63
- end
64
- end
65
-
66
- def proper_cache_all_images_names
67
- ruby2go_image_images([{ label: "dapp" }, { label: "dapp-cache-version=#{::Dapp::BUILD_CACHE_VERSION}" }], ignore_tagless: true).map { |i| i["RepoTags"].empty? ? i["Id"] : i["RepoTags"] }.flatten
68
- end
69
-
70
- def dapp_images_names_by_label(label)
71
- ruby2go_image_images([{ label: "dapp" }, { label: label }], ignore_tagless: true).map { |i| i["RepoTags"].empty? ? i["Id"] : i["RepoTags"] }.flatten
72
- end
73
25
  end
74
26
  end
75
27
  end
@@ -0,0 +1,21 @@
1
+ module Dapp
2
+ module Dimg
3
+ module Dapp
4
+ module Command
5
+ module Ruby2GoCleanup
6
+ def ruby2go_cleanup_command(command, command_options)
7
+ options = {
8
+ command: command,
9
+ command_options: command_options,
10
+ options: { host_docker_config_dir: self.class.host_docker_config_dir }
11
+ }
12
+
13
+ ruby2go_cleanup(options).tap do |res|
14
+ raise Error::Build, code: :ruby2go_cleanup_command_failed_unexpected_error, data: { command: command, message: res["error"] } unless res["error"].nil?
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end # Dimg
21
+ end # Dapp
@@ -30,6 +30,8 @@ module Dapp
30
30
  include Command::BuildContext::Import
31
31
  include Command::BuildContext::Export
32
32
  include Command::BuildContext::Common
33
+
34
+ include Command::Ruby2GoCleanup
33
35
  end
34
36
  end
35
37
  end
@@ -1,4 +1,4 @@
1
1
  module Dapp
2
- VERSION = "0.35.8"
2
+ VERSION = "0.35.9"
3
3
  BUILD_CACHE_VERSION = 31
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.35.8
4
+ version: 0.35.9
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-10-01 00:00:00.000000000 Z
11
+ date: 2018-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -606,6 +606,7 @@ files:
606
606
  - lib/dapp/dimg/dapp/command/list.rb
607
607
  - lib/dapp/dimg/dapp/command/mrproper.rb
608
608
  - lib/dapp/dimg/dapp/command/push.rb
609
+ - lib/dapp/dimg/dapp/command/ruby2go_cleanup.rb
609
610
  - lib/dapp/dimg/dapp/command/run.rb
610
611
  - lib/dapp/dimg/dapp/command/spush.rb
611
612
  - lib/dapp/dimg/dapp/command/stage_image.rb