avm-tools 0.120.0 → 0.120.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb +3 -3
  3. data/lib/avm/tools/runner/app_src/ruby.rb +0 -1
  4. data/lib/avm/tools/version.rb +1 -1
  5. metadata +6 -233
  6. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +0 -29
  7. data/lib/avm/patches/eac_ruby_gems_utils.rb +0 -4
  8. data/sub/avm/Gemfile +0 -5
  9. data/sub/avm/avm.gemspec +0 -26
  10. data/sub/avm/lib/avm/data/instance/files_unit.rb +0 -40
  11. data/sub/avm/lib/avm/data/instance/package.rb +0 -18
  12. data/sub/avm/lib/avm/data/instance/unit.rb +0 -17
  13. data/sub/avm/lib/avm/data/instance.rb +0 -11
  14. data/sub/avm/lib/avm/data/package/dump.rb +0 -119
  15. data/sub/avm/lib/avm/data/package/load.rb +0 -48
  16. data/sub/avm/lib/avm/data/package.rb +0 -42
  17. data/sub/avm/lib/avm/data/rotate.rb +0 -107
  18. data/sub/avm/lib/avm/data/unit.rb +0 -94
  19. data/sub/avm/lib/avm/docker/container.rb +0 -50
  20. data/sub/avm/lib/avm/docker/image.rb +0 -71
  21. data/sub/avm/lib/avm/docker/runner.rb +0 -125
  22. data/sub/avm/lib/avm/docker.rb +0 -9
  23. data/sub/avm/lib/avm/executables.rb +0 -24
  24. data/sub/avm/lib/avm/instances/application.rb +0 -29
  25. data/sub/avm/lib/avm/instances/base/auto_values/access.rb +0 -40
  26. data/sub/avm/lib/avm/instances/base/auto_values/admin.rb +0 -19
  27. data/sub/avm/lib/avm/instances/base/auto_values/data.rb +0 -26
  28. data/sub/avm/lib/avm/instances/base/auto_values/database.rb +0 -76
  29. data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +0 -43
  30. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +0 -34
  31. data/sub/avm/lib/avm/instances/base/auto_values/ruby.rb +0 -15
  32. data/sub/avm/lib/avm/instances/base/auto_values/source.rb +0 -15
  33. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
  34. data/sub/avm/lib/avm/instances/base/auto_values/web.rb +0 -46
  35. data/sub/avm/lib/avm/instances/base/auto_values.rb +0 -21
  36. data/sub/avm/lib/avm/instances/base/dockerizable.rb +0 -45
  37. data/sub/avm/lib/avm/instances/base/entry_keys.rb +0 -22
  38. data/sub/avm/lib/avm/instances/base.rb +0 -64
  39. data/sub/avm/lib/avm/instances/docker_image.rb +0 -15
  40. data/sub/avm/lib/avm/instances/entries.rb +0 -43
  41. data/sub/avm/lib/avm/instances/entry.rb +0 -60
  42. data/sub/avm/lib/avm/instances/entry_keys.rb +0 -60
  43. data/sub/avm/lib/avm/instances/runner.rb +0 -39
  44. data/sub/avm/lib/avm/instances.rb +0 -8
  45. data/sub/avm/lib/avm/jobs/base.rb +0 -63
  46. data/sub/avm/lib/avm/jobs/variables_source.rb +0 -22
  47. data/sub/avm/lib/avm/jobs.rb +0 -9
  48. data/sub/avm/lib/avm/launcher/errors/base.rb +0 -10
  49. data/sub/avm/lib/avm/launcher/errors/non_project.rb +0 -15
  50. data/sub/avm/lib/avm/launcher/paths/real.rb +0 -44
  51. data/sub/avm/lib/avm/launcher/publish/check_result.rb +0 -67
  52. data/sub/avm/lib/avm/path_string.rb +0 -27
  53. data/sub/avm/lib/avm/registry/base.rb +0 -71
  54. data/sub/avm/lib/avm/registry/with_path.rb +0 -23
  55. data/sub/avm/lib/avm/registry.rb +0 -39
  56. data/sub/avm/lib/avm/result.rb +0 -86
  57. data/sub/avm/lib/avm/rspec/setup.rb +0 -22
  58. data/sub/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb +0 -11
  59. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +0 -14
  60. data/sub/avm/lib/avm/rspec.rb +0 -9
  61. data/sub/avm/lib/avm/runners/base.rb +0 -27
  62. data/sub/avm/lib/avm/scms/base.rb +0 -41
  63. data/sub/avm/lib/avm/scms/commit.rb +0 -43
  64. data/sub/avm/lib/avm/scms/inflector.rb +0 -22
  65. data/sub/avm/lib/avm/scms/null.rb +0 -14
  66. data/sub/avm/lib/avm/self/docker_image.rb +0 -14
  67. data/sub/avm/lib/avm/self/instance/entry_keys.rb +0 -12
  68. data/sub/avm/lib/avm/self/instance.rb +0 -31
  69. data/sub/avm/lib/avm/sources/base/configuration.rb +0 -55
  70. data/sub/avm/lib/avm/sources/base/instance.rb +0 -28
  71. data/sub/avm/lib/avm/sources/base/locale.rb +0 -26
  72. data/sub/avm/lib/avm/sources/base/parent.rb +0 -31
  73. data/sub/avm/lib/avm/sources/base/subs.rb +0 -55
  74. data/sub/avm/lib/avm/sources/base/subs_paths.rb +0 -32
  75. data/sub/avm/lib/avm/sources/base/testing.rb +0 -27
  76. data/sub/avm/lib/avm/sources/base.rb +0 -53
  77. data/sub/avm/lib/avm/sources/configuration/rubocop.rb +0 -26
  78. data/sub/avm/lib/avm/sources/configuration.rb +0 -59
  79. data/sub/avm/lib/avm/sources/tester.rb +0 -24
  80. data/sub/avm/lib/avm/sources/tests/builder.rb +0 -83
  81. data/sub/avm/lib/avm/sources/tests/performer.rb +0 -35
  82. data/sub/avm/lib/avm/sources/tests/result.rb +0 -15
  83. data/sub/avm/lib/avm/sources/tests/single.rb +0 -56
  84. data/sub/avm/lib/avm/sources/tests.rb +0 -11
  85. data/sub/avm/lib/avm/sources.rb +0 -9
  86. data/sub/avm/lib/avm/sync.rb +0 -94
  87. data/sub/avm/lib/avm/version.rb +0 -5
  88. data/sub/avm/lib/avm/version_number.rb +0 -45
  89. data/sub/avm/lib/avm.rb +0 -7
  90. data/sub/avm/spec/lib/avm/scms/base_spec.rb +0 -7
  91. data/sub/avm/spec/lib/avm/sources/base_spec.rb +0 -7
  92. data/sub/avm/spec/rubocop_spec.rb +0 -3
  93. data/sub/avm/spec/spec_helper.rb +0 -4
  94. data/sub/avm-eac_rails_base1/Gemfile +0 -5
  95. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +0 -21
  96. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/apache_host.rb +0 -17
  97. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instance.rb +0 -24
  98. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/bundle.rb +0 -26
  99. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -26
  100. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/log.rb +0 -43
  101. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/logs/clear.rb +0 -26
  102. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/logs.rb +0 -18
  103. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -32
  104. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +0 -46
  105. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler.rb +0 -17
  106. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner.rb +0 -12
  107. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb +0 -27
  108. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +0 -47
  109. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb +0 -27
  110. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +0 -70
  111. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +0 -29
  112. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +0 -57
  113. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +0 -7
  114. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1.rb +0 -9
  115. data/sub/avm-eac_rails_base1/spec/rubocop_spec.rb +0 -3
  116. data/sub/avm-eac_rails_base1/spec/spec_helper.rb +0 -4
  117. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler.service +0 -12
  118. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +0 -6
  119. data/sub/avm-eac_ruby_base1/Gemfile +0 -5
  120. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +0 -22
  121. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb +0 -56
  122. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb +0 -19
  123. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb +0 -34
  124. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/depends_on.rb +0 -25
  125. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/gem_conflict.rb +0 -44
  126. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/in_gemfile.rb +0 -17
  127. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_buffer.rb +0 -73
  128. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_factory.rb +0 -31
  129. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_parser_base.rb +0 -19
  130. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/version_requirement.rb +0 -26
  131. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser.rb +0 -25
  132. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb +0 -11
  133. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +0 -31
  134. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +0 -17
  135. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +0 -41
  136. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop.rb +0 -55
  137. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundle_command.rb +0 -39
  138. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundler.rb +0 -39
  139. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb +0 -23
  140. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +0 -55
  141. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/incompatible.rb +0 -76
  142. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler.rb +0 -19
  143. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners.rb +0 -13
  144. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +0 -38
  145. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +0 -56
  146. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb +0 -52
  147. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources.rb +0 -11
  148. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +0 -7
  149. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb +0 -9
  150. data/sub/avm-eac_ruby_base1/locale/en.yml +0 -8
  151. data/sub/avm-eac_ruby_base1/locale/pt-BR.yml +0 -8
  152. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec.rb +0 -7
  153. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/1.source.out +0 -192
  154. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/1.target.yaml +0 -300
  155. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.source.out +0 -245
  156. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.target.yaml +0 -355
  157. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base_spec.rb +0 -7
  158. data/sub/avm-eac_ruby_base1/spec/rubocop_spec.rb +0 -3
  159. data/sub/avm-eac_ruby_base1/spec/spec_helper.rb +0 -4
  160. data/sub/eac_ruby_base0/Gemfile +0 -5
  161. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +0 -21
  162. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +0 -87
  163. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +0 -34
  164. data/sub/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +0 -5
  165. data/sub/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +0 -31
  166. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +0 -10
  167. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +0 -4
  168. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +0 -5
  169. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +0 -5
  170. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +0 -4
  171. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec/setup.rb +0 -14
  172. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec.rb +0 -9
  173. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +0 -92
  174. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +0 -42
  175. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +0 -52
  176. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +0 -36
  177. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +0 -58
  178. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +0 -9
  179. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +0 -5
  180. data/sub/eac_ruby_base0/lib/eac_ruby_base0.rb +0 -7
  181. data/sub/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +0 -42
  182. data/sub/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +0 -81
  183. data/sub/eac_ruby_base0/spec/rubocop_spec.rb +0 -3
  184. data/sub/eac_ruby_base0/spec/spec_helper.rb +0 -4
  185. data/sub/eac_ruby_gems_utils/Gemfile +0 -5
  186. data/sub/eac_ruby_gems_utils/LICENCE +0 -16
  187. data/sub/eac_ruby_gems_utils/README.rdoc +0 -3
  188. data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +0 -31
  189. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +0 -33
  190. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +0 -41
  191. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +0 -97
  192. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +0 -57
  193. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +0 -25
  194. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +0 -48
  195. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +0 -25
  196. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +0 -84
  197. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +0 -21
  198. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +0 -9
  199. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +0 -5
  200. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +0 -7
  201. data/sub/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +0 -3
  202. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +0 -14
  203. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +0 -7
  204. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +0 -20
  205. data/sub/eac_ruby_gems_utils/spec/spec_helper.rb +0 -4
  206. data/sub/eac_ruby_gems_utils/spec/support/mygem/Gemfile +0 -5
  207. data/sub/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +0 -19
  208. data/sub/eac_ruby_gems_utils/spec/support/mygem/Rakefile +0 -14
  209. data/sub/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +0 -5
  210. data/sub/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +0 -5
  211. data/sub/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +0 -5
  212. data/sub/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +0 -16
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entry_keys'
4
-
5
- module Avm
6
- module Instances
7
- class Base
8
- module AutoValues
9
- module Database
10
- DEFAULT_EXTRA = ''
11
- DEFAULT_HOSTNAME = '127.0.0.1'
12
- DEFAULT_LIMIT = 5
13
- DEFAULT_PORTS = {
14
- 'postgresql' => 5432,
15
- 'mysql' => 3306,
16
- 'oracle' => 1521,
17
- 'sqlserver' => 1433
18
- }.freeze
19
- DEFAULT_SYSTEM = 'postgresql'
20
- DEFAULT_TIMEOUT = 5000
21
-
22
- def auto_database_extra
23
- database_auto_common('hostname') || DEFAULT_EXTRA
24
- end
25
-
26
- def auto_database_name
27
- inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID,
28
- ::Avm::Instances::EntryKeys::DATABASE_NAME) || id
29
- end
30
-
31
- def auto_database_hostname
32
- database_auto_common('hostname') || DEFAULT_HOSTNAME
33
- end
34
-
35
- def auto_database_limit
36
- database_auto_common('limit') || DEFAULT_LIMIT
37
- end
38
-
39
- def auto_database_password
40
- database_auto_common('password') || id
41
- end
42
-
43
- def auto_database_port
44
- database_auto_common('port') || database_port_by_system
45
- end
46
-
47
- def auto_database_username
48
- database_auto_common('username') || id
49
- end
50
-
51
- def auto_database_system
52
- database_auto_common('system') || DEFAULT_SYSTEM
53
- end
54
-
55
- def auto_database_timeout
56
- database_auto_common('timeout') || DEFAULT_TIMEOUT
57
- end
58
-
59
- private
60
-
61
- def database_auto_common(suffix)
62
- database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
63
- inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
64
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, database_key)
65
- end
66
-
67
- def database_port_by_system
68
- read_entry_optional(::Avm::Instances::EntryKeys::DATABASE_SYSTEM).if_present do |v|
69
- DEFAULT_PORTS.fetch(v)
70
- end
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entry_keys'
4
-
5
- module Avm
6
- module Instances
7
- class Base
8
- module AutoValues
9
- module Filesystem
10
- def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
12
- ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
13
- end
14
-
15
- def auto_data_fs_path
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
17
- ::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
18
- end
19
-
20
- def auto_fs_url
21
- auto_fs_url_with_ssh || auto_fs_url_without_ssh
22
- end
23
-
24
- def auto_fs_url_with_ssh
25
- read_entry_optional('ssh.url').if_present do |ssh_url|
26
- read_entry_optional('fs_path').if_present do |fs_path|
27
- "#{ssh_url}#{fs_path}"
28
- end
29
- end
30
- end
31
-
32
- def auto_fs_url_without_ssh
33
- return nil if read_entry_optional('ssh.url').present?
34
-
35
- read_entry_optional('fs_path').if_present do |fs_path|
36
- "file://#{fs_path}"
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entry'
4
- require 'avm/instances/entry_keys'
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- module Mailer
11
- ::Avm::Instances::EntryKeys.all.select { |c| c.to_s.start_with?('mailer.') }
12
- .reject { |c| c == ::Avm::Instances::EntryKeys::MAILER_ID }
13
- .each do |mailer_key|
14
- define_method ::Avm::Instances::Entry.auto_value_method_name(mailer_key) do
15
- mailer_auto_common(mailer_key)
16
- end
17
- end
18
-
19
- def auto_mailer_id
20
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
21
- ::Avm::Instances::EntryKeys::MAILER_ID) ||
22
- read_entry_optional(::Avm::Instances::EntryKeys::HOST_ID)
23
- end
24
-
25
- private
26
-
27
- def mailer_auto_common(mailer_key)
28
- inherited_entry_value(::Avm::Instances::EntryKeys::MAILER_ID, mailer_key)
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Ruby
8
- def auto_ruby_version
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ruby.version')
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Source
8
- def auto_source_instance_id
9
- "#{application.id}_dev"
10
- end
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'addressable'
4
-
5
- module Avm
6
- module Instances
7
- class Base
8
- module AutoValues
9
- module System
10
- def auto_system_username
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.username') ||
12
- read_entry_optional('ssh.username')
13
- end
14
-
15
- def auto_system_groupname
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.groupname') ||
17
- read_entry_optional('system.username')
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'addressable'
4
- require 'avm/instances/entry_keys'
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- module Web
11
- def auto_web_authority
12
- web_url_as_uri(&:authority)
13
- end
14
-
15
- def auto_web_hostname
16
- web_url_as_uri(&:host)
17
- end
18
-
19
- def auto_web_path
20
- web_url_as_uri(&:path)
21
- end
22
-
23
- def auto_web_port
24
- web_url_as_uri(&:port)
25
- end
26
-
27
- def auto_web_scheme
28
- web_url_as_uri(&:scheme)
29
- end
30
-
31
- def auto_web_userinfo
32
- web_url_as_uri(&:userinfo)
33
- end
34
-
35
- private
36
-
37
- def web_url_as_uri
38
- read_entry_optional(::Avm::Instances::EntryKeys::WEB_URL).if_present do |v|
39
- yield(::Addressable::URI.parse(v))
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- extend ::ActiveSupport::Concern
11
-
12
- included do
13
- %w[Access Admin Data Database Filesystem Mailer Ruby Source System Web]
14
- .each do |class_name|
15
- include const_get(class_name)
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_docker/executables'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'avm/docker/container'
6
-
7
- module Avm
8
- module Instances
9
- class Base
10
- module Dockerizable
11
- enable_simple_cache
12
- attr_reader :docker_image_options
13
-
14
- def docker_image_options=(options)
15
- @docker_image_options = ::ActiveSupport::HashWithIndifferentAccess.new(options)
16
- reset_cache
17
- end
18
-
19
- def docker_container_exist?
20
- ::EacDocker::Executables.docker.command.append(
21
- ['ps', '-qaf', "name=#{docker_container_name}"]
22
- ).execute!.present?
23
- end
24
-
25
- def docker_container_name
26
- id
27
- end
28
-
29
- private
30
-
31
- def docker_container_uncached
32
- ::Avm::Docker::Container.new(self)
33
- end
34
-
35
- def docker_image_uncached
36
- r = docker_image_class.new(docker_image_options.fetch(:registry))
37
- r.instance = self if r.respond_to?(:instance)
38
- r.version = docker_image_options[:version] if docker_image_options.key?(:version)
39
- r.snapshot = docker_image_options[:snapshot] if docker_image_options.key?(:snapshot)
40
- r
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entry_keys'
4
-
5
- module Avm
6
- module Instances
7
- class Base
8
- module EntryKeys
9
- ::Avm::Instances::EntryKeys.all.each do |key|
10
- method_name = key.to_s.variableize
11
- define_method method_name do
12
- read_entry(key)
13
- end
14
-
15
- define_method "#{method_name}_optional" do
16
- read_entry(key, required: false)
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,64 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/require_sub'
4
- require 'eac_ruby_utils/simple_cache'
5
- require 'avm/instances/entries'
6
-
7
- module Avm
8
- module Instances
9
- class Base
10
- enable_listable
11
- enable_simple_cache
12
- require_sub __FILE__, include_modules: true
13
- include ::Avm::Instances::Entries
14
-
15
- lists.add_string :access, :local, :ssh
16
-
17
- ID_PATTERN = /\A([a-z0-9]+(?:\-[a-z0-9]+)*)_(.+)\z/.freeze
18
-
19
- class << self
20
- def by_id(id)
21
- application_id, suffix = parse_id(id)
22
- require 'avm/instances/application'
23
- new(::Avm::Instances::Application.new(application_id), suffix)
24
- end
25
-
26
- private
27
-
28
- def parse_id(id)
29
- m = ID_PATTERN.match(id)
30
- return [m[1], m[2]] if m
31
-
32
- raise "ID Pattern no matched: \"#{id}\""
33
- end
34
- end
35
-
36
- common_constructor :application, :suffix do
37
- self.suffix = suffix.to_s
38
- end
39
-
40
- def id
41
- "#{application.id}_#{suffix}"
42
- end
43
-
44
- def to_s
45
- id
46
- end
47
-
48
- def host_env_uncached
49
- access = read_entry(:access, list: ::Avm::Instances::Base.lists.access.values)
50
- case access
51
- when 'local' then ::EacRubyUtils::Envs.local
52
- when 'ssh' then ::EacRubyUtils::Envs.ssh(read_entry('ssh.url'))
53
- else raise("Unmapped access value: \"#{access}\"")
54
- end
55
- end
56
-
57
- private
58
-
59
- def source_instance_uncached
60
- ::Avm::Instances::Base.by_id(source_instance_id)
61
- end
62
- end
63
- end
64
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/docker/image'
4
-
5
- module Avm
6
- module Instances
7
- class DockerImage < ::Avm::Docker::Image
8
- attr_accessor :instance
9
-
10
- def stereotype_tag
11
- instance.id
12
- end
13
- end
14
- end
15
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'avm/instances/entry'
5
-
6
- module Avm
7
- module Instances
8
- module Entries
9
- def entry(suffix, options = {})
10
- ::Avm::Instances::Entry.new(self, suffix, options)
11
- end
12
-
13
- def path_prefix
14
- @path_prefix ||= [id].freeze
15
- end
16
-
17
- def read_entry(entry_suffix, options = {})
18
- entry(entry_suffix, options).value
19
- end
20
-
21
- def read_entry_optional(entry_suffix, options = {})
22
- entry(entry_suffix, options).optional_value
23
- end
24
-
25
- def full_entry_path(entry_suffix)
26
- unless entry_suffix.is_a?(::Array)
27
- entry_suffix = ::EacConfig::PathsHash.parse_entry_key(entry_suffix.to_s)
28
- end
29
- (path_prefix + entry_suffix).join('.')
30
- end
31
-
32
- def inherited_entry_value(source_entry_suffix, target_entry_suffix, &block)
33
- read_entry_optional(source_entry_suffix).if_present do |instance_id|
34
- other_entry_value(instance_id, target_entry_suffix).if_present(&block)
35
- end
36
- end
37
-
38
- def other_entry_value(instance_id, entry_suffix)
39
- ::Avm::Instances::Base.by_id(instance_id).read_entry_optional(entry_suffix)
40
- end
41
- end
42
- end
43
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_config/node'
4
- require 'eac_ruby_utils/core_ext'
5
-
6
- module Avm
7
- module Instances
8
- class Entry
9
- class << self
10
- def auto_value_method_name(suffix)
11
- "auto_#{suffix.to_s.gsub('.', '_')}"
12
- end
13
- end
14
-
15
- common_constructor :parent, :suffix, :options
16
-
17
- def auto_value
18
- parent.respond_to?(auto_value_method, true) ? parent.send(auto_value_method) : nil
19
- end
20
-
21
- def auto_value_method
22
- self.class.auto_value_method_name(suffix)
23
- end
24
-
25
- def full_path
26
- (parent.path_prefix + suffix_as_array).join('.')
27
- end
28
-
29
- def optional_value
30
- context_entry.found? ? context_entry.value : auto_value
31
- end
32
-
33
- def read
34
- context_entry.value
35
- end
36
-
37
- def suffix_as_array
38
- if suffix.is_a?(::Array)
39
- suffix.dup
40
- else
41
- ::EacConfig::PathsHash.parse_entry_key(suffix.to_s)
42
- end
43
- end
44
-
45
- def value
46
- optional_value || read
47
- end
48
-
49
- def write(value)
50
- context_entry.value = value
51
- end
52
-
53
- private
54
-
55
- def context_entry
56
- ::EacConfig::Node.context.current.entry(full_path)
57
- end
58
- end
59
- end
60
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module Instances
7
- module EntryKeys
8
- class << self
9
- def all
10
- all_keys.to_a
11
- end
12
-
13
- def keys_consts_set(prefix, suffixes)
14
- if suffixes.is_a?(::Hash)
15
- keys_consts_set_from_hash(prefix, suffixes)
16
- elsif suffixes.is_a?(::Enumerable)
17
- keys_consts_set_from_enum(prefix, suffixes)
18
- else
19
- raise "Unmapped suffixes class: #{suffixes.class}"
20
- end
21
- end
22
-
23
- def key_const_set(prefix, suffix)
24
- key = [prefix, suffix].reject(&:blank?).join('.')
25
- const_set(key.gsub('.', '_').upcase, key)
26
- all_keys << key
27
- end
28
-
29
- private
30
-
31
- def all_keys
32
- @all_keys ||= ::Set.new
33
- end
34
-
35
- def keys_consts_set_from_enum(prefix, suffixes)
36
- suffixes.each { |suffix| key_const_set(prefix, suffix) }
37
- end
38
-
39
- def keys_consts_set_from_hash(prefix, suffixes)
40
- suffixes.each { |k, v| keys_consts_set(prefix.to_s + (k.blank? ? '' : ".#{k}"), v) }
41
- end
42
- end
43
-
44
- {
45
- '' => %w[data_fs_path fs_path host_id name source_instance_id],
46
- admin: %w[username password api_key],
47
- database: %w[id hostname limit name password port system timeout username extra],
48
- docker: %w[registry],
49
- fs: %w[url],
50
- mailer: {
51
- '' => %w[id from reply_to],
52
- smtp: %w[address port domain username password authentication openssl_verify_mode
53
- starttls_auto tls]
54
- },
55
- ssh: %w[hostname port url username],
56
- web: %w[authority hostname path port scheme url userinfo]
57
- }.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
58
- end
59
- end
60
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/runners/base'
4
- require 'eac_cli/core_ext'
5
-
6
- module Avm
7
- module Instances
8
- class Runner < ::Avm::Runners::Base
9
- class << self
10
- def instance_class
11
- ::Avm.const_get(stereotype_name).const_get('Instance')
12
- end
13
-
14
- def stereotype_module
15
- ::Avm.const_get(stereotype_name)
16
- end
17
-
18
- def stereotype_name
19
- name.demodulize
20
- end
21
- end
22
-
23
- description = "Utilities for #{stereotype_name} instances."
24
- runner_with :help, :subcommands do
25
- desc description
26
- pos_arg 'instance-id'
27
- subcommands
28
- end
29
-
30
- delegate :instance_class, :stereotype_module, :stereotype_name, to: :class
31
-
32
- private
33
-
34
- def instance_uncached
35
- self.class.instance_class.by_id(parsed.instance_id)
36
- end
37
- end
38
- end
39
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- require 'avm/instances/application'
6
- require 'avm/instances/entries'
7
- end
8
- end