eac_tools 0.97.0 → 0.97.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +15 -15
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +22 -0
  5. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/apache_base.rb +16 -0
  6. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0 → avm-eac_rails_base1/lib/avm/eac_rails_base1}/instances/apache_host.rb +4 -5
  7. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/apache_path.rb +21 -0
  8. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/base.rb +50 -0
  9. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/deploy.rb +23 -0
  10. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/processes/daemon.rb +39 -0
  11. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/processes/tasks_scheduler.rb +27 -0
  12. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros.rb → avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/processes.rb} +2 -2
  13. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/bundle.rb +28 -0
  14. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/code_runner.rb +28 -0
  15. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/log.rb +45 -0
  16. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/logs/clear.rb +27 -0
  17. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/logs.rb +19 -0
  18. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/rails_server.rb +34 -0
  19. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler/systemd_unit.rb +48 -0
  20. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/runners/tasks_scheduler.rb +19 -0
  21. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources → avm-eac_rails_base1/lib/avm/eac_rails_base1/instances}/runners.rb +2 -2
  22. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/service.rb +72 -0
  23. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler_command.rb +31 -0
  24. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instances/systemd_unit.rb +59 -0
  25. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0 → avm-eac_rails_base1/lib/avm/eac_rails_base1}/instances.rb +1 -1
  26. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb +27 -0
  27. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +47 -0
  28. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb +43 -0
  29. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0 → avm-eac_rails_base1/lib/avm/eac_rails_base1}/version.rb +2 -2
  30. data/sub/{avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0.rb → avm-eac_rails_base1/lib/avm/eac_rails_base1.rb} +1 -1
  31. data/sub/{avm-eac_asciidoctor_base0 → avm-eac_rails_base1}/spec/spec_helper.rb +0 -4
  32. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/instances/apache_path/extra_content.conf +5 -0
  33. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler.service +12 -0
  34. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/instances/systemd_unit/tasks_scheduler_command.sh +6 -0
  35. metadata +37 -79
  36. data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +0 -24
  37. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/documents_owner.rb +0 -30
  38. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/file_formats/base/file_resource_name.rb +0 -37
  39. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/file_formats/base.rb +0 -17
  40. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_path.rb +0 -12
  41. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb +0 -33
  42. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/body_target.rb +0 -37
  43. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_lines.rb +0 -92
  44. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/media.rb +0 -28
  45. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb +0 -64
  46. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +0 -101
  47. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/theme.rb +0 -41
  48. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb +0 -60
  49. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +0 -28
  50. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/base.rb +0 -21
  51. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/breadcrumbs.rb +0 -55
  52. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/child_docs/document_builder.rb +0 -63
  53. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/child_docs.rb +0 -35
  54. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/macros/default_body.rb +0 -21
  55. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging/catcher.rb +0 -47
  56. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging/error.rb +0 -18
  57. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/logging.rb +0 -11
  58. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators/base.rb +0 -28
  59. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators.rb +0 -11
  60. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/instance_to_build.rb +0 -45
  61. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +0 -46
  62. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +0 -49
  63. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document/media.rb +0 -28
  64. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document/title.rb +0 -31
  65. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/document.rb +0 -56
  66. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +0 -58
  67. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/document/build.rb +0 -51
  68. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/document.rb +0 -30
  69. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/documents.rb +0 -28
  70. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/ignore_errors_option.rb +0 -44
  71. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb +0 -11
  72. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/file_formats/base_spec.rb +0 -13
  73. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +0 -81
  74. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +0 -25
  75. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +0 -22
  76. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/_media/a_media_file +0 -1
  77. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/_media/a_media_file +0 -1
  78. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/body.adoc +0 -11
  79. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc1/title +0 -1
  80. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/body.adoc +0 -11
  81. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/_media/a_media_file +0 -1
  82. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/body.adoc +0 -11
  83. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/doc2_1/title +0 -1
  84. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.source/content/doc2/title +0 -1
  85. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/_media/a_media_file +0 -1
  86. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/_theme/main.css +0 -1
  87. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc1/_media/a_media_file +0 -1
  88. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc1/index.html +0 -1
  89. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/doc2_1/_media/a_media_file +0 -1
  90. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/doc2_1/index.html +0 -1
  91. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/doc2/index.html +0 -1
  92. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/first.target/index.html +0 -1
  93. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb +0 -8
  94. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc +0 -11
  95. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title +0 -1
  96. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css +0 -1
  97. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +0 -16
  98. data/sub/avm-eac_asciidoctor_base0/spec/spec_helper/eac_asciidoctor_base0_stubs.rb +0 -55
  99. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +0 -11
  100. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +0 -1
  101. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -1
  102. /data/sub/{avm-eac_asciidoctor_base0 → avm-eac_rails_base1}/Gemfile +0 -0
  103. /data/sub/{avm-eac_asciidoctor_base0 → avm-eac_rails_base1}/spec/rubocop_spec.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b86618f5e0b6acf9c493717389ada6aa49459a59b4a3eb2970d8f0b2b16d570
4
- data.tar.gz: 3cdba7b928c7b2754642ad9ce59f36ecd8d2656fa1a1a18d4f675e6809134376
3
+ metadata.gz: c0dc56d7a88a3a1fd5cb8efd27325816b4cf1b5fafb2260e7cbb6a6b68433336
4
+ data.tar.gz: bccb162a86dc9fdf69a58d2f1479a936e36b0e5072217472a342afd0d147899d
5
5
  SHA512:
6
- metadata.gz: 6fe556277a414f99d7a798d00b602ae780ba83b64d709b957e047d90673517ca6b56abfa6dabbacd16bbe407f65a8a08aa00d30302851a87f50bd3c92ee6d3fc
7
- data.tar.gz: 1f814609ae504133bd62e30a8356d0a847a61ec470b8bfa8ef7855dce8cef3b516aeb596f3e612696a155a02a5247189f1f711b08b847cbbeebfd88e9f18a819
6
+ metadata.gz: 12ccbcc6f9bbba861c6b2181e196d3027bf2b26a8666257111726d6eae65f0989ae04f7d21f0f92253fc56aa98f442f5c367dcc8f4f42261f6188bf38353edb4
7
+ data.tar.gz: 036deadc4dffcccaaae3eab04490ef3f18fbecaffa745b0b10ed91219351a2a6bb963bf11a9b1f28de6e9ee2e76a0c31e53c7ced46332a114ff8c7b6643a3aad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.97.0)
4
+ eac_tools (0.97.1)
5
5
  avm (~> 0.94)
6
6
  avm-eac_asciidoctor_base0 (~> 0.25)
7
7
  avm-eac_generic_base0 (~> 0.13)
@@ -12,7 +12,7 @@ PATH
12
12
  avm-eac_postgresql_base0 (~> 0.5, >= 0.5.3)
13
13
  avm-eac_python_base0 (~> 0.2, >= 0.2.2)
14
14
  avm-eac_rails_base0 (~> 0.11, >= 0.11.1)
15
- avm-eac_rails_base1 (~> 0.10, >= 0.10.1)
15
+ avm-eac_rails_base1 (~> 0.10, >= 0.10.2)
16
16
  avm-eac_redmine_base0 (~> 0.22, >= 0.22.3)
17
17
  avm-eac_redmine_plugin_base0 (~> 0.4, >= 0.4.1)
18
18
  avm-eac_ruby_base0 (~> 0.1)
@@ -24,15 +24,13 @@ PATH
24
24
  eac_ruby_utils (~> 0.123)
25
25
 
26
26
  PATH
27
- remote: sub/avm-eac_asciidoctor_base0
27
+ remote: sub/avm-eac_rails_base1
28
28
  specs:
29
- avm-eac_asciidoctor_base0 (0.25.0)
30
- asciidoctor (~> 2.0, >= 2.0.23)
29
+ avm-eac_rails_base1 (0.10.2)
30
+ avm (~> 0.94)
31
+ avm-eac_ruby_base1 (~> 0.35, >= 0.35.1)
31
32
  avm-eac_webapp_base0 (~> 0.20, >= 0.20.1)
32
- eac_fs (~> 0.18, >= 0.18.1)
33
33
  eac_ruby_utils (~> 0.123)
34
- os (~> 1.1, >= 1.1.4)
35
- rouge (~> 3.30)
36
34
 
37
35
  GEM
38
36
  remote: https://rubygems.org/
@@ -56,6 +54,13 @@ GEM
56
54
  eac_templates (~> 0.7, >= 0.7.1)
57
55
  minitar (~> 0.9)
58
56
  ruby-progressbar (~> 1.13)
57
+ avm-eac_asciidoctor_base0 (0.25.0)
58
+ asciidoctor (~> 2.0, >= 2.0.23)
59
+ avm-eac_webapp_base0 (~> 0.20, >= 0.20.1)
60
+ eac_fs (~> 0.18, >= 0.18.1)
61
+ eac_ruby_utils (~> 0.123)
62
+ os (~> 1.1, >= 1.1.4)
63
+ rouge (~> 3.30)
59
64
  avm-eac_generic_base0 (0.13.0)
60
65
  avm (~> 0.90)
61
66
  eac_ruby_utils (~> 0.121)
@@ -84,11 +89,6 @@ GEM
84
89
  avm-eac_rails_base0 (0.11.1)
85
90
  avm-eac_rails_base1 (~> 0.10)
86
91
  eac_ruby_utils (~> 0.121)
87
- avm-eac_rails_base1 (0.10.1)
88
- avm (~> 0.94)
89
- avm-eac_ruby_base1 (~> 0.35, >= 0.35.1)
90
- avm-eac_webapp_base0 (~> 0.20, >= 0.20.1)
91
- eac_ruby_utils (~> 0.122)
92
92
  avm-eac_redmine_base0 (0.22.3)
93
93
  avm (~> 0.92)
94
94
  avm-eac_generic_base0 (~> 0.13)
@@ -221,7 +221,7 @@ GEM
221
221
  htmlbeautifier (1.4.3)
222
222
  i18n (1.14.6)
223
223
  concurrent-ruby (~> 1.0)
224
- json (2.7.5)
224
+ json (2.7.6)
225
225
  language_server-protocol (3.17.0.3)
226
226
  minitar (0.12.1)
227
227
  minitest (5.25.1)
@@ -310,7 +310,7 @@ PLATFORMS
310
310
  x86_64-linux
311
311
 
312
312
  DEPENDENCIES
313
- avm-eac_asciidoctor_base0!
313
+ avm-eac_rails_base1!
314
314
  eac_ruby_gem_support (~> 0.10)
315
315
  eac_tools!
316
316
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.97.0'
4
+ VERSION = '0.97.1'
5
5
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/eac_rails_base1/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-eac_rails_base1'
9
+ s.version = Avm::EacRailsBase1::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib,template}/**/*']
14
+ s.required_ruby_version = '>= 2.7'
15
+
16
+ s.add_dependency 'avm', '~> 0.94'
17
+ s.add_dependency 'avm-eac_ruby_base1', '~> 0.35', '>= 0.35.1'
18
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.20', '>= 0.20.1'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.123'
20
+
21
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.10'
22
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module ApacheBase
9
+ # @return [String]
10
+ def document_root
11
+ ::File.join(super, 'public')
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/eac_rails_base1/instances/apache_base'
3
4
  require 'avm/eac_webapp_base0/instances/apache_host'
4
5
 
5
6
  module Avm
6
- module EacAsciidoctorBase0
7
+ module EacRailsBase1
7
8
  module Instances
8
9
  class ApacheHost < ::Avm::EacWebappBase0::Instances::ApacheHost
9
- def document_root
10
- instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH)
11
- end
10
+ prepend ::Avm::EacRailsBase1::Instances::ApacheBase
12
11
 
13
12
  def extra_content
14
- ''
13
+ 'PassengerEnabled On'
15
14
  end
16
15
  end
17
16
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/apache_base'
4
+ require 'avm/eac_webapp_base0/instances/apache_path'
5
+ require 'eac_templates/core_ext'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ module Instances
10
+ class ApachePath < ::Avm::EacWebappBase0::Instances::ApachePath
11
+ prepend ::Avm::EacRailsBase1::Instances::ApacheBase
12
+
13
+ # @return [String]
14
+ def extra_content
15
+ ::Avm::EacRailsBase1::Instances::ApachePath.template.child('extra_content.conf')
16
+ .apply(variables_source)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/apache_host'
4
+ require 'avm/eac_rails_base1/instances/apache_path'
5
+ require 'avm/eac_rails_base1/instances/processes/tasks_scheduler'
6
+ require 'avm/eac_rails_base1/instances/runners'
7
+ require 'avm/eac_ruby_base1/instances/mixin'
8
+ require 'avm/eac_ruby_base1/sources/base'
9
+ require 'avm/eac_webapp_base0/instances/base'
10
+
11
+ module Avm
12
+ module EacRailsBase1
13
+ module Instances
14
+ class Base < ::Avm::EacWebappBase0::Instances::Base
15
+ include ::Avm::EacRubyBase1::Instances::Mixin
16
+
17
+ DEFAULT_RAILS_ENVIRONMENT = 'production'
18
+
19
+ def bundle(*args)
20
+ the_gem.bundle(*args).chdir_root.envvar('RAILS_ENV', DEFAULT_RAILS_ENVIRONMENT)
21
+ end
22
+
23
+ # @return [Avm::Instances::Data::Package]
24
+ def data_package_create
25
+ super.add_unit('database', database_unit)
26
+ end
27
+
28
+ # @return [Addressable::URI]
29
+ def gemfile_source
30
+ application.local_source.gemfile_source
31
+ end
32
+
33
+ # @return [Array<Avm::Instances::Process>]
34
+ def processes
35
+ super + [::Avm::EacRailsBase1::Instances::Processes::TasksScheduler.new(self)]
36
+ end
37
+
38
+ def rake(*args)
39
+ bundle('exec', 'rake', *args)
40
+ end
41
+
42
+ def the_gem
43
+ @the_gem ||= ::Avm::EacRubyBase1::Sources::Base.new(
44
+ ::File.join(read_entry('install.path'))
45
+ ).env_set(host_env)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_envs/http/request'
4
+ require 'avm/eac_webapp_base0/instances/deploy'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
10
+ set_callback :write_on_target, :before do
11
+ check_rubygems_access
12
+ end
13
+
14
+ # @return [void]
15
+ # @raise [EacEnvs::Http::Error]
16
+ def check_rubygems_access
17
+ infom "Checkin access to gems provider (\"#{instance.gemfile_source}\")..."
18
+ ::EacEnvs::Http::Request.new.url(instance.gemfile_source).response.body_data_or_raise
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/process'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Processes
10
+ class Daemon < ::Avm::Instances::Process
11
+ acts_as_abstract :command_name, :gem_name
12
+
13
+ # @return [Boolean]
14
+ def available?
15
+ instance.application.local_source.gemfile_lock_gem_version(gem_name).present?
16
+ end
17
+
18
+ def disable
19
+ daemon_command(:stop).system!
20
+ end
21
+
22
+ def enable
23
+ daemon_command(:start).system!
24
+ end
25
+
26
+ def enabled?
27
+ daemon_command(:status).execute.fetch(:exit_code).zero?
28
+ end
29
+
30
+ private
31
+
32
+ def daemon_command(action)
33
+ instance.bundle('exec', command_name, action)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/processes/daemon'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Processes
10
+ class TasksScheduler < ::Avm::EacRailsBase1::Instances::Processes::Daemon
11
+ GEM_NAME = 'tasks_scheduler'
12
+ COMMAND_NAME = 'tasks_scheduler'
13
+
14
+ # @return [String]
15
+ def command_name
16
+ COMMAND_NAME
17
+ end
18
+
19
+ # @return [String]
20
+ def gem_name
21
+ GEM_NAME
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,9 +3,9 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module EacAsciidoctorBase0
6
+ module EacRailsBase1
7
7
  module Instances
8
- module Macros
8
+ module Processes
9
9
  require_sub __FILE__
10
10
  end
11
11
  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 'shellwords'
6
+
7
+ module Avm
8
+ module EacRailsBase1
9
+ module Instances
10
+ module Runners
11
+ class Bundle
12
+ runner_with ::Avm::EacRailsBase1::RunnerWith::Bundle, :help do
13
+ desc 'Runs "bundle ...".'
14
+ pos_arg :'bundle-args', repeat: true, optional: true
15
+ end
16
+
17
+ def run
18
+ bundle_run
19
+ end
20
+
21
+ def bundle_args
22
+ parsed.bundle_args.reject { |arg| arg == '--' }
23
+ end
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
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Runners
10
+ class CodeRunner
11
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
12
+ desc 'Runs a Ruby code with "rails runner".'
13
+ pos_arg :code
14
+ end
15
+
16
+ def run
17
+ infov 'Environment', runner_context.call(:instance).host_env
18
+ bundle_run
19
+ end
20
+
21
+ def bundle_args
22
+ %w[exec rails runner] + [parsed.code]
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/rails_environment'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Log
10
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::RailsEnvironment do
11
+ desc 'Read application\'s log.'
12
+ bool_opt '-f', '--follow', 'Output appended data as the log grows.'
13
+ end
14
+
15
+ def run
16
+ start_banner
17
+ tail_command.system
18
+ end
19
+
20
+ private
21
+
22
+ def log_path
23
+ ::File.join(rails_instance.read_entry('install.path'), 'log',
24
+ "#{rails_environment}.log")
25
+ end
26
+
27
+ def start_banner
28
+ infov 'Environment', rails_environment
29
+ infov 'Log path', log_path
30
+ end
31
+
32
+ def tail_command
33
+ rails_instance.host_env.command(*tail_command_args)
34
+ end
35
+
36
+ def tail_command_args
37
+ r = %w[tail]
38
+ r << '--follow' if parsed.follow?
39
+ r + [log_path]
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/rails_environment'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Logs
10
+ class Clear
11
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
12
+ desc 'Clear logs.'
13
+ end
14
+
15
+ def run
16
+ bundle_run
17
+ end
18
+
19
+ def bundle_args
20
+ %w[exec rake log:clear]
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class Logs
10
+ require_sub __FILE__
11
+ runner_with :help, :subcommands do
12
+ desc 'Manipule multiple application\'s logs.'
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/runner_with/bundle'
4
+ require 'avm/instances/entry_keys'
5
+ require 'eac_cli/core_ext'
6
+ require 'shellwords'
7
+
8
+ module Avm
9
+ module EacRailsBase1
10
+ module Instances
11
+ module Runners
12
+ class RailsServer
13
+ DEFAULT_RAILS_ENVIRONMENT = 'development'
14
+ runner_with :help, ::Avm::EacRailsBase1::RunnerWith::Bundle do
15
+ desc 'Run the embbeded Rails web server.'
16
+ end
17
+
18
+ def run
19
+ infov 'Environment', rails_environment
20
+ infov 'Bundle args', ::Shellwords.join(bundle_args)
21
+ infov 'Result', bundle_command.system
22
+ end
23
+
24
+ protected
25
+
26
+ def bundle_args
27
+ ['exec', 'rails', 'server', '--port',
28
+ runner_context.call(:instance).read_entry(::Avm::Instances::EntryKeys::WEB_PORT)]
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_rails_base1/instances/systemd_unit'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacRailsBase1
8
+ module Instances
9
+ module Runners
10
+ class TasksScheduler
11
+ class SystemdUnit
12
+ DEFAULT_RESTART = 'on-failure'
13
+
14
+ runner_with :help do
15
+ desc 'Configure Systemd unit for instace\'s tasks scheduler daemon (Reference: ' \
16
+ 'https://www.freedesktop.org/software/systemd/man/systemd.service.html).'
17
+ bool_opt '-e', '--exec-run', 'Run daemon with "run" instead of "start"/"stop".'
18
+ arg_opt '-r', '--restart', 'Value for systemd.service, Restart=.',
19
+ default: DEFAULT_RESTART
20
+ end
21
+
22
+ delegate :restart, to: :parsed
23
+
24
+ def run
25
+ if result.error?
26
+ fatal_error result.to_s
27
+ else
28
+ infov 'Result', result.label
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def systemd_unit_uncached
35
+ ::Avm::EacRailsBase1::Instances::SystemdUnit.new(runner_context.call(:instance),
36
+ restart: parsed.restart,
37
+ exec_run: parsed.exec_run?)
38
+ end
39
+
40
+ def result_uncached
41
+ systemd_unit.run
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ module Runners
9
+ class TasksScheduler
10
+ require_sub __FILE__
11
+
12
+ runner_with :help, :subcommands do
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -3,8 +3,8 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module EacAsciidoctorBase0
7
- module Sources
6
+ module EacRailsBase1
7
+ module Instances
8
8
  module Runners
9
9
  require_sub __FILE__
10
10
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacRailsBase1
7
+ module Instances
8
+ class SystemdUnit
9
+ module Service
10
+ def service_content
11
+ template.child('tasks_scheduler.service').apply(variables_source)
12
+ end
13
+
14
+ def service_exec_lines
15
+ service_exec_operations
16
+ .map { |k, v| "#{k}=#{tasks_scheduler_command_path} #{v}" }
17
+ .join("\n")
18
+ end
19
+
20
+ def service_path
21
+ ::Pathname.new('/etc/systemd/system').join(unit_name)
22
+ end
23
+
24
+ def service_link_path
25
+ ::Pathname.new('/etc/systemd/system/multi-user.target.wants').join(unit_name)
26
+ end
27
+
28
+ def verify_service
29
+ sudo_system!('systemd-analyze', 'verify', service_path)
30
+ end
31
+
32
+ private
33
+
34
+ def enable_service
35
+ systemctl('enable', unit_name)
36
+ end
37
+
38
+ def link_service
39
+ sudo_execute!('rm', '-f', service_link_path)
40
+ sudo_execute!('ln', '-s', service_path, service_link_path)
41
+ end
42
+
43
+ def reload_systemd
44
+ systemctl('daemon-reload')
45
+ end
46
+
47
+ # @return [Hash<String, String>]
48
+ def service_exec_operations
49
+ if exec_run?
50
+ { 'ExecStart' => 'run' }
51
+ else
52
+ { 'ExecStart' => 'start', 'ExecStop' => 'stop' }
53
+ end
54
+ end
55
+
56
+ def start_service
57
+ systemctl('start', unit_name)
58
+ end
59
+
60
+ def systemctl(*args)
61
+ sudo_system!('systemctl', *args)
62
+ end
63
+
64
+ def write_service
65
+ infom 'Writing service\'s unit file...'
66
+ platform_instance.file_sudo_write(service_path, service_content)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end