avm-tools 0.70.2 → 0.74.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/{stereotypes/eac_rails_base0.rb → eac_rails_base0.rb} +1 -3
  3. data/lib/avm/eac_rails_base0/instance.rb +2 -5
  4. data/lib/avm/{rails/runners.rb → eac_rails_base1.rb} +2 -4
  5. data/lib/avm/eac_rails_base1/instance.rb +24 -0
  6. data/lib/avm/eac_rails_base1/runner.rb +12 -0
  7. data/lib/avm/eac_rails_base1/runner/bundle.rb +28 -0
  8. data/lib/avm/eac_rails_base1/runner/code_runner.rb +28 -0
  9. data/lib/avm/eac_rails_base1/runner_with/bundle.rb +57 -0
  10. data/lib/avm/{stereotypes/rails.rb → eac_redmine_base0.rb} +2 -4
  11. data/lib/avm/eac_redmine_base0/instance.rb +2 -4
  12. data/lib/avm/{stereotypes/eac_ubuntu_base0.rb → eac_ubuntu_base0.rb} +1 -3
  13. data/lib/avm/{stereotypes/eac_webapp_base0.rb → eac_webapp_base0.rb} +1 -3
  14. data/lib/avm/eac_webapp_base0/instance.rb +2 -2
  15. data/lib/avm/eac_webapp_base0/runner.rb +12 -0
  16. data/lib/avm/eac_webapp_base0/runner/apache_host.rb +2 -3
  17. data/lib/avm/eac_webapp_base0/runner/data.rb +1 -1
  18. data/lib/avm/eac_webapp_base0/runner/data/dump.rb +1 -1
  19. data/lib/avm/eac_webapp_base0/runner/data/load.rb +1 -1
  20. data/lib/avm/eac_webapp_base0/runner/deploy.rb +3 -16
  21. data/lib/avm/eac_wordpress_base0.rb +9 -0
  22. data/lib/avm/eac_wordpress_base0/apache_host.rb +25 -0
  23. data/lib/avm/eac_wordpress_base0/deploy.rb +10 -0
  24. data/lib/avm/eac_wordpress_base0/instance.rb +24 -0
  25. data/lib/avm/eac_writings_base0.rb +9 -0
  26. data/lib/avm/eac_writings_base0/commons.rb +12 -0
  27. data/lib/avm/eac_writings_base0/file_build.rb +45 -0
  28. data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +19 -0
  29. data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +23 -0
  30. data/lib/avm/eac_writings_base0/file_build/tex_source.rb +33 -0
  31. data/lib/avm/eac_writings_base0/project.rb +33 -0
  32. data/lib/avm/eac_writings_base0/project_build.rb +117 -0
  33. data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +47 -0
  34. data/lib/avm/eac_writings_base0/project_build/copy_files.rb +42 -0
  35. data/lib/avm/executables.rb +1 -1
  36. data/lib/avm/instances/application.rb +4 -0
  37. data/lib/avm/instances/base.rb +2 -1
  38. data/lib/avm/instances/base/auto_values.rb +2 -1
  39. data/lib/avm/instances/base/auto_values/access.rb +5 -4
  40. data/lib/avm/instances/base/auto_values/admin.rb +2 -2
  41. data/lib/avm/instances/base/auto_values/database.rb +1 -1
  42. data/lib/avm/instances/base/auto_values/filesystem.rb +6 -2
  43. data/lib/avm/instances/base/auto_values/mailer.rb +34 -0
  44. data/lib/avm/instances/base/auto_values/ruby.rb +1 -1
  45. data/lib/avm/instances/base/auto_values/system.rb +2 -2
  46. data/lib/avm/instances/entry.rb +7 -1
  47. data/lib/avm/instances/entry_keys.rb +42 -7
  48. data/lib/avm/instances/runner.rb +40 -0
  49. data/lib/avm/{stereotypes/postgresql.rb → postgresql.rb} +1 -3
  50. data/lib/avm/postgresql/instance.rb +63 -0
  51. data/lib/avm/postgresql/instance/data_unit.rb +39 -0
  52. data/lib/avm/postgresql/instance_with.rb +18 -0
  53. data/lib/avm/projects/stereotypes/git_subtree/publish.rb +2 -0
  54. data/lib/avm/projects/stereotypes/git_subtree/warp.rb +3 -0
  55. data/lib/avm/tools/runner.rb +3 -3
  56. data/lib/avm/tools/runner/eac_rails_base0.rb +5 -18
  57. data/lib/avm/tools/runner/eac_rails_base0/apache_path.rb +1 -1
  58. data/lib/avm/tools/runner/eac_rails_base0/bundle.rb +3 -3
  59. data/lib/avm/tools/runner/eac_rails_base0/rails_server.rb +35 -0
  60. data/lib/avm/tools/runner/eac_rails_base0/runner.rb +3 -3
  61. data/lib/avm/tools/runner/eac_redmine_base0.rb +5 -23
  62. data/lib/avm/tools/runner/eac_redmine_base0/core_update.rb +1 -1
  63. data/lib/avm/tools/runner/eac_redmine_base0/docker.rb +1 -1
  64. data/lib/avm/tools/runner/eac_redmine_base0/project_rename.rb +3 -3
  65. data/lib/avm/tools/runner/eac_wordpress_base0.rb +5 -24
  66. data/lib/avm/tools/runner/instance.rb +28 -0
  67. data/lib/avm/tools/runner/instance/info.rb +44 -0
  68. data/lib/avm/tools/runner/local_project/eac_writings_base0.rb +35 -0
  69. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_chapters.rb +48 -0
  70. data/lib/avm/tools/runner/local_project/eac_writings_base0/build_single.rb +37 -0
  71. data/lib/avm/tools/runner/local_project/eac_writings_base0/info.rb +36 -0
  72. data/lib/avm/tools/version.rb +1 -1
  73. data/template/avm/eac_rails_base0/deploy/config/envvars.d/email.yml.template +11 -0
  74. data/template/avm/eac_writings_base0/commons/all.tex +5 -0
  75. data/template/avm/eac_writings_base0/commons/ebook.tex +11 -0
  76. data/template/avm/eac_writings_base0/commons/images.tex +11 -0
  77. data/template/avm/eac_writings_base0/commons/links.tex +2 -0
  78. data/template/avm/eac_writings_base0/commons/portuguese.tex +8 -0
  79. data/template/avm/eac_writings_base0/commons/source_code.tex +21 -0
  80. data/template/avm/eac_writings_base0/commons/source_code/java.tex +15 -0
  81. data/template/avm/eac_writings_base0/commons/utils.tex +6 -0
  82. data/vendor/eac_cli/lib/eac_cli/runner.rb +1 -1
  83. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
  84. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  85. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +12 -0
  86. data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +1 -1
  87. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +2 -1
  88. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +1 -1
  89. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +10 -6
  90. data/vendor/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +1 -1
  91. data/vendor/eac_ruby_gems_utils/spec/{rubocop_check_spec.rb → code/rubocop_check_spec.rb} +0 -0
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +4 -1
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
  100. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
  101. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
  102. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  104. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
  105. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
  106. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
  107. metadata +57 -30
  108. data/lib/avm/rails/runners/bundle.rb +0 -35
  109. data/lib/avm/rails/runners/runner.rb +0 -48
  110. data/lib/avm/stereotypes/eac_redmine_base0.rb +0 -11
  111. data/lib/avm/stereotypes/eac_wordpress_base0/apache_host.rb +0 -27
  112. data/lib/avm/stereotypes/eac_wordpress_base0/deploy.rb +0 -12
  113. data/lib/avm/stereotypes/eac_wordpress_base0/instance.rb +0 -26
  114. data/lib/avm/stereotypes/postgresql/instance.rb +0 -65
  115. data/lib/avm/stereotypes/postgresql/instance/data_unit.rb +0 -41
  116. data/lib/avm/stereotypes/postgresql/instance_with.rb +0 -20
  117. data/lib/avm/stereotypes/rails/instance.rb +0 -20
  118. data/lib/avm/tools/runner/eac_rails_base0/apache_host.rb +0 -16
  119. data/lib/avm/tools/runner/eac_rails_base0/data.rb +0 -15
  120. data/lib/avm/tools/runner/eac_rails_base0/deploy.rb +0 -15
  121. data/lib/avm/tools/runner/eac_redmine_base0/bundle.rb +0 -14
  122. data/lib/avm/tools/runner/eac_redmine_base0/data.rb +0 -27
  123. data/lib/avm/tools/runner/eac_redmine_base0/data/dump.rb +0 -16
  124. data/lib/avm/tools/runner/eac_redmine_base0/deploy.rb +0 -15
  125. data/lib/avm/tools/runner/eac_redmine_base0/runner.rb +0 -14
  126. data/lib/avm/tools/runner/eac_wordpress_base0/apache_host.rb +0 -17
  127. data/lib/avm/tools/runner/eac_wordpress_base0/data.rb +0 -15
  128. data/lib/avm/tools/runner/eac_wordpress_base0/deploy.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc0ca6899907a27aa6b201493d4333c63fd975ad79c0f705171af4cbb7d12254
4
- data.tar.gz: f520c92fc4a738cb27a5b14cff784b4321a9bed091993571b1aa096484f1dc01
3
+ metadata.gz: 86b1ee08028ac161c73a2069542d961e11585fd4eee8673307cb5f3912e0c215
4
+ data.tar.gz: 438fccaf469c7843762e381a853514ff60fb466bc202e628188eb8a512982129
5
5
  SHA512:
6
- metadata.gz: 7e5335434368d606d4d6bd23736fdec437ee2511748612fa2fa1b1f4c991038b50e740ede71149affa736c8314e662568bbeef92cb7c60ff25b1b8e993de57f5
7
- data.tar.gz: 2f675b8c6e57cb0f4eba761fdc227ec1f1f0a5dacea96ab5600733474a1c2d9258a5d8a8ae59c3566f3a2c492072bd8ff455dd36b076f97dd8e21e4763358814
6
+ metadata.gz: adfbd30ba8bac66dbb87a165d1839a1163b0679f582e326ae888fc6f773d9eeaa67d8b7047d9a0f2ec16cf98dd815ddccf2097c2003743a9fee5b7a49e67a769
7
+ data.tar.gz: deca6800842fd5dcebc5748ea4b4fa0909ff3e6bb7c927c5506d01b6f14af7588d2527f0c8c6636c11783b866dadbb65d8c59715198648eac7a9964ae2fec4a4
@@ -4,8 +4,6 @@ require 'eac_ruby_utils/require_sub'
4
4
  ::EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
- module Stereotypes
8
- module EacRailsBase0
9
- end
7
+ module EacRailsBase0
10
8
  end
11
9
  end
@@ -1,13 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_webapp_base0/instance'
4
- require 'avm/stereotypes/rails/instance'
3
+ require 'avm/eac_rails_base1/instance'
5
4
 
6
5
  module Avm
7
6
  module EacRailsBase0
8
- class Instance < ::Avm::EacWebappBase0::Instance
9
- include ::Avm::Stereotypes::Rails::Instance
10
-
7
+ class Instance < ::Avm::EacRailsBase1::Instance
11
8
  FILES_UNITS = { uploads: 'public/uploads' }.freeze
12
9
  end
13
10
  end
@@ -3,9 +3,7 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module Rails
7
- module Runners
8
- require_sub __FILE__
9
- end
6
+ module EacRailsBase1
7
+ require_sub __FILE__
10
8
  end
11
9
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/instance'
4
+ require 'eac_ruby_gems_utils/gem'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ class Instance < ::Avm::EacWebappBase0::Instance
9
+ DEFAULT_RAILS_ENVIRONMENT = 'production'
10
+
11
+ def bundle(*args)
12
+ the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', DEFAULT_RAILS_ENVIRONMENT)
13
+ end
14
+
15
+ def rake(*args)
16
+ bundle('exec', 'rake', *args)
17
+ end
18
+
19
+ def the_gem
20
+ @the_gem ||= ::EacRubyGemsUtils::Gem.new(::File.join(read_entry('fs_path')), host_env)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ class Runner < ::Avm::EacWebappBase0::Runner
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+ require 'shellwords'
7
+
8
+ module Avm
9
+ module EacRailsBase1
10
+ class Runner < ::Avm::EacWebappBase0::Runner
11
+ class Bundle < ::EacRubyUtils::Console::DocoptRunner
12
+ runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle
13
+ runner_definition do
14
+ desc 'Runs "bundle ...".'
15
+ pos_arg :'bundle-args', repeat: true, optional: true
16
+ end
17
+
18
+ def run
19
+ bundle_run
20
+ end
21
+
22
+ def bundle_args
23
+ options.fetch('<bundle-args>').reject { |arg| arg == '--' }
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'eac_cli/core_ext'
5
+ require 'eac_ruby_utils/console/docopt_runner'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ class Runner < ::Avm::EacWebappBase0::Runner
10
+ class CodeRunner < ::EacRubyUtils::Console::DocoptRunner
11
+ runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle
12
+ runner_definition do
13
+ desc 'Runs a Ruby code with "rails runner".'
14
+ pos_arg :code
15
+ end
16
+
17
+ def run
18
+ infov 'Environment', context(:instance).host_env
19
+ bundle_run
20
+ end
21
+
22
+ def bundle_args
23
+ %w[exec rails runner] + [options.fetch('<code>')]
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instance'
4
+ require 'eac_cli/runner'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module RunnerWith
9
+ module Bundle
10
+ DEFAULT_RAILS_ENVIRONMENT_CONSTANT = 'DEFAULT_RAILS_ENVIRONMENT'
11
+
12
+ common_concern do
13
+ include ::EacCli::Runner
14
+
15
+ runner_definition do
16
+ arg_opt '-e', '--environment', 'Specifies the environment for the runner to operate' \
17
+ ' (test/development/production). Default: "development".'
18
+ end
19
+ end
20
+
21
+ module ClassMethods
22
+ def default_rails_environment
23
+ const_get(DEFAULT_RAILS_ENVIRONMENT_CONSTANT)
24
+ rescue ::NameError
25
+ ::Avm::EacRailsBase1::Instance::DEFAULT_RAILS_ENVIRONMENT
26
+ end
27
+ end
28
+
29
+ def bundle_command
30
+ rails_instance.bundle(*bundle_args).envvar('RAILS_ENV', rails_environment)
31
+ end
32
+
33
+ def bundle_run
34
+ infov 'Bundle arguments', ::Shellwords.join(bundle_args)
35
+ infov 'Rails environment', rails_environment
36
+ bundle_command.system!
37
+ end
38
+
39
+ def default_rails_environment
40
+ self.class.default_rails_environment
41
+ end
42
+
43
+ def rails_instance
44
+ if respond_to?(:runner_context)
45
+ runner_context.call(:instance)
46
+ else
47
+ context(:instance)
48
+ end
49
+ end
50
+
51
+ def rails_environment
52
+ parsed.environment.presence || default_rails_environment
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -3,9 +3,7 @@
3
3
  require 'eac_ruby_utils/require_sub'
4
4
 
5
5
  module Avm
6
- module Stereotypes
7
- module Rails
8
- ::EacRubyUtils.require_sub(__FILE__)
9
- end
6
+ module EacRedmineBase0
7
+ ::EacRubyUtils.require_sub(__FILE__)
10
8
  end
11
9
  end
@@ -3,13 +3,11 @@
3
3
  require 'avm/eac_redmine_base0/data_unit'
4
4
  require 'avm/eac_ubuntu_base0/docker_image'
5
5
  require 'avm/eac_webapp_base0/instance'
6
- require 'avm/stereotypes/rails/instance'
6
+ require 'avm/eac_rails_base1/instance'
7
7
 
8
8
  module Avm
9
9
  module EacRedmineBase0
10
- class Instance < ::Avm::EacWebappBase0::Instance
11
- include ::Avm::Stereotypes::Rails::Instance
12
-
10
+ class Instance < ::Avm::EacRailsBase1::Instance
13
11
  FILES_UNITS = { files: 'files' }.freeze
14
12
 
15
13
  def docker_image_class
@@ -4,8 +4,6 @@ require 'eac_ruby_utils/require_sub'
4
4
  ::EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
- module Stereotypes
8
- module EacUbuntuBase0
9
- end
7
+ module EacUbuntuBase0
10
8
  end
11
9
  end
@@ -4,8 +4,6 @@ require 'eac_ruby_utils/require_sub'
4
4
  ::EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module Avm
7
- module Stereotypes
8
- module EacWebappBase0
9
- end
7
+ module EacWebappBase0
10
8
  end
11
9
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'avm/instances/base'
4
- require 'avm/stereotypes/postgresql/instance_with'
4
+ require 'avm/postgresql/instance_with'
5
5
  require 'avm/data/instance/files_unit'
6
6
  require 'avm/data/instance/package'
7
7
  require 'avm/eac_webapp_base0/deploy/file_unit'
@@ -9,7 +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
- include ::Avm::Stereotypes::Postgresql::InstanceWith
12
+ include ::Avm::Postgresql::InstanceWith
13
13
 
14
14
  def stereotype_name
15
15
  self.class.name.desconstantize.demodulize
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/runner'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacWebappBase0
8
+ class Runner < ::Avm::Instances::Runner
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
@@ -5,13 +5,12 @@ require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
7
7
  module EacWebappBase0
8
- module Runner
8
+ class Runner < ::Avm::Instances::Runner
9
9
  class ApacheHost < ::EacRubyUtils::Console::DocoptRunner
10
10
  include ::EacCli::DefaultRunner
11
11
 
12
- stereotype_name = name.deconstantize.demodulize
13
12
  runner_definition do
14
- desc "Configure Apache virtual host for #{stereotype_name} instance."
13
+ desc 'Configure Apache virtual host for instance.'
15
14
  bool_opt '-c', '--certbot', 'Install certbot.'
16
15
  end
17
16
 
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/require_sub'
5
5
 
6
6
  module Avm
7
7
  module EacWebappBase0
8
- module Runner
8
+ class Runner < ::Avm::Instances::Runner
9
9
  class Data < ::EacRubyUtils::Console::DocoptRunner
10
10
  ::EacRubyUtils.require_sub(__FILE__)
11
11
 
@@ -7,7 +7,7 @@ require 'avm/data/package/dump'
7
7
 
8
8
  module Avm
9
9
  module EacWebappBase0
10
- module Runner
10
+ class Runner < ::Avm::Instances::Runner
11
11
  class Data < ::EacRubyUtils::Console::DocoptRunner
12
12
  class Dump < ::EacRubyUtils::Console::DocoptRunner
13
13
  include ::EacRubyUtils::SimpleCache
@@ -6,7 +6,7 @@ require 'eac_ruby_utils/simple_cache'
6
6
 
7
7
  module Avm
8
8
  module EacWebappBase0
9
- module Runner
9
+ class Runner < ::Avm::Instances::Runner
10
10
  class Data < ::EacRubyUtils::Console::DocoptRunner
11
11
  class Load < ::EacRubyUtils::Console::DocoptRunner
12
12
  include ::EacRubyUtils::SimpleCache
@@ -6,12 +6,12 @@ require 'eac_ruby_utils/console/speaker'
6
6
 
7
7
  module Avm
8
8
  module EacWebappBase0
9
- module Runner
9
+ class Runner < ::Avm::Instances::Runner
10
10
  class Deploy < ::EacRubyUtils::Console::DocoptRunner
11
11
  include ::EacRubyUtils::Console::Speaker
12
12
 
13
13
  DOC = <<~DOCOPT
14
- Deploy for %%STEREOTYPE_NAME%% instance.
14
+ Deploy for instance.
15
15
 
16
16
  Usage:
17
17
  __PROGRAM__ [options]
@@ -22,22 +22,9 @@ module Avm
22
22
  -r --reference=<git-reference> Git reference to deploy.
23
23
  -a --append-dirs=<append-dirs> Append directories to deploy (List separated by ":").
24
24
  DOCOPT
25
- def initialize(settings = {})
26
- super settings.merge(doc: DOC.gsub('%%STEREOTYPE_NAME%%', stereotype_name))
27
- end
28
25
 
29
26
  def deploy_class
30
- stereotype_module.const_get('Deploy')
31
- end
32
-
33
- def stereotype_module
34
- ::Avm::Stereotypes.const_get(stereotype_name)
35
- rescue ::NameError
36
- ::Avm.const_get(stereotype_name)
37
- end
38
-
39
- def stereotype_name
40
- self.class.name.deconstantize.demodulize
27
+ context(:stereotype_module).const_get('Deploy')
41
28
  end
42
29
 
43
30
  def run
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacWordpressBase0
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/apache_host'
4
+
5
+ module Avm
6
+ module EacWordpressBase0
7
+ class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
+ def document_root
9
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
10
+ end
11
+
12
+ def extra_content
13
+ "AssignUserID #{system_user} #{system_group}"
14
+ end
15
+
16
+ def system_user
17
+ instance.read_entry('system.username')
18
+ end
19
+
20
+ def system_group
21
+ instance.read_entry('system.groupname')
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/deploy'
4
+
5
+ module Avm
6
+ module EacWordpressBase0
7
+ class Deploy < ::Avm::EacWebappBase0::Deploy
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/entry_keys'
4
+ require 'avm/eac_webapp_base0/instance'
5
+
6
+ module Avm
7
+ module EacWordpressBase0
8
+ class Instance < ::Avm::EacWebappBase0::Instance
9
+ FILES_UNITS = { uploads: 'wp-content/uploads', themes: 'wp-content/themes' }.freeze
10
+
11
+ def database_unit
12
+ web_url = read_entry(::Avm::Instances::EntryKeys::WEB_URL)
13
+ super.after_load do
14
+ info 'Fixing web addresses...'
15
+ run_sql(<<~SQL)
16
+ update wp_options
17
+ set option_value = '#{web_url}'
18
+ where option_name in ('siteurl', 'home')
19
+ SQL
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end