avm-tools 0.88.0 → 0.93.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/eac_asciidoctor_base0.rb +9 -0
  3. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/apache_host.rb +1 -1
  4. data/lib/avm/eac_asciidoctor_base0/apache_path.rb +10 -0
  5. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -3
  6. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/build/file.rb +4 -4
  7. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/deploy.rb +6 -6
  8. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/instance.rb +1 -1
  9. data/lib/avm/{eac_writings_base1 → eac_asciidoctor_base0}/project.rb +1 -1
  10. data/lib/avm/eac_rails_base0/apache_path.rb +6 -38
  11. data/lib/avm/eac_webapp_base0/apache_host.rb +7 -31
  12. data/lib/avm/eac_webapp_base0/apache_path.rb +51 -0
  13. data/lib/avm/eac_webapp_base0/deploy.rb +17 -23
  14. data/lib/avm/eac_webapp_base0/deploy/appended_directories.rb +1 -1
  15. data/lib/avm/eac_webapp_base0/deploy/git_info.rb +1 -1
  16. data/lib/avm/eac_webapp_base0/instance.rb +2 -0
  17. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +7 -10
  18. data/lib/avm/eac_webapp_base0/runner/apache_path.rb +40 -0
  19. data/lib/avm/eac_webapp_base0/runner/data.rb +6 -15
  20. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +18 -24
  21. data/lib/avm/eac_webapp_base0/runner/data/load.rb +12 -23
  22. data/lib/avm/eac_webapp_base0/runner/deploy.rb +13 -21
  23. data/lib/avm/executables.rb +1 -1
  24. data/lib/avm/git/auto_commit/commit_info.rb +22 -0
  25. data/lib/avm/git/auto_commit/rules.rb +31 -0
  26. data/lib/avm/git/auto_commit/rules/base.rb +39 -0
  27. data/lib/avm/git/auto_commit/rules/last.rb +19 -0
  28. data/lib/avm/git/auto_commit/rules/manual.rb +45 -0
  29. data/lib/avm/git/auto_commit/rules/nth.rb +23 -0
  30. data/lib/avm/git/auto_commit/rules/unique.rb +21 -0
  31. data/lib/avm/git/file_auto_fixup.rb +15 -62
  32. data/lib/avm/tools/runner/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  33. data/lib/avm/tools/runner/eac_webapp_base0.rb +14 -0
  34. data/lib/avm/tools/runner/git/auto_commit.rb +12 -13
  35. data/lib/avm/tools/runner/git/auto_fixup.rb +9 -9
  36. data/lib/avm/tools/runner/git/commit.rb +11 -20
  37. data/lib/avm/tools/runner/local_project/{eac_writings_base1.rb → eac_asciidoctor_base0.rb} +2 -2
  38. data/lib/avm/tools/runner/local_project/{eac_writings_base1 → eac_asciidoctor_base0}/build.rb +5 -9
  39. data/lib/avm/tools/runner/local_project/ruby.rb +1 -1
  40. data/lib/avm/tools/runner/local_project/ruby/bundler.rb +1 -1
  41. data/lib/avm/tools/runner/local_project/ruby/bundler/gemfile_lock.rb +1 -1
  42. data/lib/avm/tools/runner/ruby.rb +6 -14
  43. data/lib/avm/tools/runner/ruby/gems.rb +4 -7
  44. data/lib/avm/tools/runner/ruby/gems/generate.rb +12 -23
  45. data/lib/avm/tools/runner/ruby/rubocop.rb +1 -1
  46. data/lib/avm/tools/version.rb +1 -1
  47. data/template/avm/eac_rails_base0/apache_path/extra_content.conf +5 -0
  48. data/template/avm/eac_webapp_base0/apache_path/default.conf +9 -0
  49. data/vendor/avm-apps/Gemfile +5 -0
  50. data/vendor/avm-apps/avm-apps.gemspec +18 -0
  51. data/{lib/avm/eac_writings_base1.rb → vendor/avm-apps/lib/avm/apps.rb} +1 -1
  52. data/vendor/avm-apps/lib/avm/apps/jobs.rb +11 -0
  53. data/vendor/avm-apps/lib/avm/apps/jobs/base.rb +64 -0
  54. data/vendor/avm-apps/lib/avm/apps/jobs/variables_source.rb +24 -0
  55. data/vendor/avm-apps/lib/avm/apps/version.rb +7 -0
  56. data/vendor/avm-apps/spec/rubocop_spec.rb +7 -0
  57. data/vendor/avm-apps/spec/spec_helper.rb +100 -0
  58. data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +4 -7
  59. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +8 -0
  60. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +21 -9
  61. data/vendor/eac_cli/lib/eac_cli/definition/base_option/initialize_args_parser.rb +47 -0
  62. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +8 -0
  63. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +12 -0
  64. data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +15 -1
  65. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +3 -17
  66. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  67. data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +4 -0
  68. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +21 -3
  69. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/local_time_zone.rb +4 -0
  70. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  71. metadata +55 -15
  72. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +0 -38
  73. data/template/avm/eac_rails_base0/apache_path/default.conf +0 -13
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/time/default_time_zone_set.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39cd843842c1fc4981f71fe88945db68e140b1aa6a7bdddeddd8b344c4215501
4
- data.tar.gz: 1fbe73dc1d4e2854e637fc6b697880e6ad192ecb62b4cad5d81612b1e8c22e88
3
+ metadata.gz: ff6d2b367a6cca1ba76094f9847bfc4155a3c9abe9665b582c572cb35567320b
4
+ data.tar.gz: 3aea3baa7f0e41dc0566d2d4411e1cf4c78e852aae4787f33d002a274dd4f3b2
5
5
  SHA512:
6
- metadata.gz: eba623387eb4320e93facda684c544565c2a3b1b0abca7902793df59416506068df6a3b6e0359e4ded1c40897cccb80629f23802dbbe9cc101e637726bf55297
7
- data.tar.gz: 4d9b78c8924c5879811517ba7089b74aa8aa5b60a35a99d00e57330431da9141a44123c68c62c191210d9df584cbb02bd881d3067302cc09f2ae3fcc893d3f32
6
+ metadata.gz: 73222b5a84ab23aacbc5088f0c9a297babcae52fa5427ebcae52053c697250ac4aa8a3e91940a4f82dd5d5f5bf39f12fb730c1d9883ae44cccf606419a241117
7
+ data.tar.gz: f76583694406760f366788cc4535095604adf4eaaf784350d425d3d820764c4a531a317fde4ddab56abd496b85895cf55dc9825046c3c4fa09059d66934d4992
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -3,7 +3,7 @@
3
3
  require 'avm/eac_webapp_base0/apache_host'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
8
  def document_root
9
9
  instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
@@ -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
@@ -4,7 +4,7 @@ require 'eac_ruby_utils/core_ext'
4
4
  require 'eac_ruby_utils/fs/clearable_directory'
5
5
 
6
6
  module Avm
7
- module EacWritingsBase1
7
+ module EacAsciidoctorBase0
8
8
  class Build
9
9
  require_sub __FILE__
10
10
  enable_console_speaker
@@ -15,6 +15,8 @@ module Avm
15
15
  self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
16
16
  end
17
17
 
18
+ SOURCE_EXTNAMES = %w[.adoc .asc].freeze
19
+
18
20
  def run
19
21
  infov 'Files to build', source_files.count
20
22
  target_directory.clear
@@ -34,9 +36,9 @@ module Avm
34
36
  def source_files_uncached
35
37
  r = []
36
38
  project.root.children.each do |child|
37
- next unless child.extname == '.asc'
39
+ next unless SOURCE_EXTNAMES.include?(child.extname)
38
40
 
39
- r << ::Avm::EacWritingsBase1::Build::File.new(self, child.basename)
41
+ r << ::Avm::EacAsciidoctorBase0::Build::File.new(self, child.basename)
40
42
  end
41
43
  r
42
44
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/executables'
3
+ require 'asciidoctor'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Build
8
8
  class File
9
9
  enable_console_speaker
@@ -11,8 +11,8 @@ module Avm
11
11
 
12
12
  def run
13
13
  infov 'Building', subpath
14
- target_path.parent.mkpath
15
- ::Avm::Executables.asciidoc.command('--out-file', target_path, source_path).system!
14
+ ::Asciidoctor.convert_file source_path.to_path,
15
+ to_file: target_path.to_path, safe: :unsafe, mkdirs: true
16
16
  end
17
17
 
18
18
  def source_path
@@ -1,23 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/eac_webapp_base0/deploy'
4
- require 'avm/eac_writings_base1/project'
5
- require 'avm/eac_writings_base1/build'
4
+ require 'avm/eac_asciidoctor_base0/project'
5
+ require 'avm/eac_asciidoctor_base0/build'
6
6
 
7
7
  module Avm
8
- module EacWritingsBase1
8
+ module EacAsciidoctorBase0
9
9
  class Deploy < ::Avm::EacWebappBase0::Deploy
10
10
  def build_content
11
- ::Avm::EacWritingsBase1::Build.new(
11
+ ::Avm::EacAsciidoctorBase0::Build.new(
12
12
  project,
13
- ::Avm::EacWritingsBase1::Build::OPTION_TARGET_DIRECTORY => build_dir
13
+ ::Avm::EacAsciidoctorBase0::Build::OPTION_TARGET_DIRECTORY => build_dir
14
14
  ).run
15
15
  end
16
16
 
17
17
  private
18
18
 
19
19
  def project_uncached
20
- ::Avm::EacWritingsBase1::Project.new(
20
+ ::Avm::EacAsciidoctorBase0::Project.new(
21
21
  instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
22
22
  )
23
23
  end
@@ -3,7 +3,7 @@
3
3
  require 'avm/eac_webapp_base0/instance'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Instance < ::Avm::EacWebappBase0::Instance
8
8
  FILES_UNITS = {}.freeze
9
9
  end
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module EacWritingsBase1
6
+ module EacAsciidoctorBase0
7
7
  class Project
8
8
  common_constructor :root do
9
9
  self.root = root.to_pathname
@@ -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,24 +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
- common_constructor :instance, :options, default: [{}]
18
+ REQUEST_TEST_JOB = 'request_test'
19
+ JOBS = (%w[create_build_dir build_content append_instance_content write_on_target
20
+ setup_files_units assert_instance_branch] + [REQUEST_TEST_JOB]).freeze
21
21
 
22
- JOBS = %w[create_build_dir build_content append_instance_content write_on_target
23
- setup_files_units assert_instance_branch request_test].freeze
24
- define_callbacks(*JOBS)
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
25
29
 
26
30
  def run
27
- start_banner
28
- run_jobs
29
- ::Avm::Result.success('Deployed')
30
- rescue ::Avm::Result::Error => e
31
- e.to_result
31
+ super
32
32
  ensure
33
33
  remove_build_dir
34
34
  end
@@ -61,18 +61,12 @@ module Avm
61
61
  fatal_error "Request to #{uri} failed" unless response.code.to_i == 200
62
62
  end
63
63
 
64
- def variables_source
65
- instance
66
- end
67
-
68
- private
64
+ protected
69
65
 
70
- def run_jobs
71
- JOBS.each do |job|
72
- run_callbacks job do
73
- send(job)
74
- end
75
- end
66
+ def jobs
67
+ r = super
68
+ r.delete(REQUEST_TEST_JOB) if options[OPTION_NO_REQUEST_TEST]
69
+ r
76
70
  end
77
71
  end
78
72
  end
@@ -17,7 +17,7 @@ module Avm
17
17
  end
18
18
 
19
19
  def appended_directories_from_options
20
- options[:appended_directories] || []
20
+ options[OPTION_APPENDED_DIRECTORIES] || []
21
21
  end
22
22
  end
23
23
  end
@@ -18,7 +18,7 @@ module Avm
18
18
  end
19
19
 
20
20
  def git_reference
21
- options[:reference] || DEFAULT_REFERENCE
21
+ options[OPTION_REFERENCE] || DEFAULT_REFERENCE
22
22
  end
23
23
 
24
24
  def git_reference_found_uncached
@@ -11,6 +11,8 @@ module Avm
11
11
  class Instance < ::Avm::Instances::Base
12
12
  include ::Avm::Postgresql::InstanceWith
13
13
 
14
+ FILES_UNITS = [].freeze
15
+
14
16
  def stereotype_name
15
17
  self.class.name.desconstantize.demodulize
16
18
  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