eac_tools 0.62.1 → 0.64.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +33 -33
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +2 -2
  5. data/sub/avm/lib/avm/data/package.rb +11 -0
  6. data/sub/avm/lib/avm/instances/base/subcommand_parent.rb +25 -0
  7. data/sub/avm/lib/avm/instances/data/files_unit.rb +2 -2
  8. data/sub/avm/lib/avm/instances/data/unit.rb +12 -0
  9. data/sub/avm/lib/avm/instances/entry_keys.rb +1 -0
  10. data/sub/avm/lib/avm/version.rb +1 -1
  11. data/sub/avm-eac_postgresql_base0/Gemfile +3 -0
  12. data/sub/avm-eac_postgresql_base0/avm-eac_postgresql_base0.gemspec +3 -3
  13. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance/data_unit.rb +16 -16
  14. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance.rb +0 -4
  15. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/instance_with.rb +5 -0
  16. data/sub/avm-eac_postgresql_base0/lib/avm/eac_postgresql_base0/version.rb +1 -1
  17. data/sub/avm-eac_webapp_base0/avm-eac_webapp_base0.gemspec +3 -3
  18. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base.rb +2 -10
  19. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners/data/load.rb +3 -1
  20. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/version.rb +1 -1
  21. data/sub/avm-tools/avm-tools.gemspec +11 -11
  22. data/sub/{avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners → avm-tools/lib/avm/tools/runner/instance}/data/dump.rb +11 -6
  23. data/sub/avm-tools/lib/avm/tools/runner/instance/data/load.rb +58 -0
  24. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/clear.rb +24 -0
  25. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit/dump.rb +41 -0
  26. data/sub/avm-tools/lib/avm/tools/runner/instance/data/unit.rb +42 -0
  27. data/sub/{avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/runners → avm-tools/lib/avm/tools/runner/instance}/data.rb +4 -3
  28. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  29. data/sub/eac_cli/eac_cli.gemspec +1 -1
  30. data/sub/eac_cli/lib/eac_cli/definition/base_option.rb +3 -1
  31. data/sub/eac_cli/lib/eac_cli/definition/default_value.rb +17 -0
  32. data/sub/eac_cli/lib/eac_cli/runner_with/help/builder.rb +22 -23
  33. data/sub/eac_cli/lib/eac_cli/runner_with/help/layout.rb +40 -0
  34. data/sub/eac_cli/lib/eac_cli/runner_with/help.rb +15 -4
  35. data/sub/eac_cli/lib/eac_cli/runner_with/input.rb +1 -1
  36. data/sub/eac_cli/lib/eac_cli/runner_with/output.rb +1 -1
  37. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +2 -2
  38. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  39. data/sub/eac_cli/spec/lib/eac_cli/runner_with/help/layout_spec.rb +21 -0
  40. data/sub/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +0 -1
  41. data/sub/eac_ruby_utils/eac_ruby_utils.gemspec +1 -1
  42. data/sub/eac_ruby_utils/lib/eac_ruby_utils/{abstract_methods.rb → acts_as_abstract.rb} +4 -4
  43. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/class/abstract.rb +2 -2
  44. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +3 -3
  45. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/module/acts_as_abstract.rb +14 -0
  46. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +5 -1
  47. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +14 -1
  48. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +2 -11
  49. data/sub/eac_ruby_utils/lib/eac_ruby_utils/speaker/receiver.rb +2 -2
  50. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  51. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{abstract_methods_spec.rb → acts_as_abstract_spec.rb} +2 -2
  52. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/abstract_spec.rb +1 -1
  53. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/class/acts_as_abstract_spec.rb +14 -0
  54. metadata +26 -29
  55. data/sub/avm-eac_webapp_base0/lib/avm/eac_webapp_base0/instances/base/subcommand_parent.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34c1534552adb0067a16227d3ed1088b61edcc7a7696e64e4f4cf93d6b14e445
4
- data.tar.gz: a29798e301ac321eab2959b93856c2d76bc54577af236c7210fc127fc42d5df7
3
+ metadata.gz: 514082c79fd68acecc065cb4bfcac5debaa5e114e3a53e64962888d0b2cb2ebd
4
+ data.tar.gz: bdbc2be06b220888e839844b9562fed56431c3dd5b70ebc771a18ab5a6809ca1
5
5
  SHA512:
6
- metadata.gz: e6ad6ea56a99b6e12570f34c1400e21e93d300b88f3339d57881196dbdad10a14389434d2615364b69d200aad9c13e393d1f7fabf643572130c5d71c3908ebc2
7
- data.tar.gz: a63d5fc42089b05134fe217d3f242866812a47efaffac71e231c624e898c74724de4f2f42cc251a33c1d9b92a061b14e5d51a4e46add3a810a4bbadbc4223786
6
+ metadata.gz: e6674ee3ea87209102c847f980c389666c0bc02d5e82252bc962beb86cebfa58f0bfcd8ff498ee4bdb7db79b56238953c11f1e02d40f3fa43342589a8ab5d1c6
7
+ data.tar.gz: 203ae1b9a4a08408f276adf59c5dd4ba0fab61137653200a5c71f3b0620afca96b5b0500b0ec9fe7762e1fcaeed11a4d77b84e6bc46756a89c03b69f454bda46
data/Gemfile.lock CHANGED
@@ -1,24 +1,24 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.62.1)
5
- avm (~> 0.68)
4
+ eac_tools (0.64.0)
5
+ avm (~> 0.70)
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.3)
10
+ avm-eac_postgresql_base0 (~> 0.5)
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)
14
14
  avm-eac_redmine_base0 (~> 0.20, >= 0.20.1)
15
15
  avm-eac_redmine_plugin_base0 (~> 0.4)
16
16
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
17
- avm-eac_webapp_base0 (~> 0.15, >= 0.15.1)
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.145, >= 0.145.1)
21
- eac_ruby_utils (~> 0.112)
20
+ avm-tools (~> 0.146)
21
+ eac_ruby_utils (~> 0.114)
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.3.0)
71
- avm (~> 0.68)
72
- eac_ruby_utils (~> 0.112)
70
+ avm-eac_postgresql_base0 (0.5.0)
71
+ avm (~> 0.70)
72
+ eac_ruby_utils (~> 0.114)
73
73
 
74
74
  PATH
75
75
  remote: sub/avm-eac_python_base0
@@ -134,13 +134,13 @@ PATH
134
134
  PATH
135
135
  remote: sub/avm-eac_webapp_base0
136
136
  specs:
137
- avm-eac_webapp_base0 (0.15.1)
138
- avm (~> 0.68)
137
+ avm-eac_webapp_base0 (0.17.0)
138
+ avm (~> 0.70)
139
139
  avm-eac_generic_base0 (~> 0.12)
140
- avm-eac_postgresql_base0 (~> 0.3)
140
+ avm-eac_postgresql_base0 (~> 0.5)
141
141
  avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
142
142
  avm-files (~> 0.6, >= 0.6.2)
143
- eac_ruby_utils (~> 0.112)
143
+ eac_ruby_utils (~> 0.114)
144
144
 
145
145
  PATH
146
146
  remote: sub/avm-eac_wordpress_base0
@@ -173,32 +173,32 @@ PATH
173
173
  PATH
174
174
  remote: sub/avm-tools
175
175
  specs:
176
- avm-tools (0.145.1)
177
- aranha-parsers (~> 0.14, >= 0.14.4)
178
- avm (~> 0.62)
179
- avm-eac_ruby_base1 (~> 0.29)
180
- avm-eac_ubuntu_base0 (~> 0.4)
181
- avm-files (~> 0.6)
182
- avm-git (~> 0.12)
176
+ avm-tools (0.146.0)
177
+ aranha-parsers (~> 0.17, >= 0.17.1)
178
+ avm (~> 0.70)
179
+ avm-eac_ruby_base1 (~> 0.30, >= 0.30.2)
180
+ avm-eac_ubuntu_base0 (~> 0.4, >= 0.4.2)
181
+ avm-files (~> 0.6, >= 0.6.2)
182
+ avm-git (~> 0.13, >= 0.13.2)
183
183
  clipboard (~> 1.3, >= 1.3.6)
184
184
  curb (~> 0.9, >= 0.9.11)
185
- eac_git (~> 0.14)
186
- eac_ruby_base0 (~> 0.17, >= 0.17.2)
187
- eac_templates (~> 0.3, >= 0.3.2)
188
- git (~> 1.13, >= 1.13.1)
189
- ruby-progressbar (~> 1.11)
185
+ eac_git (~> 0.14, >= 0.14.1)
186
+ eac_ruby_base0 (~> 0.18)
187
+ eac_templates (~> 0.5)
188
+ git (~> 1.18)
189
+ ruby-progressbar (~> 1.13)
190
190
 
191
191
  PATH
192
192
  remote: sub/avm
193
193
  specs:
194
- avm (0.68.0)
194
+ avm (0.70.0)
195
195
  aranha-parsers (~> 0.17, >= 0.17.1)
196
- eac_cli (~> 0.31)
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.112)
201
+ eac_ruby_utils (~> 0.114)
202
202
  eac_templates (~> 0.5)
203
203
  filesize (~> 0.2)
204
204
  htmlbeautifier (~> 1.4, >= 1.4.2)
@@ -207,10 +207,10 @@ PATH
207
207
  PATH
208
208
  remote: sub/eac_cli
209
209
  specs:
210
- eac_cli (0.31.0)
210
+ eac_cli (0.33.0)
211
211
  colorize (~> 0.8, >= 0.8.1)
212
212
  eac_config (~> 0.12)
213
- eac_ruby_utils (~> 0.112)
213
+ eac_ruby_utils (~> 0.114)
214
214
 
215
215
  PATH
216
216
  remote: sub/eac_config
@@ -261,9 +261,9 @@ PATH
261
261
  PATH
262
262
  remote: sub/eac_ruby_utils
263
263
  specs:
264
- eac_ruby_utils (0.112.0)
264
+ eac_ruby_utils (0.114.0)
265
265
  activesupport (>= 4, < 7)
266
- addressable (~> 2.8, >= 2.8.1)
266
+ addressable (~> 2.8, >= 2.8.4)
267
267
  bundler
268
268
  filesize (~> 0.2)
269
269
  net-ssh (~> 4.2)
@@ -335,7 +335,7 @@ GEM
335
335
  minitest (5.18.0)
336
336
  multipart-post (2.3.0)
337
337
  net-ssh (4.2.0)
338
- nokogiri (1.14.3-x86_64-linux)
338
+ nokogiri (1.14.4-x86_64-linux)
339
339
  racc (~> 1.4)
340
340
  ofx-parser (1.1.0)
341
341
  hpricot (>= 0.6)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.62.1'
4
+ VERSION = '0.64.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
16
- s.add_dependency 'eac_cli', '~> 0.31'
16
+ s.add_dependency 'eac_cli', '~> 0.33'
17
17
  s.add_dependency 'eac_config', '~> 0.12'
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.112'
21
+ s.add_dependency 'eac_ruby_utils', '~> 0.114'
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'
@@ -45,9 +45,20 @@ module Avm
45
45
  end
46
46
  end
47
47
 
48
+ # @param id [Symbol]
49
+ # @return [Avm::Data::Unit]
50
+ def unit(identifier)
51
+ units[identifier.to_sym] || raise("No unit found with identifier \"#{identifier}\"")
52
+ end
53
+
48
54
  def units
49
55
  @units ||= {}
50
56
  end
57
+
58
+ # @return [Enumerable<String>]
59
+ def units_ids
60
+ units.keys
61
+ end
51
62
  end
52
63
  end
53
64
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/runner/context'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Instances
8
+ class Base
9
+ class SubcommandParent
10
+ enable_simple_cache
11
+ common_constructor :instance
12
+
13
+ private
14
+
15
+ def runner_context_uncached
16
+ ::EacCli::Runner::Context.new(self, argv: runner_argv)
17
+ end
18
+
19
+ def runner_argv
20
+ [instance.class.name.split('::')[-2].dasherize, instance.id]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -17,7 +17,7 @@ module Avm
17
17
  self.options = self.class.lists.option.hash_keys_validate!(options)
18
18
  end
19
19
 
20
- before_load :clear_files
20
+ before_load :clear
21
21
 
22
22
  # @return [Pathname]
23
23
  def files_path
@@ -33,7 +33,7 @@ module Avm
33
33
  instance_command('tar', '-xzf', '-', '-C', files_path)
34
34
  end
35
35
 
36
- def clear_files
36
+ def clear
37
37
  infom "Removing all files under #{files_path}..."
38
38
  instance_command('mkdir', '-p', files_path).execute!
39
39
  instance_command('find', files_path, '-mindepth', 1, '-delete').execute!
@@ -8,6 +8,18 @@ module Avm
8
8
  module Data
9
9
  class Unit < ::Avm::Data::Unit
10
10
  common_constructor :instance
11
+
12
+ # @return [Pathname]
13
+ def data_default_dump_path
14
+ instance.data_default_dump_path.to_pathname.basename_sub('.*') do |b|
15
+ "#{b}_#{identifier}#{extension}"
16
+ end
17
+ end
18
+
19
+ # @return [String]
20
+ def identifier
21
+ instance.data_package.units.key(self) || raise("No identifier found for #{self}")
22
+ end
11
23
  end
12
24
  end
13
25
  end
@@ -28,6 +28,7 @@ module Avm
28
28
  {
29
29
  '' => %w[name source_instance_id],
30
30
  admin: URI_FIELDS + %w[api_key],
31
+ data: %w[default_dump_path],
31
32
  database: URI_FIELDS + %w[id limit name system timeout extra],
32
33
  docker: %w[registry],
33
34
  install: URI_FIELDS + %w[id data_path email groupname],
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.68.0'
4
+ VERSION = '0.70.0'
5
5
  end
@@ -3,3 +3,6 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -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.68'
16
- s.add_dependency 'eac_ruby_utils', '~> 0.112'
15
+ s.add_dependency 'avm', '~> 0.70'
16
+ s.add_dependency 'eac_ruby_utils', '~> 0.114'
17
17
 
18
- s.add_development_dependency 'eac_ruby_gem_support', '~> 0.4'
18
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
19
19
  end
@@ -12,14 +12,25 @@ 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_database
15
+ before_load :clear
16
+
17
+ def clear
18
+ info 'Clearing database (Dropping all tables)...'
19
+ ts = tables
20
+ if ts.empty?
21
+ info 'Database has no tables'
22
+ else
23
+ info "Removing #{ts.count} table(s)..."
24
+ run_sql(drop_tables_sql(ts))
25
+ end
26
+ end
16
27
 
17
28
  def dump_command
18
- instance.dump_gzip_command
29
+ instance.pg.dump_gzip_command
19
30
  end
20
31
 
21
32
  def load_command
22
- instance.load_gzip_command
33
+ instance.pg.load_gzip_command
23
34
  end
24
35
 
25
36
  private
@@ -30,17 +41,6 @@ module Avm
30
41
  'drop table ' + table_list.map(&:to_s).join(', ') + ' cascade'
31
42
  end
32
43
 
33
- def clear_database
34
- info 'Clearing database (Dropping all tables)...'
35
- ts = tables
36
- if ts.empty?
37
- info 'Database has no tables'
38
- else
39
- info "Removing #{ts.count} table(s)..."
40
- run_sql(drop_tables_sql(ts))
41
- end
42
- end
43
-
44
44
  # @param parts [Array<String>, Strings]
45
45
  # @return [String]
46
46
  def join_table_parts(parts)
@@ -49,7 +49,7 @@ module Avm
49
49
  end
50
50
 
51
51
  def run_sql(sql)
52
- instance.psql_command_command(sql).execute!
52
+ instance.pg.psql_command_command(sql).execute!
53
53
  end
54
54
 
55
55
  # @return [Array<String>]
@@ -60,7 +60,7 @@ module Avm
60
60
 
61
61
  # @return [String]
62
62
  def tables_sql
63
- TABLES_SQL.gsub(SCHEMA_VAR, instance.schema)
63
+ TABLES_SQL.gsub(SCHEMA_VAR, instance.pg.schema)
64
64
  end
65
65
  end
66
66
  end
@@ -21,10 +21,6 @@ module Avm
21
21
  ::Avm::EacPostgresqlBase0::Instance::Assert.new(self).perform
22
22
  end
23
23
 
24
- def data_unit
25
- ::Avm::EacPostgresqlBase0::Instance::DataUnit.new(self)
26
- end
27
-
28
24
  def host
29
25
  connection_params[:host] || DEFAULT_HOSTNAME
30
26
  end
@@ -15,6 +15,11 @@ module Avm
15
15
  name: database_name
16
16
  )
17
17
  end
18
+
19
+ # @return [Avm::EacPostgresqlBase0::Instance::DataUnit]
20
+ def pg_data_unit
21
+ ::Avm::EacPostgresqlBase0::Instance::DataUnit.new(self)
22
+ end
18
23
  end
19
24
  end
20
25
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacPostgresqlBase0
5
- VERSION = '0.3.0'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
@@ -12,12 +12,12 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.files = Dir['{lib,template}/**/*']
14
14
 
15
- s.add_dependency 'avm', '~> 0.68'
15
+ s.add_dependency 'avm', '~> 0.70'
16
16
  s.add_dependency 'avm-eac_generic_base0', '~> 0.12'
17
- s.add_dependency 'avm-eac_postgresql_base0', '~> 0.3'
17
+ s.add_dependency 'avm-eac_postgresql_base0', '~> 0.5'
18
18
  s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
19
19
  s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
20
- s.add_dependency 'eac_ruby_utils', '~> 0.112'
20
+ s.add_dependency 'eac_ruby_utils', '~> 0.114'
21
21
 
22
22
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.2'
23
23
  end
@@ -15,18 +15,10 @@ module Avm
15
15
  include ::Avm::EacPostgresqlBase0::InstanceWith
16
16
  enable_simple_cache
17
17
 
18
- def data_dump(argv = [])
19
- run_subcommand(data_dump_runner_class, argv)
20
- end
21
-
22
- def data_dump_runner_class
23
- ::Avm::EacWebappBase0::Instances::Runners::Data::Dump
24
- end
25
-
26
18
  def run_subcommand(subcommand_class, argv)
27
19
  subcommand_class.create(
28
20
  argv: argv,
29
- parent: ::Avm::EacWebappBase0::Instances::Base::SubcommandParent.new(self)
21
+ parent: ::Avm::Instances::Base::SubcommandParent.new(self)
30
22
  ).run
31
23
  end
32
24
 
@@ -41,7 +33,7 @@ module Avm
41
33
  end
42
34
 
43
35
  def database_unit
44
- pg.data_unit
36
+ pg_data_unit
45
37
  end
46
38
 
47
39
  private
@@ -33,7 +33,9 @@ module Avm
33
33
  end
34
34
 
35
35
  def source_instance_dump_path
36
- runner_context.call(:instance).class.by_id(parsed.source_instance).data_dump
36
+ runner_context.call(:instance).class.by_id(parsed.source_instance).run_subcommand(
37
+ ::Avm::EacWebappBase0::Instances::Runners::Data::Dump, []
38
+ )
37
39
  end
38
40
 
39
41
  def load_dump
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacWebappBase0
5
- VERSION = '0.15.1'
5
+ VERSION = '0.17.0'
6
6
  end
7
7
  end
@@ -14,19 +14,19 @@ Gem::Specification.new do |s|
14
14
  s.bindir = 'exe'
15
15
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
16
16
 
17
- s.add_dependency 'aranha-parsers', '~> 0.14', '>= 0.14.4'
18
- s.add_dependency 'avm', '~> 0.62'
19
- s.add_dependency 'avm-eac_ruby_base1', '~> 0.29'
20
- s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4'
21
- s.add_dependency 'avm-files', '~> 0.6'
22
- s.add_dependency 'avm-git', '~> 0.12'
17
+ s.add_dependency 'aranha-parsers', '~> 0.17', '>= 0.17.1'
18
+ s.add_dependency 'avm', '~> 0.70'
19
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.30', '>= 0.30.2'
20
+ s.add_dependency 'avm-eac_ubuntu_base0', '~> 0.4', '>= 0.4.2'
21
+ s.add_dependency 'avm-files', '~> 0.6', '>= 0.6.2'
22
+ s.add_dependency 'avm-git', '~> 0.13', '>= 0.13.2'
23
23
  s.add_dependency 'clipboard', '~> 1.3', '>= 1.3.6'
24
24
  s.add_dependency 'curb', '~> 0.9', '>= 0.9.11'
25
- s.add_dependency 'eac_git', '~> 0.14'
26
- s.add_dependency 'eac_ruby_base0', '~> 0.17', '>= 0.17.2'
27
- s.add_dependency 'eac_templates', '~> 0.3', '>= 0.3.2'
28
- s.add_dependency 'git', '~> 1.13', '>= 1.13.1'
29
- s.add_dependency 'ruby-progressbar', '~> 1.11'
25
+ s.add_dependency 'eac_git', '~> 0.14', '>= 0.14.1'
26
+ s.add_dependency 'eac_ruby_base0', '~> 0.18'
27
+ s.add_dependency 'eac_templates', '~> 0.5'
28
+ s.add_dependency 'git', '~> 1.18'
29
+ s.add_dependency 'ruby-progressbar', '~> 1.13'
30
30
 
31
31
  s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5.1'
32
32
  end
@@ -1,23 +1,28 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/data/package/dump'
4
+ require 'avm/instances/runner'
4
5
  require 'eac_cli/core_ext'
5
6
 
6
7
  module Avm
7
- module EacWebappBase0
8
- module Instances
9
- module Runners
8
+ module Tools
9
+ class Runner
10
+ class Instance < ::Avm::Instances::Runner
10
11
  class Data
11
12
  class Dump
12
13
  DUMP_EXPIRE_TIME = 1.day
13
- DEFAULT_DUMP_PATH_ENTRY_SUFFIX = 'data.default_dump_path'
14
14
  NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
15
15
  'dump was expired.'
16
16
 
17
17
  runner_with :help do
18
18
  desc 'Dump utility for EacRailsBase instance.'
19
19
  bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
20
- arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
20
+ pos_arg :dump_path
21
+ end
22
+
23
+ # @return [String]
24
+ def help_extra_text
25
+ "Default dump path: \"#{default_dump_path}\""
21
26
  end
22
27
 
23
28
  def run
@@ -47,7 +52,7 @@ module Avm
47
52
  end
48
53
 
49
54
  def default_dump_path
50
- instance.read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
55
+ instance.data_default_dump_path
51
56
  end
52
57
 
53
58
  def package_dump_existing
@@ -0,0 +1,58 @@
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 Load
12
+ runner_with :help do
13
+ desc 'Load utility for EacRailsBase instance.'
14
+ arg_opt '-S', '--source-instance', 'Informa a instância a ser extraída o dump.'
15
+ pos_arg :dump_path, optional: true
16
+ end
17
+
18
+ def run
19
+ return fatal_error("Dump \"#{dump_path}\" does not exist") unless
20
+ ::File.exist?(dump_path)
21
+
22
+ load_dump
23
+ success("Dump loaded from \"#{dump_path}\"")
24
+ end
25
+
26
+ def dump_path_uncached
27
+ return parsed.dump_path.to_s if parsed.dump_path.present?
28
+ return source_instance_dump_path if parsed.source_instance.present?
29
+
30
+ raise "Dump path unknown (Options: #{parsed})"
31
+ end
32
+
33
+ def source_instance_dump_path
34
+ runner_context.call(:instance).class.by_id(parsed.source_instance).run_subcommand(
35
+ ::Avm::Tools::Runner::Instance::Data::Dump, []
36
+ )
37
+ end
38
+
39
+ def load_dump
40
+ info "Loading dump \"#{dump_path}\"..."
41
+ package_load.run
42
+ end
43
+
44
+ def dump_instance_method
45
+ :dump_database
46
+ end
47
+
48
+ private
49
+
50
+ def package_load_uncached
51
+ runner_context.call(:instance).data_package.load(dump_path)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,24 @@
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 Clear
13
+ runner_with :help
14
+
15
+ def run
16
+ runner_context.call(:data_unit).clear
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,41 @@
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 Dump
13
+ runner_with :help do
14
+ pos_arg :dump_path, optional: true
15
+ end
16
+
17
+ def run
18
+ runner_context.call(:data_unit).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
+ runner_context.call(:data_unit).data_default_dump_path
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end