avm-tools 0.91.0 → 0.94.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) 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/runner/apache_host.rb +7 -10
  8. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  9. data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
  10. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  11. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  12. data/lib/avm/git/auto_commit/commit_info.rb +23 -0
  13. data/lib/avm/git/auto_commit/rules.rb +31 -0
  14. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  15. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  16. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  17. data/lib/avm/git/auto_commit/rules/new.rb +24 -0
  18. data/lib/avm/git/auto_commit/rules/nth.rb +31 -0
  19. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  20. data/lib/avm/git/auto_commit_path.rb +0 -21
  21. data/lib/avm/git/file_auto_fixup.rb +26 -57
  22. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +7 -11
  23. data/lib/avm/tools/runner/git/auto_commit.rb +30 -31
  24. data/lib/avm/tools/runner/git/commit.rb +11 -20
  25. data/lib/avm/tools/runner/git/subrepo/fix.rb +1 -1
  26. data/lib/avm/tools/runner/local_project/ruby.rb +3 -7
  27. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +4 -8
  28. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +11 -14
  29. data/lib/avm/tools/runner/ruby.rb +6 -14
  30. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  31. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  32. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  33. data/lib/avm/tools/version.rb +1 -1
  34. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  35. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  36. data/vendor/avm-apps/Gemfile +5 -0
  37. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  38. data/vendor/avm-apps/lib/avm/apps.rb +9 -0
  39. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  40. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  41. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  42. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  43. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  44. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  45. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +2 -0
  46. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  47. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  48. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
  49. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  50. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  51. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  52. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  53. data/vendor/eac_cli/lib/eac_cli/parser/alternative/short_options.rb +4 -2
  54. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  55. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
  56. data/vendor/eac_cli/lib/eac_cli/runner_with_set.rb +50 -0
  57. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  58. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  59. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  60. data/vendor/eac_git/lib/eac_git/local/dirty_files.rb +2 -3
  61. data/vendor/eac_git/lib/eac_git/version.rb +1 -1
  62. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +4 -0
  63. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +31 -0
  64. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +4 -0
  65. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +4 -0
  66. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +10 -0
  67. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +5 -0
  68. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +5 -0
  69. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +9 -0
  70. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +36 -0
  71. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +52 -0
  72. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  73. data/vendor/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +42 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +8 -2
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/settings_provider.rb +10 -0
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_nil.rb +17 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/required_zone.rb +11 -0
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  79. metadata +40 -5
  80. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  81. data/lib/avm/tools/runner/git/auto_fixup.rb +0 -53
  82. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f5aa5e8fb2a459dbf2a43a6db6c3c3e2010eafeb38f22986c2ce25f7ed59fe8
4
- data.tar.gz: a277ee83c3e5e91ad98d6427294b82f2a3183a3cf7f65e2cecd924bd8f179c74
3
+ metadata.gz: a418fd7c14cb6599e9c75eeba391a576aefb0897c6ce0f069568495cf0cb9802
4
+ data.tar.gz: 9ae79ac488f4fb96331b6d71bb7db9e943947b37577ffb725c3e10241b8b6206
5
5
  SHA512:
6
- metadata.gz: cfdf75803e0dbb82f59c7b385d8eb2947400ad05cc5e92acae171a3312e939808ec4d8b8d23423fde9c30176a21b48d79615cfd3ff403cf91a88361d5a926bbd
7
- data.tar.gz: fb6d6065157b1668e96cc612c068cee618901bdf7003b30569c85c7344cd6628da679376801804d30bea0c9ce7f62f0e773501e25942a24ca6a517acbda07c6f
6
+ metadata.gz: 4faba2cbbbcdcc77ca7a925373de53056f7e1ef8caaa183f9eb6e8ca56c4de4e77e923cfa0567f8c83995cad400a3d09d698e18a77aa95dfbca98fcf8aa1d320
7
+ data.tar.gz: 772e38b1000548d8e37bc44b2ac9380948fbeaca3706b7d7218140895765fd053e589eabe95a23e64d19c931ee7e28cc18ce865931e76536d3f8c5dd83cd0ed5
@@ -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
@@ -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,15 @@
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
+ end
22
13
  end
23
14
  end
24
15
  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