eac_tools 0.64.0 → 0.65.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: 514082c79fd68acecc065cb4bfcac5debaa5e114e3a53e64962888d0b2cb2ebd
4
- data.tar.gz: bdbc2be06b220888e839844b9562fed56431c3dd5b70ebc771a18ab5a6809ca1
3
+ metadata.gz: 47a797b3de79a663eae4d7dc4c3cdc600756b13f53386dbcd88fb4732b195eeb
4
+ data.tar.gz: 263a4b784e9cb99e1a9c023efdd2f048d4b83dfb73247300f6fe92db97c76dd7
5
5
  SHA512:
6
- metadata.gz: e6674ee3ea87209102c847f980c389666c0bc02d5e82252bc962beb86cebfa58f0bfcd8ff498ee4bdb7db79b56238953c11f1e02d40f3fa43342589a8ab5d1c6
7
- data.tar.gz: 203ae1b9a4a08408f276adf59c5dd4ba0fab61137653200a5c71f3b0620afca96b5b0500b0ec9fe7762e1fcaeed11a4d77b84e6bc46756a89c03b69f454bda46
6
+ metadata.gz: ad1076587dc04620251e5a391e0c169467aaaae2db7c725589322abad1f84c2c14e53056f07db414549e80864b3775e18105d1c3a25a7e2db2fb6c3adcaa97c8
7
+ data.tar.gz: f38150d6c56ceb13ff86d8c921fa6867a3cb65e4f36050f2fcf790558832f0b4d1641f7fefdc125a276b1cab512538668b8d30396ff5c0bf50cfc5cb0c43c3bc
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.64.0)
5
- avm (~> 0.70)
4
+ eac_tools (0.65.0)
5
+ avm (~> 0.71)
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)
9
9
  avm-eac_php_base0 (~> 0.4, >= 0.4.2)
10
- avm-eac_postgresql_base0 (~> 0.5)
10
+ avm-eac_postgresql_base0 (~> 0.5, >= 0.5.1)
11
11
  avm-eac_python_base0 (~> 0.2, >= 0.2.1)
12
12
  avm-eac_rails_base0 (~> 0.10, >= 0.10.2)
13
13
  avm-eac_rails_base1 (~> 0.8, >= 0.8.4)
@@ -17,8 +17,8 @@ PATH
17
17
  avm-eac_webapp_base0 (~> 0.17)
18
18
  avm-eac_wordpress_base0 (~> 0.3, >= 0.3.1)
19
19
  avm-git (~> 0.13, >= 0.13.2)
20
- avm-tools (~> 0.146)
21
- eac_ruby_utils (~> 0.114)
20
+ avm-tools (~> 0.147)
21
+ eac_ruby_utils (~> 0.115)
22
22
 
23
23
  PATH
24
24
  remote: sub/aranha-parsers
@@ -67,9 +67,9 @@ PATH
67
67
  PATH
68
68
  remote: sub/avm-eac_postgresql_base0
69
69
  specs:
70
- avm-eac_postgresql_base0 (0.5.0)
71
- avm (~> 0.70)
72
- eac_ruby_utils (~> 0.114)
70
+ avm-eac_postgresql_base0 (0.5.1)
71
+ avm (~> 0.71)
72
+ eac_ruby_utils (~> 0.115)
73
73
 
74
74
  PATH
75
75
  remote: sub/avm-eac_python_base0
@@ -173,9 +173,9 @@ PATH
173
173
  PATH
174
174
  remote: sub/avm-tools
175
175
  specs:
176
- avm-tools (0.146.0)
176
+ avm-tools (0.147.0)
177
177
  aranha-parsers (~> 0.17, >= 0.17.1)
178
- avm (~> 0.70)
178
+ avm (~> 0.71)
179
179
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
180
180
  avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
181
181
  avm-files (~> 0.6, >= 0.6.2)
@@ -191,14 +191,14 @@ PATH
191
191
  PATH
192
192
  remote: sub/avm
193
193
  specs:
194
- avm (0.70.0)
194
+ avm (0.71.0)
195
195
  aranha-parsers (~> 0.17, >= 0.17.1)
196
196
  eac_cli (~> 0.33)
197
197
  eac_config (~> 0.12)
198
198
  eac_docker (~> 0.7)
199
199
  eac_fs (~> 0.16)
200
200
  eac_git (~> 0.14, >= 0.14.1)
201
- eac_ruby_utils (~> 0.114)
201
+ eac_ruby_utils (~> 0.115)
202
202
  eac_templates (~> 0.5)
203
203
  filesize (~> 0.2)
204
204
  htmlbeautifier (~> 1.4, >= 1.4.2)
@@ -261,7 +261,7 @@ PATH
261
261
  PATH
262
262
  remote: sub/eac_ruby_utils
263
263
  specs:
264
- eac_ruby_utils (0.114.0)
264
+ eac_ruby_utils (0.115.0)
265
265
  activesupport (>= 4, < 7)
266
266
  addressable (~> 2.8, >= 2.8.4)
267
267
  bundler
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.64.0'
4
+ VERSION = '0.65.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency 'eac_docker', '~> 0.7'
19
19
  s.add_dependency 'eac_fs', '~> 0.16'
20
20
  s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
21
- s.add_dependency 'eac_ruby_utils', '~> 0.114'
21
+ s.add_dependency 'eac_ruby_utils', '~> 0.115'
22
22
  s.add_dependency 'eac_templates', '~> 0.5'
23
23
  s.add_dependency 'filesize', '~> 0.2'
24
24
  s.add_dependency 'htmlbeautifier', '~> 1.4', '>= 1.4.2'
@@ -46,7 +46,7 @@ module Avm
46
46
  end
47
47
 
48
48
  # @param id [Symbol]
49
- # @return [Avm::Data::Unit]
49
+ # @return [Avm::Data::UnitWithCommands]
50
50
  def unit(identifier)
51
51
  units[identifier.to_sym] || raise("No unit found with identifier \"#{identifier}\"")
52
52
  end
@@ -6,72 +6,43 @@ require 'eac_ruby_utils/core_ext'
6
6
  module Avm
7
7
  module Data
8
8
  class Unit
9
- include ::Avm::Data::Callbacks
10
-
9
+ acts_as_abstract(
10
+ do_clear: [],
11
+ do_dump: [:dump_path],
12
+ do_load: [:dump_path],
13
+ dump_path_extension: []
14
+ )
11
15
  enable_speaker
16
+ include ::Avm::Data::Callbacks
12
17
 
13
- %w[dump load].each do |action|
14
- method_name = "#{action}_command"
15
- class_eval <<~CODE, __FILE__, __LINE__ + 1
16
- # Should be overrided.
17
- # @return [EacRubyUtils::Envs::Command]
18
- def #{method_name}
19
- fail "\\"#{method_name}\\" is a abstract method. Override in #{singleton_class}."
20
- end
21
- CODE
22
- end
23
-
24
- def extension
25
- singleton_class.const_get('EXTENSION')
26
- rescue NameError
27
- ''
28
- end
29
-
30
- def name
31
- self.class
32
- end
33
-
34
- def load_from_directory(directory, identifier)
35
- load(unit_on_directory_path(directory, identifier))
36
- end
37
-
38
- def dump_to_directory(directory, identifier)
39
- dump(unit_on_directory_path(directory, identifier))
18
+ # @param dump_path [Pathname]
19
+ # @return [void]
20
+ def clear
21
+ run_callbacks(:dump) { do_clear }
40
22
  end
41
23
 
42
- def dump(data_path)
24
+ # @param dump_path [Pathname]
25
+ # @return [void]
26
+ def dump(dump_path)
43
27
  run_callbacks :dump do
44
- infom "Dumping unit \"#{name}\" to \"#{data_path}\"..."
45
- do_dump(data_path)
28
+ infom "Dumping unit \"#{name}\" to \"#{dump_path}\"..."
29
+ do_dump(dump_path)
46
30
  end
47
31
  end
48
32
 
49
- # @return [Struct(:key, :subpath), nil]
50
- def installation_files_data
51
- nil
52
- end
53
-
54
- def load(data_path)
33
+ # @param dump_path [Pathname]
34
+ # @return [void]
35
+ def load(dump_path)
55
36
  run_callbacks :load do
56
- infom "Loading unit \"#{name}\" from \"#{data_path}\"..."
57
- do_load(data_path)
37
+ clear
38
+ infom "Loading unit \"#{name}\" from \"#{dump_path}\"..."
39
+ do_load(dump_path)
58
40
  end
59
41
  end
60
42
 
61
- protected
62
-
63
- def do_dump(data_path)
64
- dump_command.execute!(output_file: data_path)
65
- end
66
-
67
- def do_load(data_path)
68
- load_command.execute!(input_file: data_path)
69
- end
70
-
71
- private
72
-
73
- def unit_on_directory_path(directory, identifier)
74
- ::File.join(directory, "#{identifier}#{extension}")
43
+ # @return [String]
44
+ def name
45
+ self.class.name
75
46
  end
76
47
  end
77
48
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/data/callbacks'
4
+ require 'avm/data/unit'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module Data
9
+ class UnitWithCommands < ::Avm::Data::Unit
10
+ acts_as_abstract
11
+
12
+ abstract_method :dump_command
13
+ abstract_method :load_command
14
+
15
+ # @return [String]
16
+ def dump_path_extension
17
+ singleton_class.const_get('EXTENSION')
18
+ rescue NameError
19
+ ''
20
+ end
21
+
22
+ def load_from_directory(directory, identifier)
23
+ load(unit_on_directory_path(directory, identifier))
24
+ end
25
+
26
+ def dump_to_directory(directory, identifier)
27
+ dump(unit_on_directory_path(directory, identifier))
28
+ end
29
+
30
+ # @return [Struct(:key, :subpath), nil]
31
+ def installation_files_data
32
+ nil
33
+ end
34
+
35
+ protected
36
+
37
+ def do_dump(data_path)
38
+ dump_command.execute!(output_file: data_path)
39
+ end
40
+
41
+ def do_load(data_path)
42
+ load_command.execute!(input_file: data_path)
43
+ end
44
+
45
+ private
46
+
47
+ def unit_on_directory_path(directory, identifier)
48
+ ::File.join(directory, "#{identifier}#{dump_path_extension}")
49
+ end
50
+ end
51
+ end
52
+ end
@@ -17,8 +17,6 @@ module Avm
17
17
  self.options = self.class.lists.option.hash_keys_validate!(options)
18
18
  end
19
19
 
20
- before_load :clear
21
-
22
20
  # @return [Pathname]
23
21
  def files_path
24
22
  fs_path_subpath
@@ -33,8 +31,7 @@ module Avm
33
31
  instance_command('tar', '-xzf', '-', '-C', files_path)
34
32
  end
35
33
 
36
- def clear
37
- infom "Removing all files under #{files_path}..."
34
+ def do_clear
38
35
  instance_command('mkdir', '-p', files_path).execute!
39
36
  instance_command('find', files_path, '-mindepth', 1, '-delete').execute!
40
37
  end
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/data/unit'
3
+ require 'avm/data/unit_with_commands'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module Instances
8
8
  module Data
9
- class Unit < ::Avm::Data::Unit
9
+ class Unit < ::Avm::Data::UnitWithCommands
10
10
  common_constructor :instance
11
11
 
12
12
  # @return [Pathname]
13
13
  def data_default_dump_path
14
14
  instance.data_default_dump_path.to_pathname.basename_sub('.*') do |b|
15
- "#{b}_#{identifier}#{extension}"
15
+ "#{b}_#{identifier}#{dump_path_extension}"
16
16
  end
17
17
  end
18
18
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.70.0'
4
+ VERSION = '0.71.0'
5
5
  end
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.70'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.114'
15
+ s.add_dependency 'avm', '~> 0.71'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.115'
17
17
 
18
18
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
19
  end
@@ -12,10 +12,7 @@ module Avm
12
12
  TABLES_SQL = "select schemaname || '#{TABLE_PARTS_SEPARATOR}' || tablename from " \
13
13
  "pg_tables where schemaname = '#{SCHEMA_VAR}'"
14
14
 
15
- before_load :clear
16
-
17
- def clear
18
- info 'Clearing database (Dropping all tables)...'
15
+ def do_clear
19
16
  ts = tables
20
17
  if ts.empty?
21
18
  info 'Database has no tables'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.5.0'
5
+ VERSION = '0.5.1'
6
6
  end
7
7
  end
@@ -15,7 +15,7 @@ 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.17', '>= 0.17.1'
18
- s.add_dependency 'avm', '~> 0.70'
18
+ s.add_dependency 'avm', '~> 0.71'
19
19
  s.add_dependency 'avm-eac_ruby_base1', '~> 0.30', '>= 0.30.2'
20
20
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
21
21
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/runner'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module Tools
8
+ class Runner
9
+ class Instance < ::Avm::Instances::Runner
10
+ class Data
11
+ class Unit
12
+ class Load
13
+ runner_with :help do
14
+ pos_arg :dump_path
15
+ end
16
+
17
+ def run
18
+ runner_context.call(:data_unit).load(dump_path)
19
+ end
20
+
21
+ # @return [Pathname]
22
+ def dump_path
23
+ parsed.dump_path.to_pathname
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.146.0'
5
+ VERSION = '0.147.0'
6
6
  end
7
7
  end
@@ -35,13 +35,34 @@ module EacRubyUtils
35
35
  end
36
36
 
37
37
  module ClassMethods
38
+ # @param name [Symbol]
39
+ # @param arguments [Enumerable<Symbol>]
40
+ # @return [void]
41
+ def abstract_method(name, *arguments)
42
+ define_method name.to_sym do |*_the_args|
43
+ raise_abstract_method(name.to_sym, arguments)
44
+ end
45
+ end
46
+
47
+ # @param methods_names [Enumerable<Object>] Each item can be a symbolizable or a hash.
48
+ # @return [void]
38
49
  def abstract_methods(*methods_names)
39
50
  methods_names.each do |method_name|
40
- define_method method_name do
41
- raise_abstract_method(method_name)
51
+ if method_name.is_a?(::Hash)
52
+ abstract_methods_from_hash(method_name)
53
+ else
54
+ abstract_method(method_name)
42
55
  end
43
56
  end
44
57
  end
58
+
59
+ private
60
+
61
+ # @param hash [Hash]
62
+ # @return [void]
63
+ def abstract_methods_from_hash(hash)
64
+ hash.each { |name, arguments| abstract_method(name, *arguments) }
65
+ end
45
66
  end
46
67
 
47
68
  module InstanceMethods
@@ -59,9 +80,9 @@ module EacRubyUtils
59
80
  self.class.abstract_methods.include?(method_name.to_sym)
60
81
  end
61
82
 
62
- def raise_abstract_method(method_name)
63
- raise ::NoMethodError, "Abstract method \"#{method_name}\" hit in \"#{self}\"" \
64
- " (Class: #{self.class})"
83
+ def raise_abstract_method(method_name, arguments = [])
84
+ raise ::NoMethodError, "Abstract method #{method_name}(#{arguments.join(', ')}) hit in " \
85
+ "#{self}\" (Class: #{self.class})"
65
86
  end
66
87
  end
67
88
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.114.0'
4
+ VERSION = '0.115.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.64.0
4
+ version: 0.65.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.70'
19
+ version: '0.71'
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.70'
26
+ version: '0.71'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,6 +99,9 @@ dependencies:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0.5'
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 0.5.1
102
105
  type: :runtime
103
106
  prerelease: false
104
107
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,6 +109,9 @@ dependencies:
106
109
  - - "~>"
107
110
  - !ruby/object:Gem::Version
108
111
  version: '0.5'
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 0.5.1
109
115
  - !ruby/object:Gem::Dependency
110
116
  name: avm-eac_python_base0
111
117
  requirement: !ruby/object:Gem::Requirement
@@ -280,28 +286,28 @@ dependencies:
280
286
  requirements:
281
287
  - - "~>"
282
288
  - !ruby/object:Gem::Version
283
- version: '0.146'
289
+ version: '0.147'
284
290
  type: :runtime
285
291
  prerelease: false
286
292
  version_requirements: !ruby/object:Gem::Requirement
287
293
  requirements:
288
294
  - - "~>"
289
295
  - !ruby/object:Gem::Version
290
- version: '0.146'
296
+ version: '0.147'
291
297
  - !ruby/object:Gem::Dependency
292
298
  name: eac_ruby_utils
293
299
  requirement: !ruby/object:Gem::Requirement
294
300
  requirements:
295
301
  - - "~>"
296
302
  - !ruby/object:Gem::Version
297
- version: '0.114'
303
+ version: '0.115'
298
304
  type: :runtime
299
305
  prerelease: false
300
306
  version_requirements: !ruby/object:Gem::Requirement
301
307
  requirements:
302
308
  - - "~>"
303
309
  - !ruby/object:Gem::Version
304
- version: '0.114'
310
+ version: '0.115'
305
311
  - !ruby/object:Gem::Dependency
306
312
  name: eac_ruby_gem_support
307
313
  requirement: !ruby/object:Gem::Requirement
@@ -1059,6 +1065,7 @@ files:
1059
1065
  - sub/avm-tools/lib/avm/tools/runner/instance/data/unit.rb
1060
1066
  - sub/avm-tools/lib/avm/tools/runner/instance/data/unit/clear.rb
1061
1067
  - sub/avm-tools/lib/avm/tools/runner/instance/data/unit/dump.rb
1068
+ - sub/avm-tools/lib/avm/tools/runner/instance/data/unit/load.rb
1062
1069
  - sub/avm-tools/lib/avm/tools/runner/instance/info.rb
1063
1070
  - sub/avm-tools/lib/avm/tools/runner/launcher.rb
1064
1071
  - sub/avm-tools/lib/avm/tools/runner/launcher/instances.rb
@@ -1124,6 +1131,7 @@ files:
1124
1131
  - sub/avm/lib/avm/data/package/load.rb
1125
1132
  - sub/avm/lib/avm/data/rotate.rb
1126
1133
  - sub/avm/lib/avm/data/unit.rb
1134
+ - sub/avm/lib/avm/data/unit_with_commands.rb
1127
1135
  - sub/avm/lib/avm/docker.rb
1128
1136
  - sub/avm/lib/avm/docker/container.rb
1129
1137
  - sub/avm/lib/avm/docker/image.rb