eac_tools 0.11.1 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -22
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +2 -2
  5. data/sub/avm/lib/avm/application_stereotypes/base.rb +11 -1
  6. data/sub/avm/lib/avm/instances/base/auto_values/admin.rb +2 -2
  7. data/sub/avm/lib/avm/instances/base/auto_values/database.rb +1 -1
  8. data/sub/avm/lib/avm/instances/base/auto_values/filesystem.rb +9 -8
  9. data/sub/avm/lib/avm/instances/base/auto_values/install.rb +48 -0
  10. data/sub/avm/lib/avm/instances/base/auto_values/mailer.rb +2 -2
  11. data/sub/avm/lib/avm/instances/base/auto_values/ruby.rb +1 -1
  12. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +3 -3
  13. data/sub/avm/lib/avm/instances/base/auto_values.rb +4 -5
  14. data/sub/avm/lib/avm/instances/base.rb +8 -8
  15. data/sub/avm/lib/avm/instances/entry_keys.rb +8 -7
  16. data/sub/avm/lib/avm/instances.rb +3 -2
  17. data/sub/avm/lib/avm/registry/application_stereotypes/build_available.rb +9 -6
  18. data/sub/avm/lib/avm/registry/application_stereotypes/stereotype_builder.rb +8 -5
  19. data/sub/avm/lib/avm/registry/source_generators.rb +16 -0
  20. data/sub/avm/lib/avm/registry.rb +2 -1
  21. data/sub/avm/lib/avm/scms/base.rb +2 -2
  22. data/sub/avm/lib/avm/source_generators/base.rb +29 -0
  23. data/sub/avm/lib/avm/source_generators.rb +9 -0
  24. data/sub/avm/lib/avm/sources/base.rb +4 -4
  25. data/sub/avm/lib/avm/version.rb +1 -1
  26. data/sub/avm/lib/avm/with/application_stereotype.rb +35 -0
  27. data/sub/avm/lib/avm/with/extra_subcommands.rb +44 -0
  28. data/sub/avm/spec/lib/avm/instances/base_spec.rb +50 -50
  29. data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +5 -3
  30. data/sub/avm-eac_rails_base0/avm-eac_rails_base0.gemspec +3 -3
  31. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/source_generators/base.rb +13 -0
  32. data/sub/avm-eac_rails_base0/lib/avm/eac_rails_base0/version.rb +1 -1
  33. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Gemfile +11 -0
  34. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/Rakefile +8 -0
  35. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/config/manifest.js +3 -0
  36. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/javascripts/application.js +1 -0
  37. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/assets/stylesheets/application.scss +1 -0
  38. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/application_controller.rb +4 -0
  39. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/controllers/welcome_controller.rb +5 -0
  40. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/app/views/welcome/index.html.erb +1 -0
  41. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/bundle +5 -0
  42. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rails +11 -0
  43. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/rake +11 -0
  44. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/bin/yarn +11 -0
  45. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/application.rb +11 -0
  46. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/boot.rb +5 -0
  47. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/cable.yml +8 -0
  48. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/credentials.yml.enc +1 -0
  49. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/environment.rb +7 -0
  50. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/puma.rb +39 -0
  51. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/routes.rb +5 -0
  52. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config/spring.rb +8 -0
  53. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/config.ru +7 -0
  54. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/db/schema.rb +1 -0
  55. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability.rb +20 -0
  56. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/lib/ability_mapping.rb +10 -0
  57. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/public/favicon.ico +0 -0
  58. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/code/rubocop_spec.rb +3 -0
  59. data/sub/avm-eac_rails_base0/template/avm/eac_rails_base0/source_generators/base/spec/spec_helper.rb +8 -0
  60. data/sub/avm-eac_rails_base1/avm-eac_rails_base1.gemspec +3 -2
  61. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/systemd_unit.rb +1 -1
  62. data/sub/avm-eac_rails_base1/lib/avm/eac_rails_base1/version.rb +1 -1
  63. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/add_or_replace_gem_line.rb +62 -0
  64. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec/dependency.rb +19 -0
  65. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/rubygems/gemspec.rb +42 -0
  66. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  67. data/sub/avm-tools/avm-tools.gemspec +1 -1
  68. data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +45 -0
  69. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  70. data/sub/eac_config/eac_config.gemspec +1 -1
  71. data/sub/eac_config/lib/eac_config/entry_path.rb +15 -4
  72. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  73. data/sub/eac_ruby_utils/lib/eac_ruby_utils/regexp_parser.rb +5 -0
  74. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/base.rb +67 -0
  75. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub/sub_file.rb +68 -0
  76. data/sub/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +2 -125
  77. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  78. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_module_a.rb +0 -0
  79. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec → require_sub/base_spec}/stubbed_not_module.rb +0 -0
  80. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/{require_sub_spec.rb → require_sub/base_spec.rb} +1 -1
  81. metadata +61 -18
  82. data/sub/avm/lib/avm/instances/base/auto_values/access.rb +0 -40
  83. data/sub/avm/lib/avm/with_application_stereotype.rb +0 -23
  84. data/sub/avm/lib/avm/with_dynamic_runners.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38f984e803945d01e0bd9befc7b53c3cbca3950a924195d50b50558f69812578
4
- data.tar.gz: 781bef8a0c526d89f19c70c042cbf6e6ddb461e297ca81cc64034288b2ebe3f4
3
+ metadata.gz: d8e33f3e6179cddcf3aaa81d8bed6e2396944fb81bc6064ebaaf2101301db2ff
4
+ data.tar.gz: 6217ef998e5b4222b90295be158905905e12573cf1d83ace772a70325de003c4
5
5
  SHA512:
6
- metadata.gz: 90ede8646c864d11fa0ccf495fc95307fca6e7707f5cb5649ab6b716cd95485a13dbe2db5d27ad80c0579e321b7cf6085be44e6784233a2b2f59bad63b877021
7
- data.tar.gz: d3c0986c5fcd2e5f89a8383974b2793f23e33a613c7a5e6cb76f6ee595a5fe3e635db49aff507bdd271343b9317ee0bab9a0b3669dc049beec18f3788027264d
6
+ metadata.gz: 49ab7e7819b789a1b13fb29c86c93f8b11c36f5b7d7b4ccc7e42aa62e211b5989c6f1fc5e04db2fa39266cbbb192286ad444ee55d0be1e31e7977895376418d5
7
+ data.tar.gz: 4cd10a7625697c078772c15883487e35644986a5bccaff9a06e4ad0f5467fffe82db0ab17aa404dfd3245112bf1c5f924bd247cbe361614ba5021cd0156902f0
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.11.1)
4
+ eac_tools (0.14.0)
5
5
  avm-eac_generic_base0 (~> 0.4)
6
- avm-eac_rails_base0 (~> 0.5)
7
- avm-eac_rails_base1 (~> 0.4, >= 0.4.1)
6
+ avm-eac_rails_base0 (~> 0.6, >= 0.6.1)
7
+ avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
8
8
  avm-eac_redmine_base0 (~> 0.11)
9
9
  avm-eac_redmine_plugin_base0 (~> 0.3)
10
- avm-eac_ruby_base1 (~> 0.11)
11
- avm-tools (~> 0.126)
12
- eac_ruby_utils (~> 0.96)
10
+ avm-eac_ruby_base1 (~> 0.12)
11
+ avm-tools (~> 0.127)
12
+ eac_ruby_utils (~> 0.97)
13
13
 
14
14
  PATH
15
15
  remote: sub/avm-eac_generic_base0
@@ -21,17 +21,18 @@ PATH
21
21
  PATH
22
22
  remote: sub/avm-eac_rails_base0
23
23
  specs:
24
- avm-eac_rails_base0 (0.5.0)
25
- avm-eac_rails_base1 (~> 0.3)
26
- eac_ruby_utils (~> 0.80, >= 0.80.2)
24
+ avm-eac_rails_base0 (0.6.1)
25
+ avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
26
+ eac_ruby_utils (~> 0.97)
27
27
 
28
28
  PATH
29
29
  remote: sub/avm-eac_rails_base1
30
30
  specs:
31
- avm-eac_rails_base1 (0.4.1)
32
- avm-eac_ruby_base1 (~> 0.9, >= 0.9.1)
31
+ avm-eac_rails_base1 (0.4.2)
32
+ avm (~> 0.31)
33
+ avm-eac_ruby_base1 (~> 0.11)
33
34
  avm-eac_webapp_base0 (~> 0.3)
34
- eac_ruby_utils (~> 0.95, >= 0.95.2)
35
+ eac_ruby_utils (~> 0.97)
35
36
 
36
37
  PATH
37
38
  remote: sub/avm-eac_redmine_base0
@@ -56,7 +57,7 @@ PATH
56
57
  PATH
57
58
  remote: sub/avm-eac_ruby_base1
58
59
  specs:
59
- avm-eac_ruby_base1 (0.11.0)
60
+ avm-eac_ruby_base1 (0.12.0)
60
61
  avm (~> 0.26)
61
62
  avm-eac_generic_base0 (~> 0.2)
62
63
  eac_ruby_utils (~> 0.95, >= 0.95.1)
@@ -64,9 +65,9 @@ PATH
64
65
  PATH
65
66
  remote: sub/avm-tools
66
67
  specs:
67
- avm-tools (0.126.0)
68
+ avm-tools (0.127.0)
68
69
  aranha-parsers (~> 0.4)
69
- avm (~> 0.27)
70
+ avm (~> 0.30)
70
71
  avm-eac_asciidoctor_base0 (~> 0.3, >= 0.3.4)
71
72
  avm-eac_ruby_base1 (~> 0.8)
72
73
  avm-eac_ubuntu_base0 (~> 0.3)
@@ -81,12 +82,12 @@ PATH
81
82
  PATH
82
83
  remote: sub/avm
83
84
  specs:
84
- avm (0.29.0)
85
+ avm (0.32.0)
85
86
  eac_cli (~> 0.27, >= 0.27.6)
86
- eac_config (~> 0.9)
87
+ eac_config (~> 0.10)
87
88
  eac_docker (~> 0.3)
88
89
  eac_git (~> 0.6)
89
- eac_ruby_utils (~> 0.95)
90
+ eac_ruby_utils (~> 0.97)
90
91
  eac_templates (~> 0.1, >= 0.1.1)
91
92
  filesize (~> 0.2)
92
93
  htmlbeautifier (~> 1.3, >= 1.3.1)
@@ -103,9 +104,9 @@ PATH
103
104
  PATH
104
105
  remote: sub/eac_config
105
106
  specs:
106
- eac_config (0.9.0)
107
+ eac_config (0.10.0)
107
108
  addressable
108
- eac_ruby_utils (~> 0.83)
109
+ eac_ruby_utils (~> 0.97)
109
110
 
110
111
  PATH
111
112
  remote: sub/eac_docker
@@ -134,7 +135,7 @@ PATH
134
135
  PATH
135
136
  remote: sub/eac_ruby_utils
136
137
  specs:
137
- eac_ruby_utils (0.96.0)
138
+ eac_ruby_utils (0.97.0)
138
139
  activesupport (>= 4, < 7)
139
140
  addressable (~> 2.6)
140
141
  bundler
@@ -268,7 +269,7 @@ GEM
268
269
  rainbow (3.1.1)
269
270
  rchardet (1.8.0)
270
271
  rexml (3.2.5)
271
- rouge (3.29.0)
272
+ rouge (3.30.0)
272
273
  rspec (3.11.0)
273
274
  rspec-core (~> 3.11.0)
274
275
  rspec-expectations (~> 3.11.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.11.1'
4
+ VERSION = '0.14.0'
5
5
  end
data/sub/avm/avm.gemspec CHANGED
@@ -13,10 +13,10 @@ Gem::Specification.new do |s|
13
13
  s.files = Dir['{lib}/**/*']
14
14
 
15
15
  s.add_dependency 'eac_cli', '~> 0.27', '>= 0.27.6'
16
- s.add_dependency 'eac_config', '~> 0.9'
16
+ s.add_dependency 'eac_config', '~> 0.10'
17
17
  s.add_dependency 'eac_docker', '~> 0.3'
18
18
  s.add_dependency 'eac_git', '~> 0.6'
19
- s.add_dependency 'eac_ruby_utils', '~> 0.95'
19
+ s.add_dependency 'eac_ruby_utils', '~> 0.97'
20
20
  s.add_dependency 'eac_templates', '~> 0.1', '>= 0.1.1'
21
21
  s.add_dependency 'filesize', '~> 0.2'
22
22
  s.add_dependency 'htmlbeautifier', '~> 1.3', '>= 1.3.1'
@@ -5,7 +5,11 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module ApplicationStereotypes
7
7
  class Base
8
- common_constructor :namespace_module, :instance_class, :source_class
8
+ enable_listable
9
+ lists.add_symbol :resource, :instance, :source, :source_generator
10
+ common_constructor :namespace_module, :resources do
11
+ self.resources = self.class.lists.resource.hash_keys_validate!(resources)
12
+ end
9
13
 
10
14
  # @return [String]
11
15
  def name
@@ -16,6 +20,12 @@ module Avm
16
20
  def to_s
17
21
  name
18
22
  end
23
+
24
+ lists.resource.each_value do |resource|
25
+ define_method "#{resource}_class" do
26
+ resources[resource]
27
+ end
28
+ end
19
29
  end
20
30
  end
21
31
  end
@@ -6,11 +6,11 @@ module Avm
6
6
  module AutoValues
7
7
  module Admin
8
8
  def auto_admin_email
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.email')
9
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.email')
10
10
  end
11
11
 
12
12
  def auto_admin_name
13
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'admin.name')
13
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'admin.name')
14
14
  end
15
15
  end
16
16
  end
@@ -61,7 +61,7 @@ module Avm
61
61
  def database_auto_common(suffix)
62
62
  database_key = ::Avm::Instances::EntryKeys.const_get("database_#{suffix}".upcase)
63
63
  inherited_entry_value(::Avm::Instances::EntryKeys::DATABASE_ID, database_key) ||
64
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, database_key)
64
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, database_key)
65
65
  end
66
66
 
67
67
  def database_port_by_system
@@ -8,29 +8,30 @@ module Avm
8
8
  module AutoValues
9
9
  module Filesystem
10
10
  def auto_fs_path
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
12
12
  ::Avm::Instances::EntryKeys::FS_PATH) { |v| v + '/' + id }
13
13
  end
14
14
 
15
15
  def auto_data_fs_path
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
17
17
  ::Avm::Instances::EntryKeys::DATA_FS_PATH) { |v| v + '/' + id }
18
18
  end
19
19
 
20
20
  def auto_fs_url
21
- auto_fs_url_with_ssh || auto_fs_url_without_ssh
21
+ auto_fs_url_with_install || auto_fs_url_without_install
22
22
  end
23
23
 
24
- def auto_fs_url_with_ssh
25
- read_entry_optional('ssh.url').if_present do |ssh_url|
24
+ def auto_fs_url_with_install
25
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL)
26
+ .if_present do |install_url|
26
27
  read_entry_optional('fs_path').if_present do |fs_path|
27
- "#{ssh_url}#{fs_path}"
28
+ "#{install_url}#{fs_path}"
28
29
  end
29
30
  end
30
31
  end
31
32
 
32
- def auto_fs_url_without_ssh
33
- return nil if read_entry_optional('ssh.url').present?
33
+ def auto_fs_url_without_install
34
+ return nil if read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present?
34
35
 
35
36
  read_entry_optional('fs_path').if_present do |fs_path|
36
37
  "file://#{fs_path}"
@@ -0,0 +1,48 @@
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 Install
10
+ def auto_access
11
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present? ? 'ssh' : 'local'
12
+ end
13
+
14
+ def auto_install_hostname
15
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
16
+ ::Avm::Instances::EntryKeys::INSTALL_HOSTNAME)
17
+ end
18
+
19
+ def auto_install_port
20
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
21
+ ::Avm::Instances::EntryKeys::INSTALL_PORT) || 22
22
+ end
23
+
24
+ def auto_install_username
25
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
26
+ ::Avm::Instances::EntryKeys::INSTALL_USERNAME)
27
+ end
28
+
29
+ def auto_install_url
30
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
31
+ ::Avm::Instances::EntryKeys::INSTALL_URL) ||
32
+ auto_install_url_by_parts
33
+ end
34
+
35
+ def auto_install_url_by_parts
36
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_HOSTNAME).if_present do |a|
37
+ a = read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
38
+ .if_present(a) { |v| "#{v}@#{a}" }
39
+ a = read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_PORT)
40
+ .if_present(a) { |v| "#{a}:#{v}" }
41
+ "ssh://#{a}"
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -17,9 +17,9 @@ module Avm
17
17
  end
18
18
 
19
19
  def auto_mailer_id
20
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID,
20
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
21
21
  ::Avm::Instances::EntryKeys::MAILER_ID) ||
22
- read_entry_optional(::Avm::Instances::EntryKeys::HOST_ID)
22
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_ID)
23
23
  end
24
24
 
25
25
  private
@@ -6,7 +6,7 @@ module Avm
6
6
  module AutoValues
7
7
  module Ruby
8
8
  def auto_ruby_version
9
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'ruby.version')
9
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'ruby.version')
10
10
  end
11
11
  end
12
12
  end
@@ -8,12 +8,12 @@ module Avm
8
8
  module AutoValues
9
9
  module System
10
10
  def auto_system_username
11
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.username') ||
12
- read_entry_optional('ssh.username')
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.username') ||
12
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
13
13
  end
14
14
 
15
15
  def auto_system_groupname
16
- inherited_entry_value(::Avm::Instances::EntryKeys::HOST_ID, 'system.groupname') ||
16
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID, 'system.groupname') ||
17
17
  read_entry_optional('system.username')
18
18
  end
19
19
  end
@@ -1,16 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
3
+ require 'eac_ruby_utils/core_ext'
5
4
 
6
5
  module Avm
7
6
  module Instances
8
7
  class Base
9
8
  module AutoValues
10
- extend ::ActiveSupport::Concern
9
+ require_sub __FILE__
11
10
 
12
- included do
13
- %w[Access Admin Data Database Filesystem Mailer Ruby Source System Web]
11
+ common_concern do
12
+ %w[Admin Data Database Filesystem Install Mailer Ruby Source System Web]
14
13
  .each do |class_name|
15
14
  include const_get(class_name)
16
15
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/with_application_stereotype'
4
- require 'avm/with_dynamic_runners'
3
+ require 'avm/with/application_stereotype'
4
+ require 'avm/with/extra_subcommands'
5
5
  require 'eac_ruby_utils/require_sub'
6
6
  require 'eac_ruby_utils/simple_cache'
7
7
  require 'avm/instances/entries'
@@ -14,8 +14,8 @@ module Avm
14
14
  enable_simple_cache
15
15
  require_sub __FILE__, include_modules: true
16
16
  include ::Avm::Instances::Entries
17
- include ::Avm::WithDynamicRunners
18
- include ::Avm::WithApplicationStereotype
17
+ include ::Avm::With::ExtraSubcommands
18
+ include ::Avm::With::ApplicationStereotype
19
19
 
20
20
  lists.add_string :access, :local, :ssh
21
21
 
@@ -51,11 +51,11 @@ module Avm
51
51
  end
52
52
 
53
53
  def host_env_uncached
54
- access = read_entry(:access, list: ::Avm::Instances::Base.lists.access.values)
55
- case access
54
+ install_uri = entry(::Avm::Instances::EntryKeys::INSTALL_URL).value.to_uri
55
+ case install_uri.scheme
56
56
  when 'local' then ::EacRubyUtils::Envs.local
57
- when 'ssh' then ::EacRubyUtils::Envs.ssh(read_entry('ssh.url'))
58
- else raise("Unmapped access value: \"#{access}\"")
57
+ when 'ssh' then ::EacRubyUtils::Envs.ssh(install_uri)
58
+ else raise("Unmapped access value: \"#{install_uri}\"")
59
59
  end
60
60
  end
61
61
 
@@ -5,6 +5,8 @@ require 'eac_ruby_utils/core_ext'
5
5
  module Avm
6
6
  module Instances
7
7
  module EntryKeys
8
+ URI_FIELDS = %i[fragment hostname password path port query scheme url username].freeze
9
+
8
10
  class << self
9
11
  def all
10
12
  all_keys.to_a
@@ -42,18 +44,17 @@ module Avm
42
44
  end
43
45
 
44
46
  {
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],
47
+ '' => %w[data_fs_path fs_path name source_instance_id],
48
+ admin: URI_FIELDS + %w[api_key],
49
+ database: URI_FIELDS + %w[id limit name system timeout extra],
48
50
  docker: %w[registry],
49
51
  fs: %w[url],
52
+ install: URI_FIELDS + %w[id],
50
53
  mailer: {
51
54
  '' => %w[id from reply_to],
52
- smtp: %w[address port domain username password authentication openssl_verify_mode
53
- starttls_auto tls]
55
+ smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
54
56
  },
55
- ssh: %w[hostname port url username],
56
- web: %w[authority hostname path port scheme url userinfo]
57
+ web: URI_FIELDS + %w[authority userinfo]
57
58
  }.each { |prefix, suffixes| keys_consts_set(prefix, suffixes) }
58
59
  end
59
60
  end
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'eac_ruby_utils/core_ext'
4
+
3
5
  module Avm
4
6
  module Instances
5
- require 'avm/applications/base'
6
- require 'avm/instances/entries'
7
+ require_sub __FILE__
7
8
  end
8
9
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/application_stereotypes/base'
3
4
  require 'avm/registry/application_stereotypes/stereotype_builder'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -13,8 +14,7 @@ module Avm
13
14
 
14
15
  def result
15
16
  reset_buffer
16
- read_instances_registry
17
- read_sources_registry
17
+ read_registries
18
18
  buffer.values.map(&:build)
19
19
  end
20
20
 
@@ -29,12 +29,15 @@ module Avm
29
29
  buffer[object.stereotype_namespace_module].add_object(type, object)
30
30
  end
31
31
 
32
- def read_instances_registry
33
- ::Avm::Registry.instances.available.each { |instance| read_object(:instance, instance) }
32
+ def read_registries
33
+ ::Avm::ApplicationStereotypes::Base.lists.resource.each_value do |resource|
34
+ read_registry(resource)
35
+ end
34
36
  end
35
37
 
36
- def read_sources_registry
37
- ::Avm::Registry.sources.available.each { |source| read_object(:source, source) }
38
+ def read_registry(resource)
39
+ ::Avm::Registry.send(resource.to_s.pluralize).available
40
+ .each { |obj| read_object(resource, obj) }
38
41
  end
39
42
 
40
43
  def reset_buffer
@@ -10,20 +10,23 @@ module Avm
10
10
  common_constructor :namespace_module
11
11
 
12
12
  def add_object(type, object)
13
- attr_method = "#{type}_class"
14
- raise "#{attr_method} is already present" if send(attr_method).present?
13
+ type = type.to_sym
14
+ raise "#{attr_method} is already present" if resources.key?(type)
15
15
 
16
- send("#{attr_method}=", object)
16
+ resources[::Avm::ApplicationStereotypes::Base.lists.resource.value_validate!(type)] =
17
+ object
17
18
  end
18
19
 
19
20
  # @return [Avm::ApplicationStereotypes::Base]
20
21
  def build
21
- ::Avm::ApplicationStereotypes::Base.new(namespace_module, instance_class, source_class)
22
+ ::Avm::ApplicationStereotypes::Base.new(namespace_module, resources)
22
23
  end
23
24
 
24
25
  private
25
26
 
26
- attr_accessor :instance_class, :source_class
27
+ def resources
28
+ @resources ||= {}
29
+ end
27
30
  end
28
31
  end
29
32
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+ require 'avm/registry/from_gems'
5
+
6
+ module Avm
7
+ module Registry
8
+ class SourceGenerators < ::Avm::Registry::FromGems
9
+ # @return [Avm::Instances::Base, nil]
10
+ def class_detect(klass, detect_args)
11
+ stereotype_name, target_path = detect_args
12
+ klass.application_stereotype.name == stereotype_name ? klass.new(target_path) : nil
13
+ end
14
+ end
15
+ end
16
+ end
@@ -7,7 +7,8 @@ module Avm
7
7
  module Registry
8
8
  require_sub __FILE__
9
9
  enable_listable
10
- lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms, :sources
10
+ lists.add_symbol :category, :application_stereotypes, :instances, :runners, :scms,
11
+ :source_generators, :sources
11
12
 
12
13
  WITH_PATH = [CATEGORY_SCMS, CATEGORY_SOURCES].freeze
13
14
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/with_application_stereotype'
3
+ require 'avm/with/application_stereotype'
4
4
  require 'eac_ruby_utils/core_ext'
5
5
 
6
6
  module Avm
@@ -8,7 +8,7 @@ module Avm
8
8
  class Base
9
9
  enable_abstract_methods
10
10
  enable_simple_cache
11
- include ::Avm::WithApplicationStereotype
11
+ include ::Avm::With::ApplicationStereotype
12
12
  abstract_methods :update, :valid?
13
13
  common_constructor :path do
14
14
  self.path = path.to_pathname
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/with/application_stereotype'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class Base
9
+ include ::Avm::With::ApplicationStereotype
10
+ common_constructor :target_path do
11
+ self.target_path = target_path.to_pathname
12
+ end
13
+
14
+ def perform
15
+ assert_clear_directory
16
+ apply_template
17
+ end
18
+
19
+ def assert_clear_directory
20
+ target_path.mkpath
21
+ raise "\"#{target_path}\" is not empty" if target_path.children.any?
22
+ end
23
+
24
+ def apply_template
25
+ template.apply(self, target_path)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module SourceGenerators
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -2,8 +2,8 @@
2
2
 
3
3
  require 'avm/registry'
4
4
  require 'avm/scms/null'
5
- require 'avm/with_application_stereotype'
6
- require 'avm/with_dynamic_runners'
5
+ require 'avm/with/application_stereotype'
6
+ require 'avm/with/extra_subcommands'
7
7
  require 'eac_git'
8
8
  require 'eac_ruby_utils/core_ext'
9
9
 
@@ -11,8 +11,8 @@ module Avm
11
11
  module Sources
12
12
  class Base
13
13
  require_sub __FILE__, include_modules: true
14
- include ::Avm::WithApplicationStereotype
15
- include ::Avm::WithDynamicRunners
14
+ include ::Avm::With::ApplicationStereotype
15
+ include ::Avm::With::ExtraSubcommands
16
16
  compare_by :path
17
17
  enable_abstract_methods
18
18
  enable_simple_cache
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.29.0'
4
+ VERSION = '0.32.0'
5
5
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module With
7
+ module ApplicationStereotype
8
+ common_concern do
9
+ include ClassMethods
10
+ end
11
+
12
+ module ClassMethods
13
+ # @return [Avm::ApplicationStereotype::Base]
14
+ def application_stereotype
15
+ @application_stereotype ||=
16
+ ::Avm::Registry.application_stereotypes.detect(application_stereotype_name)
17
+ end
18
+
19
+ # @return [String]
20
+ def application_stereotype_name
21
+ stereotype_namespace_module.name.demodulize
22
+ end
23
+
24
+ # @return [Module]
25
+ def stereotype_namespace_module
26
+ module_parent.module_parent
27
+ end
28
+ end
29
+
30
+ def stereotype_namespace_module
31
+ self.class.stereotype_namespace_module
32
+ end
33
+ end
34
+ end
35
+ end