avm-tools 0.119.0 → 0.120.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) 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/app_src.rb +1 -5
  4. data/lib/avm/tools/runner/app_src/ruby.rb +0 -1
  5. data/lib/avm/tools/version.rb +1 -1
  6. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/sources/base.rb +2 -2
  7. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  8. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/sources/base.rb +3 -3
  9. data/sub/avm-eac_redmine_base0/lib/avm/eac_redmine_base0/version.rb +1 -1
  10. metadata +6 -232
  11. data/lib/avm/patches/eac_ruby_gems_utils/gem.rb +0 -29
  12. data/lib/avm/patches/eac_ruby_gems_utils.rb +0 -4
  13. data/sub/avm/Gemfile +0 -5
  14. data/sub/avm/avm.gemspec +0 -26
  15. data/sub/avm/lib/avm/data/instance/files_unit.rb +0 -40
  16. data/sub/avm/lib/avm/data/instance/package.rb +0 -18
  17. data/sub/avm/lib/avm/data/instance/unit.rb +0 -17
  18. data/sub/avm/lib/avm/data/instance.rb +0 -11
  19. data/sub/avm/lib/avm/data/package/dump.rb +0 -119
  20. data/sub/avm/lib/avm/data/package/load.rb +0 -48
  21. data/sub/avm/lib/avm/data/package.rb +0 -42
  22. data/sub/avm/lib/avm/data/rotate.rb +0 -107
  23. data/sub/avm/lib/avm/data/unit.rb +0 -94
  24. data/sub/avm/lib/avm/docker/container.rb +0 -50
  25. data/sub/avm/lib/avm/docker/image.rb +0 -71
  26. data/sub/avm/lib/avm/docker/runner.rb +0 -125
  27. data/sub/avm/lib/avm/docker.rb +0 -9
  28. data/sub/avm/lib/avm/executables.rb +0 -24
  29. data/sub/avm/lib/avm/instances/application.rb +0 -29
  30. data/sub/avm/lib/avm/instances/base/auto_values/access.rb +0 -40
  31. data/sub/avm/lib/avm/instances/base/auto_values/admin.rb +0 -19
  32. data/sub/avm/lib/avm/instances/base/auto_values/data.rb +0 -26
  33. data/sub/avm/lib/avm/instances/base/auto_values/database.rb +0 -76
  34. data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +0 -43
  35. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +0 -34
  36. data/sub/avm/lib/avm/instances/base/auto_values/ruby.rb +0 -15
  37. data/sub/avm/lib/avm/instances/base/auto_values/source.rb +0 -15
  38. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
  39. data/sub/avm/lib/avm/instances/base/auto_values/web.rb +0 -46
  40. data/sub/avm/lib/avm/instances/base/auto_values.rb +0 -21
  41. data/sub/avm/lib/avm/instances/base/dockerizable.rb +0 -45
  42. data/sub/avm/lib/avm/instances/base/entry_keys.rb +0 -22
  43. data/sub/avm/lib/avm/instances/base.rb +0 -64
  44. data/sub/avm/lib/avm/instances/docker_image.rb +0 -15
  45. data/sub/avm/lib/avm/instances/entries.rb +0 -43
  46. data/sub/avm/lib/avm/instances/entry.rb +0 -60
  47. data/sub/avm/lib/avm/instances/entry_keys.rb +0 -60
  48. data/sub/avm/lib/avm/instances/runner.rb +0 -39
  49. data/sub/avm/lib/avm/instances.rb +0 -8
  50. data/sub/avm/lib/avm/jobs/base.rb +0 -63
  51. data/sub/avm/lib/avm/jobs/variables_source.rb +0 -22
  52. data/sub/avm/lib/avm/jobs.rb +0 -9
  53. data/sub/avm/lib/avm/launcher/errors/base.rb +0 -10
  54. data/sub/avm/lib/avm/launcher/errors/non_project.rb +0 -15
  55. data/sub/avm/lib/avm/launcher/paths/real.rb +0 -44
  56. data/sub/avm/lib/avm/launcher/publish/check_result.rb +0 -67
  57. data/sub/avm/lib/avm/path_string.rb +0 -27
  58. data/sub/avm/lib/avm/registry/base.rb +0 -67
  59. data/sub/avm/lib/avm/registry.rb +0 -29
  60. data/sub/avm/lib/avm/result.rb +0 -86
  61. data/sub/avm/lib/avm/rspec/setup.rb +0 -22
  62. data/sub/avm/lib/avm/rspec/shared_examples/in_avm_registry.rb +0 -11
  63. data/sub/avm/lib/avm/rspec/shared_examples/not_in_avm_registry.rb +0 -14
  64. data/sub/avm/lib/avm/rspec.rb +0 -9
  65. data/sub/avm/lib/avm/runners/base.rb +0 -27
  66. data/sub/avm/lib/avm/scms/base.rb +0 -46
  67. data/sub/avm/lib/avm/scms/commit.rb +0 -43
  68. data/sub/avm/lib/avm/scms/inflector.rb +0 -22
  69. data/sub/avm/lib/avm/self/docker_image.rb +0 -14
  70. data/sub/avm/lib/avm/self/instance/entry_keys.rb +0 -12
  71. data/sub/avm/lib/avm/self/instance.rb +0 -31
  72. data/sub/avm/lib/avm/sources/base/configuration.rb +0 -45
  73. data/sub/avm/lib/avm/sources/base/instance.rb +0 -28
  74. data/sub/avm/lib/avm/sources/base/parent.rb +0 -31
  75. data/sub/avm/lib/avm/sources/base/subs.rb +0 -55
  76. data/sub/avm/lib/avm/sources/base/subs_paths.rb +0 -32
  77. data/sub/avm/lib/avm/sources/base/testing.rb +0 -21
  78. data/sub/avm/lib/avm/sources/base.rb +0 -54
  79. data/sub/avm/lib/avm/sources/configuration/locale.rb +0 -18
  80. data/sub/avm/lib/avm/sources/configuration/rubocop.rb +0 -26
  81. data/sub/avm/lib/avm/sources/configuration/tests.rb +0 -29
  82. data/sub/avm/lib/avm/sources/configuration.rb +0 -59
  83. data/sub/avm/lib/avm/sources/tester.rb +0 -24
  84. data/sub/avm/lib/avm/sources/tests/builder.rb +0 -83
  85. data/sub/avm/lib/avm/sources/tests/performer.rb +0 -35
  86. data/sub/avm/lib/avm/sources/tests/result.rb +0 -15
  87. data/sub/avm/lib/avm/sources/tests/single.rb +0 -56
  88. data/sub/avm/lib/avm/sources/tests.rb +0 -11
  89. data/sub/avm/lib/avm/sources.rb +0 -9
  90. data/sub/avm/lib/avm/sync.rb +0 -94
  91. data/sub/avm/lib/avm/version.rb +0 -5
  92. data/sub/avm/lib/avm/version_number.rb +0 -45
  93. data/sub/avm/lib/avm.rb +0 -7
  94. data/sub/avm/spec/lib/avm/scms/base_spec.rb +0 -7
  95. data/sub/avm/spec/lib/avm/sources/base_spec.rb +0 -7
  96. data/sub/avm/spec/rubocop_spec.rb +0 -3
  97. data/sub/avm/spec/spec_helper.rb +0 -4
  98. data/sub/avm-eac_rails_base1/Gemfile +0 -5
  99. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +0 -21
  100. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/apache_host.rb +0 -17
  101. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/instance.rb +0 -24
  102. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/bundle.rb +0 -26
  103. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/code_runner.rb +0 -26
  104. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/log.rb +0 -43
  105. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/logs/clear.rb +0 -26
  106. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/logs.rb +0 -18
  107. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/rails_server.rb +0 -32
  108. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler/systemd_unit.rb +0 -46
  109. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner/tasks_scheduler.rb +0 -17
  110. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner.rb +0 -12
  111. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/bundle.rb +0 -27
  112. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/runner_with/rails_environment.rb +0 -47
  113. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/sources/base.rb +0 -27
  114. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/service.rb +0 -70
  115. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.rb +0 -29
  116. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +0 -57
  117. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +0 -7
  118. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1.rb +0 -9
  119. data/sub/avm-eac_rails_base1/spec/rubocop_spec.rb +0 -3
  120. data/sub/avm-eac_rails_base1/spec/spec_helper.rb +0 -4
  121. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler.service +0 -12
  122. data/sub/avm-eac_rails_base1/template/avm/eac_rails_base1/systemd_unit/tasks_scheduler_command.sh +0 -6
  123. data/sub/avm-eac_ruby_base1/Gemfile +0 -5
  124. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +0 -22
  125. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/add_or_replace_gem_line.rb +0 -56
  126. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile/dependency.rb +0 -19
  127. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/gemfile.rb +0 -34
  128. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/depends_on.rb +0 -25
  129. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/gem_conflict.rb +0 -44
  130. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/in_gemfile.rb +0 -17
  131. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_buffer.rb +0 -73
  132. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_factory.rb +0 -31
  133. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/line_parser_base.rb +0 -19
  134. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser/version_requirement.rb +0 -26
  135. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler/incompatible_parser.rb +0 -25
  136. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/bundler.rb +0 -11
  137. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/configured.rb +0 -31
  138. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/envvar.rb +0 -17
  139. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop/gemfile.rb +0 -41
  140. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubocop.rb +0 -55
  141. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundle_command.rb +0 -39
  142. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundler.rb +0 -39
  143. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/version_bump.rb +0 -23
  144. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +0 -55
  145. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/incompatible.rb +0 -76
  146. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler.rb +0 -19
  147. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners.rb +0 -13
  148. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/tester.rb +0 -38
  149. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb +0 -56
  150. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update.rb +0 -52
  151. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources.rb +0 -11
  152. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +0 -7
  153. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1.rb +0 -9
  154. data/sub/avm-eac_ruby_base1/locale/en.yml +0 -8
  155. data/sub/avm-eac_ruby_base1/locale/pt-BR.yml +0 -8
  156. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec.rb +0 -7
  157. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/1.source.out +0 -192
  158. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/1.target.yaml +0 -300
  159. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.source.out +0 -245
  160. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/bundler/incompatible_parser_spec_files/2.target.yaml +0 -355
  161. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/sources/base_spec.rb +0 -7
  162. data/sub/avm-eac_ruby_base1/spec/rubocop_spec.rb +0 -3
  163. data/sub/avm-eac_ruby_base1/spec/spec_helper.rb +0 -4
  164. data/sub/eac_ruby_base0/Gemfile +0 -5
  165. data/sub/eac_ruby_base0/eac_ruby_base0.gemspec +0 -21
  166. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application.rb +0 -87
  167. data/sub/eac_ruby_base0/lib/eac_ruby_base0/application_xdg.rb +0 -34
  168. data/sub/eac_ruby_base0/lib/eac_ruby_base0/core_ext.rb +0 -5
  169. data/sub/eac_ruby_base0/lib/eac_ruby_base0/jobs_runner.rb +0 -31
  170. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/class/jobs_runner.rb +0 -10
  171. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/class.rb +0 -4
  172. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object/runner_with.rb +0 -5
  173. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches/object.rb +0 -5
  174. data/sub/eac_ruby_base0/lib/eac_ruby_base0/patches.rb +0 -4
  175. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec/setup.rb +0 -14
  176. data/sub/eac_ruby_base0/lib/eac_ruby_base0/rspec.rb +0 -9
  177. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +0 -92
  178. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/confirmation.rb +0 -42
  179. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/filesystem_traverser.rb +0 -52
  180. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/input.rb +0 -36
  181. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with/output.rb +0 -58
  182. data/sub/eac_ruby_base0/lib/eac_ruby_base0/runner_with.rb +0 -9
  183. data/sub/eac_ruby_base0/lib/eac_ruby_base0/version.rb +0 -5
  184. data/sub/eac_ruby_base0/lib/eac_ruby_base0.rb +0 -7
  185. data/sub/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/confirmation_spec.rb +0 -42
  186. data/sub/eac_ruby_base0/spec/lib/eac_ruby_base0/runner_with/output_spec.rb +0 -81
  187. data/sub/eac_ruby_base0/spec/rubocop_spec.rb +0 -3
  188. data/sub/eac_ruby_base0/spec/spec_helper.rb +0 -4
  189. data/sub/eac_ruby_gems_utils/Gemfile +0 -5
  190. data/sub/eac_ruby_gems_utils/LICENCE +0 -16
  191. data/sub/eac_ruby_gems_utils/README.rdoc +0 -3
  192. data/sub/eac_ruby_gems_utils/eac_ruby_gems_utils.gemspec +0 -31
  193. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/command.rb +0 -33
  194. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem/version_file.rb +0 -41
  195. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/gem.rb +0 -97
  196. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/base.rb +0 -57
  197. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/minitest.rb +0 -25
  198. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/decorated_gem.rb +0 -48
  199. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple/result.rb +0 -25
  200. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/multiple.rb +0 -84
  201. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests/rspec.rb +0 -21
  202. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/tests.rb +0 -9
  203. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils/version.rb +0 -5
  204. data/sub/eac_ruby_gems_utils/lib/eac_ruby_gems_utils.rb +0 -7
  205. data/sub/eac_ruby_gems_utils/spec/code/rubocop_check_spec.rb +0 -3
  206. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec.rb +0 -14
  207. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem/version_file_spec_files/a_version_file.rb +0 -7
  208. data/sub/eac_ruby_gems_utils/spec/lib/eac_ruby_gems_utils/gem_spec.rb +0 -20
  209. data/sub/eac_ruby_gems_utils/spec/spec_helper.rb +0 -4
  210. data/sub/eac_ruby_gems_utils/spec/support/mygem/Gemfile +0 -5
  211. data/sub/eac_ruby_gems_utils/spec/support/mygem/Gemfile.lock +0 -19
  212. data/sub/eac_ruby_gems_utils/spec/support/mygem/Rakefile +0 -14
  213. data/sub/eac_ruby_gems_utils/spec/support/mygem/exe/myrunner +0 -5
  214. data/sub/eac_ruby_gems_utils/spec/support/mygem/lib/mygem/version.rb +0 -5
  215. data/sub/eac_ruby_gems_utils/spec/support/mygem/lib/mygem.rb +0 -5
  216. data/sub/eac_ruby_gems_utils/spec/support/mygem/mygem.gemspec +0 -16
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/instances/entries'
4
-
5
- module Avm
6
- module Instances
7
- class Application
8
- include ::Avm::Instances::Entries
9
-
10
- attr_reader :id
11
-
12
- def initialize(id)
13
- @id = id.to_s
14
- end
15
-
16
- def to_s
17
- id
18
- end
19
-
20
- def instance(suffix)
21
- ::Avm::Instances::Base.new(self, suffix)
22
- end
23
-
24
- def name
25
- entry(::Avm::Instances::EntryKeys::NAME).read
26
- end
27
- end
28
- end
29
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Access
8
- def auto_access
9
- read_entry_optional('ssh.url').present? ? 'ssh' : 'local'
10
- end
11
-
12
- def auto_ssh_hostname
13
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.hostname')
14
- end
15
-
16
- def auto_ssh_port
17
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.port') || 22
18
- end
19
-
20
- def auto_ssh_username
21
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.username')
22
- end
23
-
24
- def auto_ssh_url
25
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ssh.url') ||
26
- auto_ssh_url_by_parts
27
- end
28
-
29
- def auto_ssh_url_by_parts
30
- read_entry_optional('ssh.hostname').if_present do |a|
31
- a = read_entry_optional('ssh.username').if_present(a) { |v| "#{v}@#{a}" }
32
- a = read_entry_optional('ssh.port').if_present(a) { |v| "#{a}:#{v}" }
33
- "ssh://#{a}"
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module Instances
5
- class Base
6
- module AutoValues
7
- module Admin
8
- def auto_admin_email
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.email')
10
- end
11
-
12
- def auto_admin_name
13
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.name')
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/data/package/dump'
4
- require 'avm/self/instance'
5
-
6
- module Avm
7
- module Instances
8
- class Base
9
- module AutoValues
10
- module Data
11
- def auto_data_default_dump_path
12
- ::Avm::Self::Instance
13
- .default
14
- .read_entry_optional(::Avm::Self::Instance::EntryKeys::DATA_DEFAULT_PATH)
15
- .if_present do |v|
16
- ::File.join(
17
- v,
18
- "#{id}#{::Avm::Data::Instance::Package::Dump::DEFAULT_FILE_EXTENSION}"
19
- )
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -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