avm-tools 0.92.0 → 0.94.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
  3. data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
  4. data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
  5. data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  6. data/lib/avm/eac_webapp_base0/deploy.rb +12 -30
  7. data/lib/avm/eac_webapp_base0/instance.rb +5 -2
  8. data/lib/avm/eac_webapp_base0/instance/subcommand_parent.rb +24 -0
  9. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
  10. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  11. data/lib/avm/eac_webapp_base0/runner/data.rb +7 -15
  12. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  13. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  14. data/lib/avm/git/auto_commit/commit_info.rb +2 -1
  15. data/lib/avm/git/auto_commit/rules.rb +4 -4
  16. data/lib/avm/git/auto_commit/rules/new.rb +24 -0
  17. data/lib/avm/git/auto_commit/rules/nth.rb +8 -0
  18. data/lib/avm/git/auto_commit_path.rb +0 -21
  19. data/lib/avm/git/file_auto_fixup.rb +19 -3
  20. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
  21. data/lib/avm/tools/runner/git/auto_commit.rb +28 -28
  22. data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
  23. data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
  24. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +4 -8
  25. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +11 -14
  26. data/lib/avm/tools/runner/ruby.rb +6 -14
  27. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  28. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  29. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  30. data/lib/avm/tools/version.rb +1 -1
  31. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  32. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  33. data/vendor/avm-apps/Gemfile +5 -0
  34. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  35. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  36. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  37. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  38. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  39. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  40. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  41. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  42. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  43. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  44. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +20 -9
  45. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  46. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  47. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
  48. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  49. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +2 -1
  50. data/vendor/eac_cli/lib/eac_cli/runner/instance_methods.rb +8 -1
  51. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  52. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  53. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  54. data/vendor/eac_git/eac_git.gemspec +1 -0
  55. data/vendor/eac_git/lib/eac_git/local.rb +4 -0
  56. data/vendor/eac_git/lib/eac_git/local/commit.rb +53 -0
  57. data/vendor/eac_git/lib/eac_git/local/commit/changed_file.rb +46 -0
  58. data/vendor/eac_git/lib/eac_git/local/commit/diff_tree_line.rb +32 -0
  59. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
  60. data/vendor/eac_git/lib/eac_git/rspec.rb +6 -1
  61. data/{lib/avm/git/spec_helper.rb → vendor/eac_git/lib/eac_git/rspec/stubbed_git_local_repo.rb} +16 -13
  62. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  63. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec.rb +13 -0
  64. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.source.out +1 -0
  65. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/add.target.yaml +7 -0
  66. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.source.out +1 -0
  67. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/modify.target.yaml +7 -0
  68. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.source.out +1 -0
  69. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/remove.target.yaml +7 -0
  70. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.source.out +2 -0
  71. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename.target.yaml +13 -0
  72. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.source.out +2 -0
  73. data/vendor/eac_git/spec/lib/eac_git/local/commit/diff_tree_line_spec_files/rename_modify.target.yaml +13 -0
  74. data/vendor/eac_git/spec/lib/eac_git/local/commit_spec.rb +58 -0
  75. data/vendor/eac_git/spec/spec_helper.rb +1 -0
  76. data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +3 -3
  77. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  78. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  79. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  80. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  81. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  82. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  83. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  84. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
  85. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
  86. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  87. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +58 -0
  88. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  89. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  90. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +81 -0
  91. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +7 -10
  92. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +9 -2
  93. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  94. data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +1 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/logs.rb +63 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +9 -1
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +3 -2
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  100. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/kernel/nyi.rb +4 -2
  101. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  102. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +4 -2
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  104. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +10 -29
  105. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +69 -0
  106. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  107. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +8 -0
  108. metadata +55 -9
  109. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  110. data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
  111. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
  112. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +0 -30
  113. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +0 -53
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b6568f1c571107315662a90e29d111bf1af9a534c326ea57f358fa68c7ec550
4
- data.tar.gz: 808a16008057b72ef58b11d91f05e021c814bca2100f3c5e85c0363bcac97216
3
+ metadata.gz: 266e7f05ba459608c81b684bb675e5efab20d7be043e59424398a3c810cf1db9
4
+ data.tar.gz: f9b04149ba95fa4cd4b4aba277118918351727999ed1a363b4782f0cd5ffcd96
5
5
  SHA512:
6
- metadata.gz: dc0628987c36f9c72d642546a7b4ab85e3c630a239e053af92beb86658deac8fba9c7e389947b843097499fce529d2b100d734173aad36dea200d5c874a61ef8
7
- data.tar.gz: c3b19cbf0a2d063e5a436d314b5b20ab7167e584bca986c486e6ee2fd9beccfcd156e0d7095559caf0fd4236f279aeea91a81cb45207cd5b01f769e2987c85b4
6
+ metadata.gz: 1b2028e2aa894113dcbcee37742d302d1e12a363fddd5b569da22d84ea6c9e8f49ce87e9675af1bf8cef0b1a5d9e11dc94c969f61e71ff6ab1164371b145e987
7
+ data.tar.gz: 356839265fa90cc3d360af76194562840fa88aea67f0743814f22044263903fa5007b6617878610e19e43763bc5e238c6a37b697c379cccdf376ff61596ce1fa
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/apache_path'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ class ApachePath < ::Avm::EacWebappBase0::ApachePath
8
+ end
9
+ end
10
+ end
@@ -1,49 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_ubuntu_base0/apache'
3
+ require 'avm/eac_webapp_base0/apache_path'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacRailsBase0
8
- class ApachePath
9
- enable_console_speaker
10
- enable_simple_cache
11
- common_constructor :instance, :options, default: [{}]
12
-
13
- def run
14
- write_available_conf
15
- enable_conf
16
- reload_apache
17
- ::Avm::Result.success('Done')
18
- end
19
-
20
- def content
21
- template.child('default.conf').apply(instance)
22
- end
23
-
24
- private
25
-
26
- def apache_uncached
27
- ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
28
- end
29
-
30
- def enable_conf
31
- infom 'Enabling configuration...'
32
- conf.enable
33
- end
34
-
35
- def reload_apache
36
- infom 'Reloading Apache...'
37
- apache.service('reload')
38
- end
39
-
40
- def conf_uncached
41
- apache.conf(instance.id)
8
+ class ApachePath < ::Avm::EacWebappBase0::ApachePath
9
+ def document_root
10
+ ::File.join(super, 'public')
42
11
  end
43
12
 
44
- def write_available_conf
45
- infom 'Writing available configuration...'
46
- conf.write(content)
13
+ def extra_content
14
+ template.child('extra_content.conf').apply(instance)
47
15
  end
48
16
  end
49
17
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'avm/apps/jobs/base'
4
5
  require 'avm/patches/object/template'
5
6
  require 'avm/eac_ubuntu_base0/apache'
6
7
  require 'avm/patches/object/template'
@@ -8,24 +9,14 @@ require 'avm/patches/object/template'
8
9
  module Avm
9
10
  module EacWebappBase0
10
11
  class ApacheHost
11
- enable_console_speaker
12
- enable_simple_cache
13
- common_constructor :instance, :options, default: [{}]
14
-
15
- def run
16
- write_available_no_ssl_site
17
- enable_no_ssl_site
18
- remove_ssl_site
19
- reload_apache
20
- run_certbot
21
- enable_ssl_site
22
- reload_apache
23
- ::Avm::Result.success('Done')
24
- end
12
+ JOBS = %w[write_available_no_ssl_site enable_no_ssl_site remove_ssl_site reload_apache
13
+ run_certbot enable_ssl_site reload_apache].freeze
14
+ include ::Avm::Apps::Jobs::Base
25
15
 
26
16
  def no_ssl_site_content
27
- ::Avm::EacWebappBase0::ApacheHost.template.child('no_ssl.conf')
28
- .apply(EntriesReader.new(self, instance))
17
+ ::Avm::EacWebappBase0::ApacheHost
18
+ .template.child('no_ssl.conf')
19
+ .apply(variables_source)
29
20
  end
30
21
 
31
22
  def ssl?
@@ -83,21 +74,6 @@ module Avm
83
74
  infom 'Writing no SSL site conf...'
84
75
  no_ssl_site.write(no_ssl_site_content)
85
76
  end
86
-
87
- class EntriesReader
88
- common_constructor :job, :instance
89
-
90
- def read_entry(path, options = {})
91
- entry_from_job(path) || instance.read_entry(path, options)
92
- end
93
-
94
- private
95
-
96
- def entry_from_job(path)
97
- method = path.gsub('.', '_').underscore
98
- return job.send(method) if job.respond_to?(method, true)
99
- end
100
- end
101
77
  end
102
78
  end
103
79
  end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/apps/jobs/base'
4
+ require 'avm/eac_ubuntu_base0/apache'
5
+ require 'eac_ruby_utils/core_ext'
6
+
7
+ module Avm
8
+ module EacWebappBase0
9
+ class ApachePath
10
+ JOBS = %w[write_available_conf enable_conf reload_apache].freeze
11
+ include ::Avm::Apps::Jobs::Base
12
+
13
+ def content
14
+ ::Avm::EacWebappBase0::ApachePath.template.child('default.conf').apply(variables_source)
15
+ end
16
+
17
+ def document_root
18
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
19
+ end
20
+
21
+ def extra_content
22
+ ''
23
+ end
24
+
25
+ private
26
+
27
+ def apache_uncached
28
+ ::Avm::EacUbuntuBase0::Apache.new(instance.host_env)
29
+ end
30
+
31
+ def enable_conf
32
+ infom 'Enabling configuration...'
33
+ conf.enable
34
+ end
35
+
36
+ def reload_apache
37
+ infom 'Reloading Apache...'
38
+ apache.service('reload')
39
+ end
40
+
41
+ def conf_uncached
42
+ apache.conf(instance.id)
43
+ end
44
+
45
+ def write_available_conf
46
+ infom 'Writing available configuration...'
47
+ conf.write(content)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/callbacks'
4
+ require 'avm/apps/jobs/base'
4
5
  require 'avm/git'
5
6
  require 'avm/patches/object/template'
6
7
  require 'eac_ruby_utils/core_ext'
@@ -11,30 +12,23 @@ module Avm
11
12
  module EacWebappBase0
12
13
  class Deploy
13
14
  require_sub __FILE__, include_modules: true
14
- include ::ActiveSupport::Callbacks
15
15
 
16
16
  DEFAULT_REFERENCE = 'HEAD'
17
17
 
18
- enable_console_speaker
19
- enable_simple_cache
20
- enable_listable
21
- lists.add_symbol :option, :appended_directories, :no_request_test, :reference
22
- common_constructor :instance, :options, default: [{}] do
23
- self.options = ::Avm::EacWebappBase0::Deploy.lists.option
24
- .hash_keys_validate!(options.symbolize_keys)
25
- end
26
-
27
18
  REQUEST_TEST_JOB = 'request_test'
28
19
  JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
29
20
  setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
30
- define_callbacks(*JOBS)
21
+
22
+ include ::Avm::Apps::Jobs::Base
23
+
24
+ lists.add_symbol :option, :appended_directories, :no_request_test, :reference
25
+
26
+ def option_list
27
+ ::Avm::EacWebappBase0::Deploy.lists.option
28
+ end
31
29
 
32
30
  def run
33
- start_banner
34
- run_jobs
35
- ::Avm::Result.success('Deployed')
36
- rescue ::Avm::Result::Error => e
37
- e.to_result
31
+ super
38
32
  ensure
39
33
  remove_build_dir
40
34
  end
@@ -67,25 +61,13 @@ module Avm
67
61
  fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
68
62
  end
69
63
 
70
- def variables_source
71
- instance
72
- end
73
-
74
- private
64
+ protected
75
65
 
76
66
  def jobs
77
- r = JOBS.dup
67
+ r = super
78
68
  r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
79
69
  r
80
70
  end
81
-
82
- def run_jobs
83
- jobs.each do |job|
84
- run_callbacks job do
85
- send(job)
86
- end
87
- end
88
- end
89
71
  end
90
72
  end
91
73
  end
@@ -9,6 +9,7 @@ require 'avm/eac_webapp_base0/deploy/file_unit'
9
9
  module Avm
10
10
  module EacWebappBase0
11
11
  class Instance < ::Avm::Instances::Base
12
+ require_sub __FILE__
12
13
  include ::Avm::Postgresql::InstanceWith
13
14
 
14
15
  FILES_UNITS = [].freeze
@@ -26,8 +27,10 @@ module Avm
26
27
  end
27
28
 
28
29
  def run_subcommand(subcommand_class, argv)
29
- parent = ::OpenStruct.new(instance: self)
30
- subcommand_class.new(argv: argv, parent: parent).run
30
+ subcommand_class.create(
31
+ argv: argv,
32
+ parent: ::Avm::EacWebappBase0::Instance::SubcommandParent.new(self)
33
+ ).run
31
34
  end
32
35
 
33
36
  def data_package
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWebappBase0
7
+ class Instance < ::Avm::Instances::Base
8
+ class SubcommandParent
9
+ enable_simple_cache
10
+ common_constructor :instance
11
+
12
+ private
13
+
14
+ def runner_context_uncached
15
+ ::EacCli::Runner::Context.new(self, argv: runner_argv)
16
+ end
17
+
18
+ def runner_argv
19
+ [instance.class.name.split('::')[-2].dasherize, instance.id]
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,22 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
3
+ require 'avm/instances/runner'
4
+ require 'eac_cli/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacWebappBase0
8
8
  class Runner < ::Avm::Instances::Runner
9
- class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
10
- include ::EacCli::DefaultRunner
11
-
12
- runner_definition do
9
+ class ApacheHost
10
+ runner_with :help do
13
11
  desc 'Configure Apache virtual host for instance.'
14
12
  bool_opt '-c', '--certbot', 'Install certbot.'
15
13
  end
16
14
 
17
15
  def run
18
- options
19
- result = stereotype_apache_host_class.new(context(:instance),
16
+ result = stereotype_apache_host_class.new(runner_context.call(:instance),
20
17
  stereotype_apache_host_options).run
21
18
  if result.error?
22
19
  fatal_error result.to_s
@@ -26,11 +23,11 @@ module Avm
26
23
  end
27
24
 
28
25
  def stereotype_apache_host_class
29
- "#{context(:instance).class.name.deconstantize}::ApacheHost".constantize
26
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApacheHost".constantize
30
27
  end
31
28
 
32
29
  def stereotype_apache_host_options
33
- { certbot: options.fetch('--certbot') }
30
+ { certbot: parsed.certbot? }
34
31
  end
35
32
  end
36
33
  end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'avm/instances/runner'
5
+ require 'avm/eac_webapp_base0/runner/apache_host'
6
+ require 'avm/eac_rails_base0/apache_path'
7
+
8
+ module Avm
9
+ module EacWebappBase0
10
+ class Runner < ::Avm::Instances::Runner
11
+ class ApachePath
12
+ runner_with :help do
13
+ desc 'Configure Apache path configuration for instance.'
14
+ end
15
+
16
+ def run
17
+ if result.error?
18
+ fatal_error result.to_s
19
+ else
20
+ infov 'Result', result.label
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def apache_path_uncached
27
+ stereotype_apache_path_class.new(runner_context.call(:instance))
28
+ end
29
+
30
+ def result_uncached
31
+ apache_path.run
32
+ end
33
+
34
+ def stereotype_apache_path_class
35
+ "#{runner_context.call(:instance).class.name.deconstantize}::ApachePath".constantize
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,24 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/console/docopt_runner'
4
- require 'eac_ruby_utils/require_sub'
3
+ require 'eac_cli/core_ext'
5
4
 
6
5
  module Avm
7
6
  module EacWebappBase0
8
7
  class Runner < ::Avm::Instances::Runner
9
- class Data < ::EacRubyUtils::Console::DocoptRunner
10
- ::EacRubyUtils.require_sub(__FILE__)
11
-
12
- DOC = <<~DOCOPT
13
- Data utilities for EacRailsBase0 instances.
14
-
15
- Usage:
16
- __PROGRAM__ __SUBCOMMANDS__
17
- __PROGRAM__ -h | --help
18
-
19
- Options:
20
- -h --help Show this screen.
21
- DOCOPT
8
+ class Data
9
+ require_sub __FILE__
10
+ runner_with :help, :subcommands do
11
+ desc 'Data utilities for EacRailsBase0 instances.'
12
+ subcommands
13
+ end
22
14
  end
23
15
  end
24
16
  end
@@ -1,37 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/numeric/time'
4
- require 'eac_ruby_utils/console/speaker'
5
- require 'eac_ruby_utils/simple_cache'
6
3
  require 'avm/data/package/dump'
4
+ require 'eac_cli/core_ext'
7
5
 
8
6
  module Avm
9
7
  module EacWebappBase0
10
8
  class Runner < ::Avm::Instances::Runner
11
- class Data < ::EacRubyUtils::Console::DocoptRunner
12
- class Dump < ::EacRubyUtils::Console::DocoptRunner
13
- include ::EacRubyUtils::SimpleCache
14
- include ::EacRubyUtils::Console::Speaker
15
-
9
+ class Data
10
+ class Dump
16
11
  DUMP_EXPIRE_TIME = 1.day
17
12
  DEFAULT_DUMP_PATH_ENTRY_SUFFIX = 'data.default_dump_path'
18
13
  NO_DUMP_MESSAGE = 'Dump "%s" already exist and rewrite options was no setted nor ' \
19
14
  'dump was expired.'
20
15
 
21
- DOC = <<~DOCUMENT
22
- Dump utility for EacRailsBase instance.
23
-
24
- Usage:
25
- __PROGRAM__ [options]
26
-
27
- Options:
28
- -h --help Show this screen.
29
- --rewrite Forces dump overwrite.
30
- --dump-path=<dump_path> Set DUMP_PATH variable.
31
- DOCUMENT
16
+ runner_with :help do
17
+ desc 'Dump utility for EacRailsBase instance.'
18
+ bool_opt '-w', '--rewrite', 'Forces dump overwrite.'
19
+ arg_opt '-p', '--dump-path', 'Set DUMP_PATH variable.'
20
+ end
32
21
 
33
22
  def run
34
- infov 'Instance to dump', "#{context(:instance)} (#{context(:instance).class})"
23
+ infov 'Instance to dump', "#{instance} (#{instance.class})"
35
24
  if package_dump.runnable?
36
25
  package_dump.run
37
26
  else
@@ -43,20 +32,25 @@ module Avm
43
32
 
44
33
  private
45
34
 
35
+ def instance
36
+ runner_context.call(:instance)
37
+ end
38
+
46
39
  def package_dump_uncached
47
- context(:instance).data_package.dump(dump_path, existing: package_dump_existing)
40
+ instance
41
+ .data_package.dump(dump_path, existing: package_dump_existing)
48
42
  end
49
43
 
50
44
  def dump_path
51
- options.fetch('--dump-path') || default_dump_path
45
+ parsed.dump_path || default_dump_path
52
46
  end
53
47
 
54
48
  def default_dump_path
55
- context(:instance).read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
49
+ instance.read_entry(DEFAULT_DUMP_PATH_ENTRY_SUFFIX)
56
50
  end
57
51
 
58
52
  def package_dump_existing
59
- if options.fetch('--rewrite')
53
+ if parsed.rewrite?
60
54
  ::Avm::Data::Package::Dump::EXISTING_ROTATE
61
55
  else
62
56
  ::Avm::Data::Package::Dump::EXISTING_ROTATE_EXPIRED