eac_tools 0.67.0 → 0.68.0

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
  SHA256:
3
- metadata.gz: 4eaf414401edd6cd32a363aa20ae12bfd3641bfc0c11d8007911f0dfce9738e0
4
- data.tar.gz: 56e6df8b4ac42ed7f10cf7b3121d17cc825ce3c4a8e46018101f2ce71316f654
3
+ metadata.gz: f63f09025e8e8556ee1d7ff523a4b446e31d3fd41f2cbc61fba7bbf0e6d71750
4
+ data.tar.gz: 2d3999c05d5c690f2a99b50a683476f73e1dc48d280822b6b9f4ba67f36e5481
5
5
  SHA512:
6
- metadata.gz: c24f42e05720c894b99c1757654fe045ce0f306f2e2f4c5ef4fdc9477f048aa227e5d4e58c6a1d97ff90ebeede013c331152fbfa354def48591cb6b213a47ab0
7
- data.tar.gz: fd0260cb92aee69652efbab55ef85f73ab6b442966d8aeaf0a09b522db6a6dd59dd5a39c6490255878f24c801c1f9557888017c75b6ec66bc2f4ee9f045f41c2
6
+ metadata.gz: 6c2aa0133d8cffca359ad2c33d6a22e8fa6dd1753c27392674b2ec9989d1ec252f7b66450668456afcd766b38119a9afeff4ecff2bfa1e03f689354cc3d6f682
7
+ data.tar.gz: 98273baeb8b792a5196e5f22a5babae50e91832fb09e1b5734a47c22209ad93021c09821bf5cc980501fd89b9dc79acb85cbe93f12ac5386d9dbb88b4eb20b52
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.67.0)
5
- avm (~> 0.73)
4
+ eac_tools (0.68.0)
5
+ avm (~> 0.74)
6
6
  avm-eac_asciidoctor_base0 (~> 0.19)
7
7
  avm-eac_generic_base0 (~> 0.12)
8
8
  avm-eac_latex_base0 (~> 0.3, >= 0.3.1)
@@ -16,8 +16,8 @@ PATH
16
16
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
17
17
  avm-eac_webapp_base0 (~> 0.17, >= 0.17.2)
18
18
  avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
19
- avm-git (~> 0.13, >= 0.13.2)
20
- avm-tools (~> 0.149)
19
+ avm-git (~> 0.13, >= 0.13.3)
20
+ avm-tools (~> 0.150)
21
21
  eac_ruby_utils (~> 0.117)
22
22
 
23
23
  PATH
@@ -164,23 +164,23 @@ PATH
164
164
  PATH
165
165
  remote: sub/avm-git
166
166
  specs:
167
- avm-git (0.13.2)
168
- avm (~> 0.67, >= 0.67.1)
167
+ avm-git (0.13.3)
168
+ avm (~> 0.73, >= 0.73.1)
169
169
  avm-files (~> 0.6, >= 0.6.2)
170
170
  eac_git (~> 0.14, >= 0.14.1)
171
- eac_ruby_utils (~> 0.112)
171
+ eac_ruby_utils (~> 0.117)
172
172
  git (~> 1.18)
173
173
 
174
174
  PATH
175
175
  remote: sub/avm-tools
176
176
  specs:
177
- avm-tools (0.149.0)
177
+ avm-tools (0.150.0)
178
178
  aranha-parsers (~> 0.18)
179
- avm (~> 0.73)
179
+ avm (~> 0.74)
180
180
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
181
- avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
181
+ avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.3)
182
182
  avm-files (~> 0.6, >= 0.6.2)
183
- avm-git (~> 0.13, >= 0.13.2)
183
+ avm-git (~> 0.13, >= 0.13.3)
184
184
  clipboard (~> 1.3, >= 1.3.6)
185
185
  curb (~> 0.9, >= 0.9.11)
186
186
  eac_git (~> 0.14, >= 0.14.1)
@@ -192,7 +192,7 @@ PATH
192
192
  PATH
193
193
  remote: sub/avm
194
194
  specs:
195
- avm (0.73.0)
195
+ avm (0.74.0)
196
196
  aranha-parsers (~> 0.18)
197
197
  eac_cli (~> 0.35)
198
198
  eac_config (~> 0.12)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.67.0'
4
+ VERSION = '0.68.0'
5
5
  end
@@ -0,0 +1,127 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/performer'
4
+ require 'avm/data/rotate'
5
+ require 'eac_ruby_utils/core_ext'
6
+ require 'eac_ruby_utils/fs/temp'
7
+
8
+ module Avm
9
+ module Data
10
+ class Dumper < ::Avm::Data::Performer
11
+ DEFAULT_EXPIRE_TIME = 1.day
12
+
13
+ enable_speaker
14
+ enable_listable
15
+ lists.add_symbol :existing, :denied, :overwrite, :rotate, :rotate_expired
16
+ immutable_accessor :existing, :expire_time, :target_path
17
+
18
+ # @return [String, nil]
19
+ def cannot_perform_reason
20
+ return nil if !target_path.exist? ||
21
+ [EXISTING_OVERWRITE, EXISTING_ROTATE].include?(existing)
22
+
23
+ if existing == EXISTING_DENIED
24
+ 'Data exist and overwriting is denied'
25
+ elsif existing == EXISTING_ROTATE_EXPIRED && !target_path_expired?
26
+ 'Data exist and yet is not expired'
27
+ end
28
+ end
29
+
30
+ # @return [Pathname]
31
+ def default_dump_path
32
+ r = data_owner.data_default_dump_path
33
+ include_excludes_path_suffix.if_present(r) do |v|
34
+ r.basename_sub('.*') { |b| "#{b}#{v}#{r.extname}" }
35
+ end
36
+ end
37
+
38
+ # @return [Boolean]
39
+ def target_path_expired?
40
+ target_path_time.if_present(false) { |v| v >= expire_time }
41
+ end
42
+
43
+ # @return [ActiveSupport::Duration, nil]
44
+ def target_path_time
45
+ target_path.exist? ? ::Time.now - ::File.mtime(target_path) : nil
46
+ end
47
+
48
+ protected
49
+
50
+ attr_reader :temp_data_path
51
+
52
+ # @return [Array<Symbol>]
53
+ def all_units
54
+ data_owner.units.keys.sort
55
+ end
56
+
57
+ def build_temp_data_file
58
+ data_owner.dump(temp_data_path, *include_excludes_arguments)
59
+ raise "\"#{temp_data_path}\" do not exist" unless temp_data_path.exist?
60
+ raise "\"#{temp_data_path}\" is not a file" unless temp_data_path.file?
61
+ end
62
+
63
+ # @return [Array<Symbol>]
64
+ def excluded_units
65
+ excludes.map(&:to_sym).sort
66
+ end
67
+
68
+ # @return [Symbol, nil]
69
+ def existing_set_filter(value)
70
+ value.nil? ? nil : self.class.lists.existing.value_validate!(value)
71
+ end
72
+
73
+ # @return [ActiveSupport::Duration]
74
+ def expire_time_get_filter(value)
75
+ value || DEFAULT_EXPIRE_TIME
76
+ end
77
+
78
+ # @return [String]
79
+ def include_excludes_path_suffix
80
+ return nil unless data_owner.respond_to?(:units)
81
+
82
+ r = included_units.any? ? included_units : all_units
83
+ r -= excluded_units if excluded_units.any?
84
+ r.any? && r != all_units ? "_#{r.join('-')}" : ''
85
+ end
86
+
87
+ # @return [Array<Symbol>]
88
+ def included_units
89
+ includes.map(&:to_sym).sort
90
+ end
91
+
92
+ # @return [self]
93
+ def internal_perform
94
+ on_temp_data_file do
95
+ build_temp_data_file
96
+ rotate
97
+ move_data_to_target_path
98
+ end
99
+ end
100
+
101
+ def move_data_to_target_path
102
+ ::FileUtils.mv(temp_data_path, target_path.assert_parent)
103
+ end
104
+
105
+ def on_temp_data_file
106
+ ::EacRubyUtils::Fs::Temp.on_file do |file|
107
+ @temp_data_path = file.to_pathname
108
+ yield
109
+ end
110
+ end
111
+
112
+ # @return [String, nil]
113
+ def rotate
114
+ return unless target_path.exist?
115
+ return unless existing == EXISTING_ROTATE
116
+
117
+ infom "Rotating \"#{target_path}\"..."
118
+ ::Avm::Data::Rotate.new(target_path).run
119
+ end
120
+
121
+ # @return [Pathname]
122
+ def target_path_get_filter(value)
123
+ (value || default_dump_path).to_pathname
124
+ end
125
+ end
126
+ end
127
+ end
@@ -1,109 +1,43 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/data/package/base_performer'
3
4
  require 'avm/data/package/build_directory'
4
- require 'avm/data/rotate'
5
5
  require 'eac_ruby_utils/core_ext'
6
6
  require 'minitar'
7
7
 
8
8
  module Avm
9
9
  module Data
10
10
  class Package
11
- class Dump
12
- enable_speaker
13
- enable_listable
11
+ class Dump < ::Avm::Data::Package::BasePerformer
12
+ enable_method_class
14
13
  include ::Avm::Data::Package::BuildDirectory
15
14
 
16
- DEFAULT_EXPIRE_TIME = 1.day
15
+ attr_reader :target_path
17
16
 
18
- attr_reader :package, :data_file_path, :existing
19
-
20
- lists.add_string :existing, :denied, :overwrite, :rotate, :rotate_expired
21
-
22
- def initialize(package, data_file_path, options = {})
23
- @package = package
24
- @data_file_path = data_file_path
25
- options = options.to_options_consumer
26
- @existing, @expire_time = options.consume(:existing, :expire_time)
27
- options.validate
28
- self.class.lists.existing.value_validate!(@existing)
29
- end
30
-
31
- def runnable?
32
- cannot_run_reason.blank?
33
- end
34
-
35
- def cannot_run_reason
36
- return nil if !data_file_exist? ||
37
- [EXISTING_OVERWRITE, EXISTING_ROTATE].include?(existing)
38
-
39
- if existing == EXISTING_DENIED
40
- 'Data exist and overwriting is denied'
41
- elsif existing == EXISTING_ROTATE_EXPIRED && !data_file_expired?
42
- 'Data exist and yet is not expired'
43
- end
17
+ def initialize(package, target_path, options = {})
18
+ super(package, options)
19
+ @target_path = target_path.to_pathname
44
20
  end
45
21
 
46
- def run
47
- raise "Cannot run: #{cannot_run_reason}" unless runnable?
48
-
49
- package_file = on_build_directory do
22
+ # @return [void]
23
+ def result
24
+ on_build_directory do
50
25
  dump_units_to_build_directory
51
26
  create_package_file
52
27
  end
53
- rotate
54
- move_download_to_final_dest(package_file)
55
- end
56
-
57
- def data_file_exist?
58
- ::File.exist?(data_file_path)
59
- end
60
-
61
- def data_file_time
62
- data_file_exist? ? ::Time.now - ::File.mtime(data_file_path) : nil
63
- end
64
-
65
- def data_file_expired?
66
- data_file_time.if_present(false) { |v| v >= expire_time }
67
- end
68
-
69
- def expire_time
70
- @expire_time || DEFAULT_EXPIRE_TIME
71
- end
72
-
73
- private
74
-
75
- def move_download_to_final_dest(download_path)
76
- ::FileUtils.mkdir_p(::File.dirname(data_file_path))
77
- ::FileUtils.mv(download_path, data_file_path)
78
- end
79
-
80
- def rotate
81
- return unless data_file_exist?
82
- return unless existing == EXISTING_ROTATE
83
-
84
- infom "Rotating \"#{data_file_path}\"..."
85
- ::Avm::Data::Rotate.new(data_file_path).run
86
28
  end
87
29
 
88
- def new_build_path
89
- f = ::Tempfile.new(self.class.name.parameterize + '-download')
90
- path = f.path
91
- f.close
92
- f.unlink
93
- path
94
- end
30
+ protected
95
31
 
96
32
  def dump_units_to_build_directory
97
- package.dump_units_to_directory(build_directory)
33
+ package.dump_units_to_directory(build_directory, selected_units)
98
34
  end
99
35
 
100
36
  def create_package_file
101
- package_path = new_build_path
102
- infom "Creating package \"#{package_path}\" from \"#{build_directory}\"..."
37
+ infom "Creating package \"#{target_path}\" from \"#{build_directory}\"..."
103
38
  ::Dir.chdir(build_directory.to_path) do
104
- ::Minitar.pack('.', File.open(::File.expand_path(package_path), 'wb'))
39
+ ::Minitar.pack('.', ::File.open(target_path, 'wb'))
105
40
  end
106
- package_path
107
41
  end
108
42
  end
109
43
  end
@@ -32,17 +32,15 @@ module Avm
32
32
  DATA_FILE_EXTENSION
33
33
  end
34
34
 
35
- def dump(data_path, options = {})
36
- ::Avm::Data::Package::Dump.new(self, data_path, options)
37
- end
38
-
39
35
  def load(data_path)
40
36
  ::Avm::Data::Package::Load.new(self, data_path)
41
37
  end
42
38
 
43
- def dump_units_to_directory(directory)
39
+ def dump_units_to_directory(directory, selected_units = nil)
44
40
  run_callbacks :dump do
45
- units.each { |identifier, unit| unit.dump_to_directory(directory, identifier) }
41
+ (selected_units || units).each do |identifier, unit|
42
+ unit.dump_to_directory(directory, identifier)
43
+ end
46
44
  end
47
45
  end
48
46
 
@@ -7,15 +7,15 @@ module Avm
7
7
  module Instances
8
8
  class Base
9
9
  class SubcommandParent
10
+ include ::EacCli::Runner
10
11
  enable_simple_cache
11
- common_constructor :instance
12
+ common_constructor :instance do
13
+ self.runner_context = ::EacCli::Runner::Context.new(self, argv: runner_argv)
14
+ end
15
+ for_context :instance
12
16
 
13
17
  private
14
18
 
15
- def runner_context_uncached
16
- ::EacCli::Runner::Context.new(self, argv: runner_argv)
17
- end
18
-
19
19
  def runner_argv
20
20
  [instance.class.name.split('::')[-2].dasherize, instance.id]
21
21
  end
@@ -12,6 +12,11 @@ module Avm
12
12
  @instance = instance
13
13
  super options
14
14
  end
15
+
16
+ # @return [Pathname]
17
+ def data_default_dump_path
18
+ instance.data_default_dump_path.to_pathname
19
+ end
15
20
  end
16
21
  end
17
22
  end
@@ -28,6 +28,11 @@ module Avm
28
28
 
29
29
  private
30
30
 
31
+ # @return [Boolean]
32
+ def changed?
33
+ scm.changed_files.any? { |cf| cf.path == scm_relative_path }
34
+ end
35
+
31
36
  def commit_info_uncached
32
37
  rules.lazy.map { |rule| rule.with_file(self).commit_info }.find(&:present?)
33
38
  .if_present { |v| v.path(path) }
@@ -42,8 +47,13 @@ module Avm
42
47
  return false if commit_info.blank?
43
48
 
44
49
  infov ' Commit info', commit_info
45
- scm.run_commit(commit_info)
46
- success ' Commited'
50
+ if changed?
51
+ scm.run_commit(commit_info)
52
+ success ' Commited'
53
+ else
54
+ warn " File \"#{path}\" unchanged"
55
+ end
56
+
47
57
  true
48
58
  end
49
59
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.73.0'
4
+ VERSION = '0.74.0'
5
5
  end
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,locale}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.67', '>= 0.67.1'
15
+ s.add_dependency 'avm', '~> 0.73', '>= 0.73.1'
16
16
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
17
17
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
18
- s.add_dependency 'eac_ruby_utils', '~> 0.112'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.117'
19
19
  s.add_dependency 'git', '~> 1.18'
20
20
 
21
21
  s.add_development_dependency 'aranha-parsers', '~> 0.8', '>= 0.8.5'
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/git/scms/git/changed_file'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class Git < ::Avm::Scms::Base
10
+ class CommitDirty
11
+ enable_method_class
12
+ # @param commit_info [Avm::Scms::CommitInfo, nil]
13
+ common_constructor :scm, :commit_info, default: [nil]
14
+ delegate :git_repo, :head_commit, :run_commit, to: :scm
15
+
16
+ # @return [Avm::Git::Scms::Git::Commit,nil]
17
+ def result
18
+ return nil unless git_repo.dirty?
19
+
20
+ run_commit(asserted_commit_info)
21
+ head_commit
22
+ end
23
+
24
+ private
25
+
26
+ def asserted_commit_info
27
+ r = ::Avm::Scms::CommitInfo.assert(commit_info)
28
+ r = r.message(COMMIT_DIRTY_DEFAULT_MESSAGE) if r.message.blank?
29
+ git_repo.dirty_files.inject(r) { |a, e| a.path(e.absolute_path) }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -20,20 +20,6 @@ module Avm
20
20
  end
21
21
  end
22
22
 
23
- # @param commit_info [Avm::Scms::CommitInfo]
24
- # @return [Avm::Git::Scms::Git::Commit,nil]
25
- def commit_dirty(commit_info = nil)
26
- return nil unless git_repo.dirty?
27
-
28
- commit_info = ::Avm::Scms::CommitInfo.assert(commit_info)
29
- commit_info = commit_info.message(COMMIT_DIRTY_DEFAULT_MESSAGE) if
30
- commit_info.message.blank?
31
-
32
- git_repo.command('add', '.').execute!
33
- run_commit(commit_info)
34
- head_commit
35
- end
36
-
37
23
  # @param commit_info [Avm::Scms::CommitInfo]
38
24
  # @return [Avm::Git::Scms::Git::Commit,nil]
39
25
  def commit_if_change(commit_info = nil)
@@ -48,7 +48,7 @@ module Avm
48
48
  end
49
49
 
50
50
  def reset
51
- scm.git_repo.command('reset', '--soft', 'HEAD').execute!
51
+ scm.git_repo.command('reset', 'HEAD').execute!
52
52
  end
53
53
  end
54
54
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/scms/changed_file'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Git
8
+ module Scms
9
+ class GitSubBase < ::Avm::Scms::Base
10
+ class ChangedFile < ::Avm::Scms::ChangedFile
11
+ common_constructor :scm, :parent_changed_file
12
+
13
+ # @return [Pathname]
14
+ def path
15
+ parent_changed_file.path.relative_path_from(scm.relative_path_from_parent_scm)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -9,9 +9,7 @@ module Avm
9
9
  module Scms
10
10
  class GitSubBase < ::Avm::Scms::Base
11
11
  class Commit < ::Avm::Scms::Commit
12
- common_constructor :scm, :parent_commit do
13
- # parent_commit.assert_argument(::Avm::Git::Scms::Git::Commit, 'parent_commit')
14
- end
12
+ common_constructor :scm, :parent_commit
15
13
 
16
14
  delegate :deploy_to_env_path, :fixup?, :id, :merge_with, :reword, :scm_file?, :subject,
17
15
  :to_s, to: :parent_commit
@@ -9,9 +9,16 @@ module Avm
9
9
  class GitSubBase < ::Avm::Scms::Base
10
10
  enable_abstract_methods
11
11
 
12
- delegate :changed_files, :commit_if_change, :current_milestone_base_commit,
12
+ delegate :commit_if_change, :current_milestone_base_commit,
13
13
  :head_commit, :reset_and_commit, :run_commit, to: :parent_scm
14
14
 
15
+ # @return [Enumerable<Avm::Git::Scms::GitSubBase::ChangedFile>]
16
+ def changed_files
17
+ parent_scm.changed_files.map do |parent_changed_file|
18
+ ::Avm::Git::Scms::GitSubBase::ChangedFile.new(self, parent_changed_file)
19
+ end
20
+ end
21
+
15
22
  # @param from [Avm::Git::Scms::Git::Commit]
16
23
  # @param to [Avm::Git::Scms::Git::Commit]
17
24
  # @return [Avm::Git::Scms::GitSubBase::Interval]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Git
5
- VERSION = '0.13.2'
5
+ VERSION = '0.13.3'
6
6
  end
7
7
  end
@@ -15,11 +15,11 @@ Gem::Specification.new do |s|
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
17
  s.add_dependency 'aranha-parsers', '~> 0.18'
18
- s.add_dependency 'avm', '~> 0.73'
18
+ s.add_dependency 'avm', '~> 0.74'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.30', '>= 0.30.3'
20
- s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
20
+ s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.3'
21
21
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
22
- s.add_dependency 'avm-git', '~> 0.13', '>= 0.13.2'
22
+ s.add_dependency 'avm-git', '~> 0.13', '>= 0.13.3'
23
23
  s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
24
24
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
25
25
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/data/package/dump'
4
3
  require 'avm/instances/runner'
5
4
  require 'eac_cli/core_ext'
6
5
 
@@ -10,53 +9,8 @@ module Avm
10
9
  class Instance < ::Avm::Instances::Runner
11
10
  class Data
12
11
  class Dump
13
- DUMP_EXPIRE_TIME = 1.day
14
- NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
15
- 'dump was expired.'
16
-
17
- runner_with :help do
18
- desc 'Dump utility for EacRailsBase instance.'
19
- bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
20
- pos_arg :dump_path, optional: true
21
- end
22
-
23
- # @return [String]
24
- def help_extra_text
25
- "Default dump path: \"#{default_dump_path}\""
26
- end
27
-
28
- def run
29
- infov 'Instance to dump', "#{instance} (#{instance.class})"
30
- if package_dump.runnable?
31
- package_dump.run
32
- else
33
- warn(package_dump.cannot_run_reason)
34
- end
35
- success("Dump path: \"#{dump_path}\"")
36
- dump_path
37
- end
38
-
39
- private
40
-
41
- def package_dump_uncached
42
- instance
43
- .data_package.dump(dump_path, existing: package_dump_existing)
44
- end
45
-
46
- def dump_path
47
- parsed.dump_path || default_dump_path
48
- end
49
-
50
- def default_dump_path
51
- instance.data_default_dump_path
52
- end
53
-
54
- def package_dump_existing
55
- if parsed.rewrite?
56
- ::Avm::Data::Package::Dump::EXISTING_ROTATE
57
- else
58
- ::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
59
- end
12
+ runner_with :help, :include_exclude, :instance_data_dump do
13
+ desc 'Dump utility for instance.'
60
14
  end
61
15
  end
62
16
  end
@@ -10,28 +10,7 @@ module Avm
10
10
  class Data
11
11
  class Unit
12
12
  class Dump
13
- runner_with :help do
14
- pos_arg :dump_path, optional: true
15
- end
16
-
17
- def run
18
- data_owner.dump(dump_path)
19
- end
20
-
21
- # @return [String]
22
- def help_extra_text
23
- "Default dump path: \"#{default_dump_path}\""
24
- end
25
-
26
- # @return [Pathname]
27
- def dump_path
28
- (parsed.dump_path || default_dump_path).to_pathname
29
- end
30
-
31
- # @return [String]
32
- def default_dump_path
33
- data_owner.data_default_dump_path
34
- end
13
+ runner_with :help, :instance_data_dump
35
14
  end
36
15
  end
37
16
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'avm/data/clearer'
4
4
  require 'eac_cli/core_ext'
5
- require 'eac_cli/runner'
5
+ require 'avm/tools/runner_with/instance_data_performer'
6
6
 
7
7
  module Avm
8
8
  module Tools
@@ -10,19 +10,12 @@ module Avm
10
10
  module InstanceDataClear
11
11
  common_concern do
12
12
  enable_simple_cache
13
- include ::EacCli::Runner
13
+ include ::Avm::Tools::RunnerWith::InstanceDataPerformer
14
14
  end
15
15
 
16
- def run
17
- performer.perform
18
- end
19
-
20
- private
21
-
22
- def performer_uncached
23
- %i[include exclude].inject(::Avm::Data::Clearer.new(data_owner)) do |a1, e1|
24
- if_respond(e1, []).inject(a1) { |a2, e2| a2.send(e1, e2) }
25
- end
16
+ # @return [Class]
17
+ def data_performer_class
18
+ ::Avm::Data::Clearer
26
19
  end
27
20
  end
28
21
  end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/dumper'
4
+ require 'eac_cli/core_ext'
5
+ require 'avm/tools/runner_with/instance_data_performer'
6
+
7
+ module Avm
8
+ module Tools
9
+ module RunnerWith
10
+ module InstanceDataDump
11
+ common_concern do
12
+ enable_simple_cache
13
+ include ::Avm::Tools::RunnerWith::InstanceDataPerformer
14
+
15
+ runner_definition do
16
+ bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
17
+ pos_arg :dump_path, optional: true
18
+ end
19
+
20
+ set_callback :run, :after do
21
+ success("Dump path: \"#{dump_path}\"")
22
+ dump_path
23
+ end
24
+ end
25
+
26
+ DUMP_EXPIRE_TIME = 1.day
27
+ NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
28
+ 'dump was expired.'
29
+
30
+ # @return [Class]
31
+ def data_performer_class
32
+ ::Avm::Data::Dumper
33
+ end
34
+
35
+ # @return [String]
36
+ def help_extra_text
37
+ "Default dump path: \"#{default_dump_path}\""
38
+ end
39
+
40
+ private
41
+
42
+ # @return [Avm::Data::Dumper]
43
+ def data_performer_uncached
44
+ super.existing(dump_existing)
45
+ end
46
+
47
+ # @return [Pathname]
48
+ def dump_path
49
+ (parsed.dump_path || default_dump_path).to_pathname
50
+ end
51
+
52
+ def default_dump_path
53
+ data_performer.default_dump_path
54
+ end
55
+
56
+ def dump_existing
57
+ if parsed.rewrite?
58
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE
59
+ else
60
+ ::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'eac_cli/runner'
5
+
6
+ module Avm
7
+ module Tools
8
+ module RunnerWith
9
+ module InstanceDataPerformer
10
+ acts_as_abstract :data_performer_class
11
+ common_concern do
12
+ enable_simple_cache
13
+ include ::EacCli::Runner
14
+ end
15
+
16
+ def run
17
+ if data_performer.performable?
18
+ data_performer.perform
19
+ else
20
+ warn("Cannot perform: #{data_performer.cannot_perform_reason}")
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ # @return [Avm::Data::Performer]
27
+ def data_performer_uncached
28
+ %i[include exclude].inject(data_performer_class.new(data_owner)) do |a1, e1|
29
+ if_respond(e1, []).inject(a1) { |a2, e2| a2.send(e1, e2) }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.149.0'
5
+ VERSION = '0.150.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.67.0
4
+ version: 0.68.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-20 00:00:00.000000000 Z
11
+ date: 2023-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.73'
19
+ version: '0.74'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.73'
26
+ version: '0.74'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -275,7 +275,7 @@ dependencies:
275
275
  version: '0.13'
276
276
  - - ">="
277
277
  - !ruby/object:Gem::Version
278
- version: 0.13.2
278
+ version: 0.13.3
279
279
  type: :runtime
280
280
  prerelease: false
281
281
  version_requirements: !ruby/object:Gem::Requirement
@@ -285,21 +285,21 @@ dependencies:
285
285
  version: '0.13'
286
286
  - - ">="
287
287
  - !ruby/object:Gem::Version
288
- version: 0.13.2
288
+ version: 0.13.3
289
289
  - !ruby/object:Gem::Dependency
290
290
  name: avm-tools
291
291
  requirement: !ruby/object:Gem::Requirement
292
292
  requirements:
293
293
  - - "~>"
294
294
  - !ruby/object:Gem::Version
295
- version: '0.149'
295
+ version: '0.150'
296
296
  type: :runtime
297
297
  prerelease: false
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - "~>"
301
301
  - !ruby/object:Gem::Version
302
- version: '0.149'
302
+ version: '0.150'
303
303
  - !ruby/object:Gem::Dependency
304
304
  name: eac_ruby_utils
305
305
  requirement: !ruby/object:Gem::Requirement
@@ -998,11 +998,13 @@ files:
998
998
  - sub/avm-git/lib/avm/git/scms/git/commit.rb
999
999
  - sub/avm-git/lib/avm/git/scms/git/commit/deploy.rb
1000
1000
  - sub/avm-git/lib/avm/git/scms/git/commit/deploy_methods.rb
1001
+ - sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
1001
1002
  - sub/avm-git/lib/avm/git/scms/git/commits.rb
1002
1003
  - sub/avm-git/lib/avm/git/scms/git/interval.rb
1003
1004
  - sub/avm-git/lib/avm/git/scms/git/milestones.rb
1004
1005
  - sub/avm-git/lib/avm/git/scms/git/run_commit.rb
1005
1006
  - sub/avm-git/lib/avm/git/scms/git_sub_base.rb
1007
+ - sub/avm-git/lib/avm/git/scms/git_sub_base/changed_file.rb
1006
1008
  - sub/avm-git/lib/avm/git/scms/git_sub_base/commit.rb
1007
1009
  - sub/avm-git/lib/avm/git/scms/git_sub_base/interval.rb
1008
1010
  - sub/avm-git/lib/avm/git/scms/git_subrepo.rb
@@ -1095,6 +1097,8 @@ files:
1095
1097
  - sub/avm-tools/lib/avm/tools/runner_with.rb
1096
1098
  - sub/avm-tools/lib/avm/tools/runner_with/include_exclude.rb
1097
1099
  - sub/avm-tools/lib/avm/tools/runner_with/instance_data_clear.rb
1100
+ - sub/avm-tools/lib/avm/tools/runner_with/instance_data_dump.rb
1101
+ - sub/avm-tools/lib/avm/tools/runner_with/instance_data_performer.rb
1098
1102
  - sub/avm-tools/lib/avm/tools/self.rb
1099
1103
  - sub/avm-tools/lib/avm/tools/version.rb
1100
1104
  - sub/avm-tools/spec/dummy/avm-tools_stub/avm-tools.gemspec
@@ -1134,6 +1138,7 @@ files:
1134
1138
  - sub/avm/lib/avm/applications/base/stereotype.rb
1135
1139
  - sub/avm/lib/avm/data/callbacks.rb
1136
1140
  - sub/avm/lib/avm/data/clearer.rb
1141
+ - sub/avm/lib/avm/data/dumper.rb
1137
1142
  - sub/avm/lib/avm/data/package.rb
1138
1143
  - sub/avm/lib/avm/data/package/base_performer.rb
1139
1144
  - sub/avm/lib/avm/data/package/build_directory.rb