eac_tools 0.16.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -15
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +24 -0
  5. data/sub/avm/lib/avm/entries/uri_builder.rb +85 -0
  6. data/sub/avm/lib/avm/instances/base/auto_values/install.rb +6 -9
  7. data/sub/avm/lib/avm/instances/base/auto_values.rb +2 -8
  8. data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
  9. data/sub/avm/lib/avm/registry/source_generators.rb +3 -2
  10. data/sub/avm/lib/avm/source_generators/base.rb +16 -1
  11. data/sub/avm/lib/avm/source_generators/option.rb +11 -0
  12. data/sub/avm/lib/avm/source_generators/option_list.rb +32 -0
  13. data/sub/avm/lib/avm/source_generators/runner.rb +52 -0
  14. data/sub/avm/lib/avm/sources/runner.rb +38 -0
  15. data/sub/avm/lib/avm/version.rb +1 -1
  16. data/sub/avm/spec/lib/avm/instances/base_spec.rb +18 -1
  17. data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
  18. data/sub/avm/spec/lib/avm/sources/runner_spec.rb +9 -0
  19. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb +12 -0
  20. data/sub/{avm-tools/lib/avm/rails.rb → avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb} +4 -2
  21. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
  22. data/sub/avm-eac_latex_base0/Gemfile +8 -0
  23. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +20 -0
  24. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +19 -0
  25. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +13 -0
  26. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +38 -0
  27. data/sub/{avm-tools/lib/avm/ruby/bundler.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/instances.rb} +2 -2
  28. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/base.rb +44 -0
  29. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb +49 -0
  30. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/commons.rb +16 -0
  31. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/copy_files.rb +45 -0
  32. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/base_stereotype.rb +23 -0
  33. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/chapter_index.rb +27 -0
  34. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/tex_source.rb +37 -0
  35. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file.rb +49 -0
  36. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +119 -0
  37. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb +43 -0
  38. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_single.rb +33 -0
  39. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/info.rb +32 -0
  40. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners.rb +13 -0
  41. data/sub/{avm-tools/lib/avm/ruby/gems.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0/sources.rb} +2 -2
  42. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +7 -0
  43. data/sub/{avm-tools/lib/avm/ruby.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0.rb} +1 -1
  44. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem → avm-eac_latex_base0}/spec/rubocop_spec.rb +0 -0
  45. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem → avm-eac_latex_base0}/spec/spec_helper.rb +0 -0
  46. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/all.tex +0 -0
  47. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/ebook.tex +0 -0
  48. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/images.tex +0 -0
  49. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/links.tex +0 -0
  50. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/portuguese.tex +0 -0
  51. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/source_code/java.tex +0 -0
  52. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/source_code.tex +0 -0
  53. data/sub/{avm-tools/template/avm/eac_writings_base0 → avm-eac_latex_base0/template/avm/eac_latex_base0/sources/build}/commons/utils.tex +0 -0
  54. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  55. data/sub/{avm-tools/lib/avm/ruby/gems/generator.rb → avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb} +27 -16
  56. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb +11 -0
  57. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb +84 -0
  58. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  59. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec.rb → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb} +8 -6
  60. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile +8 -0
  61. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/dashed-mygem.gemspec +0 -0
  62. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/lib/dashed/mygem/version.rb +0 -0
  63. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/dashed-mygem/lib/dashed/mygem.rb +0 -0
  64. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem}/spec/rubocop_spec.rb +0 -0
  65. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem}/spec/spec_helper.rb +0 -0
  66. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile +8 -0
  67. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/lib/mygem/version.rb +0 -0
  68. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/lib/mygem.rb +0 -0
  69. data/sub/{avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files}/mygem/mygem.gemspec +0 -0
  70. data/sub/{avm-tools/template/avm/ruby/gems/generator/static → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem}/spec/rubocop_spec.rb +0 -0
  71. data/sub/{avm-tools/template/avm/ruby/gems/generator/static → avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem}/spec/spec_helper.rb +0 -0
  72. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/gemspec.template +0 -0
  73. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/root_lib.template +0 -0
  74. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile +8 -0
  75. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/rubocop_spec.rb +3 -0
  76. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/spec/spec_helper.rb +4 -0
  77. data/sub/{avm-tools/template/avm/ruby/gems/generator → avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base}/version.template +0 -0
  78. data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +1 -0
  79. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
  80. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
  81. data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +4 -3
  82. data/sub/avm-tools/avm-tools.gemspec +1 -1
  83. data/sub/avm-tools/lib/avm/tools/runner/app_src.rb +4 -14
  84. data/sub/avm-tools/lib/avm/tools/runner/source_generate.rb +2 -35
  85. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  86. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
  87. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
  88. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
  89. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  90. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
  91. metadata +111 -71
  92. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
  93. data/sub/avm-tools/lib/avm/eac_writings_base0/apache_host.rb +0 -17
  94. data/sub/avm-tools/lib/avm/eac_writings_base0/commons.rb +0 -12
  95. data/sub/avm-tools/lib/avm/eac_writings_base0/deploy.rb +0 -36
  96. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
  97. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
  98. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
  99. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build.rb +0 -45
  100. data/sub/avm-tools/lib/avm/eac_writings_base0/instance.rb +0 -11
  101. data/sub/avm-tools/lib/avm/eac_writings_base0/project.rb +0 -33
  102. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
  103. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
  104. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build.rb +0 -117
  105. data/sub/avm-tools/lib/avm/eac_writings_base0.rb +0 -9
  106. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
  107. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
  108. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
  109. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
  110. data/sub/avm-tools/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
  111. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
  112. data/sub/avm-tools/lib/avm/tools/runner/ruby/gems.rb +0 -19
  113. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile +0 -5
  114. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/dashed-mygem/Gemfile.lock +0 -1
  115. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile +0 -5
  116. data/sub/avm-tools/spec/lib/avm/tools/runner/ruby/gems/generate_spec_files/mygem/Gemfile.lock +0 -1
  117. data/sub/avm-tools/template/avm/ruby/gems/generator/static/Gemfile +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 513a7b1831ba2dd5e165031fc1f689131b075ec62f7e2c78183930d58c7ed5de
4
- data.tar.gz: 96f079c0f2d9959141fd525d85c0ed635a1995875a46f2b8f41c9dac9635287b
3
+ metadata.gz: f682e3e2b625d82f32da7855fb153e206693a1c0d4c934e0bb9b16216b2f7998
4
+ data.tar.gz: 7cfa294cbdec42a2f1ad21199d2a744ccff5afc7e0c85714dd6685ee146781b4
5
5
  SHA512:
6
- metadata.gz: ae94b169daea661a21523243641efb35835496fd7d359e78ef7b97028a75930ad4b10af288163d54c3c72249de64695d6c7036ee39ee3aa45fdb06d7f13f2456
7
- data.tar.gz: 465d94225c6ac9016e4943dce37019ca37aa1b5a738d81df766dfb3512f24eeaab2cdac9e320b2858f38a60c0e6664b3bc3fbcb9b0866a879ac7458fb200db94
6
+ metadata.gz: 1743063c5a1e76873664826ccfdf0fdb4c78ff668098a4ee1c8da4a8312f43b9e88694f37e0011d394045065572165376a486a9a4cdeef0538fae441f38e7df8
7
+ data.tar.gz: 592727978f8b7902f25bc4b03252871dd80ef62611feb5fd0377ae822d6b379ea0c0ae2d050920a455b38ab40625fd67805f23d95209e674f060670e48b7c4fd
data/Gemfile.lock CHANGED
@@ -1,18 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.16.1)
4
+ eac_tools (0.19.0)
5
+ avm (~> 0.35)
5
6
  avm-eac_asciidoctor_base0 (~> 0.4)
6
- avm-eac_generic_base0 (~> 0.4)
7
+ avm-eac_generic_base0 (~> 0.5)
8
+ avm-eac_latex_base0 (~> 0.1)
7
9
  avm-eac_rails_base0 (~> 0.6, >= 0.6.1)
8
10
  avm-eac_rails_base1 (~> 0.4, >= 0.4.2)
9
11
  avm-eac_redmine_base0 (~> 0.11)
10
12
  avm-eac_redmine_plugin_base0 (~> 0.3)
11
- avm-eac_ruby_base1 (~> 0.12)
13
+ avm-eac_ruby_base1 (~> 0.16)
12
14
  avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
13
- avm-eac_wordpress_base0 (~> 0.1)
14
- avm-tools (~> 0.129, >= 0.129.1)
15
- eac_ruby_utils (~> 0.97)
15
+ avm-eac_wordpress_base0 (~> 0.1, >= 0.1.1)
16
+ avm-tools (~> 0.131)
17
+ eac_ruby_utils (~> 0.98)
16
18
 
17
19
  PATH
18
20
  remote: sub/avm-eac_asciidoctor_base0
@@ -27,10 +29,18 @@ PATH
27
29
  PATH
28
30
  remote: sub/avm-eac_generic_base0
29
31
  specs:
30
- avm-eac_generic_base0 (0.4.0)
32
+ avm-eac_generic_base0 (0.5.0)
31
33
  avm (~> 0.28)
32
34
  eac_ruby_utils (~> 0.96)
33
35
 
36
+ PATH
37
+ remote: sub/avm-eac_latex_base0
38
+ specs:
39
+ avm-eac_latex_base0 (0.1.0)
40
+ avm (~> 0.34)
41
+ avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
42
+ eac_ruby_utils (~> 0.97)
43
+
34
44
  PATH
35
45
  remote: sub/avm-eac_rails_base0
36
46
  specs:
@@ -70,8 +80,8 @@ PATH
70
80
  PATH
71
81
  remote: sub/avm-eac_ruby_base1
72
82
  specs:
73
- avm-eac_ruby_base1 (0.12.0)
74
- avm (~> 0.26)
83
+ avm-eac_ruby_base1 (0.16.0)
84
+ avm (~> 0.34)
75
85
  avm-eac_generic_base0 (~> 0.2)
76
86
  eac_ruby_utils (~> 0.95, >= 0.95.1)
77
87
 
@@ -88,16 +98,17 @@ PATH
88
98
  PATH
89
99
  remote: sub/avm-eac_wordpress_base0
90
100
  specs:
91
- avm-eac_wordpress_base0 (0.1.0)
101
+ avm-eac_wordpress_base0 (0.1.1)
102
+ avm (~> 0.35)
92
103
  avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
93
104
  eac_ruby_utils (~> 0.97)
94
105
 
95
106
  PATH
96
107
  remote: sub/avm-tools
97
108
  specs:
98
- avm-tools (0.129.1)
109
+ avm-tools (0.131.0)
99
110
  aranha-parsers (~> 0.4)
100
- avm (~> 0.30)
111
+ avm (~> 0.34)
101
112
  avm-eac_ruby_base1 (~> 0.8)
102
113
  avm-eac_ubuntu_base0 (~> 0.3)
103
114
  avm-files (~> 0.1)
@@ -113,7 +124,7 @@ PATH
113
124
  PATH
114
125
  remote: sub/avm
115
126
  specs:
116
- avm (0.33.0)
127
+ avm (0.35.0)
117
128
  eac_cli (~> 0.27, >= 0.27.6)
118
129
  eac_config (~> 0.10)
119
130
  eac_docker (~> 0.3)
@@ -166,7 +177,7 @@ PATH
166
177
  PATH
167
178
  remote: sub/eac_ruby_utils
168
179
  specs:
169
- eac_ruby_utils (0.97.0)
180
+ eac_ruby_utils (0.98.0)
170
181
  activesupport (>= 4, < 7)
171
182
  addressable (~> 2.6)
172
183
  bundler
@@ -232,7 +243,7 @@ GEM
232
243
  eac_templates (0.3.1)
233
244
  eac_config (~> 0.5)
234
245
  eac_ruby_utils (~> 0.64)
235
- faraday (1.10.0)
246
+ faraday (1.10.1)
236
247
  faraday-em_http (~> 1.0)
237
248
  faraday-em_synchrony (~> 1.0)
238
249
  faraday-excon (~> 1.1)
@@ -331,6 +342,7 @@ DEPENDENCIES
331
342
  avm!
332
343
  avm-eac_asciidoctor_base0!
333
344
  avm-eac_generic_base0!
345
+ avm-eac_latex_base0!
334
346
  avm-eac_rails_base0!
335
347
  avm-eac_rails_base1!
336
348
  avm-eac_redmine_base0!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.16.1'
4
+ VERSION = '0.19.0'
5
5
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/entries/uri_builder'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module Entries
8
+ module AutoValues
9
+ class UriEntry
10
+ common_constructor :entries_provider, :suffix
11
+
12
+ def found?
13
+ value.present?
14
+ end
15
+
16
+ def value
17
+ ::Avm::Entries::UriBuilder.from_all_fields do |field_name|
18
+ entries_provider.entry([suffix, field_name]).value
19
+ end.to_uri.to_s
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module Entries
7
+ class UriBuilder
8
+ require_sub __FILE__
9
+
10
+ FIELDS = %w[scheme user password host port path query fragment].freeze
11
+ FIELDS_TRANSLATIONS = {
12
+ username: :user, hostname: :host
13
+ }.freeze
14
+ ENTRIES_FIELDS = FIELDS.map do |field|
15
+ FIELDS_TRANSLATIONS.key(field.to_sym).if_present(field).to_s
16
+ end
17
+
18
+ class << self
19
+ def from_all_fields(&block)
20
+ r = new
21
+ ENTRIES_FIELDS.each do |field_name|
22
+ field_value = block.call(field_name)
23
+ r.field_set(field_name, field_value) if field_value.present?
24
+ end
25
+ r
26
+ end
27
+
28
+ def from_source(source)
29
+ if source.is_a?(::Addressable::URI)
30
+ from_source_uri(source)
31
+ elsif source.blank?
32
+ new
33
+ else
34
+ raise "Unexpected source: #{source}"
35
+ end
36
+ end
37
+
38
+ def from_source_uri(source_uri)
39
+ new(source_uri.to_hash)
40
+ end
41
+ end
42
+
43
+ common_constructor :data, default: [{}]
44
+
45
+ def field_get(name)
46
+ data[name.to_sym].if_present(&:to_s)
47
+ end
48
+
49
+ def field_set(field, value)
50
+ tfield = translate_field(field)
51
+ if FIELDS.include?(tfield)
52
+ main_field_set(tfield, value)
53
+ else
54
+ sub_field_set(tfield, value)
55
+ end
56
+ end
57
+
58
+ def translate_field(field)
59
+ if FIELDS_TRANSLATIONS.key?(field.to_sym)
60
+ FIELDS_TRANSLATIONS.fetch(field.to_sym).to_s
61
+ else
62
+ field.to_s
63
+ end
64
+ end
65
+
66
+ # @return [Addressable::URI, nil]
67
+ def to_uri
68
+ to_required_uri
69
+ rescue ::Addressable::URI::InvalidURIError
70
+ nil
71
+ end
72
+
73
+ # @return [Addressable::URI]
74
+ def to_required_uri
75
+ ::Addressable::URI.new(FIELDS.map { |f| [f.to_sym, field_get(f)] }.to_h)
76
+ end
77
+
78
+ private
79
+
80
+ def main_field_set(name, value)
81
+ data[name.to_sym] = value
82
+ end
83
+ end
84
+ end
85
+ end
@@ -7,8 +7,10 @@ module Avm
7
7
  class Base
8
8
  module AutoValues
9
9
  module Install
10
- def auto_access
11
- read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_URL).present? ? 'ssh' : 'local'
10
+ def auto_install_groupname
11
+ inherited_entry_value(::Avm::Instances::EntryKeys::INSTALL_ID,
12
+ ::Avm::Instances::EntryKeys::INSTALL_GROUPNAME) ||
13
+ read_entry_optional(::Avm::Instances::EntryKeys::INSTALL_USERNAME)
12
14
  end
13
15
 
14
16
  def auto_install_hostname
@@ -33,13 +35,8 @@ module Avm
33
35
  end
34
36
 
35
37
  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
38
+ require 'avm/entries/auto_values/uri_entry'
39
+ ::Avm::Entries::AutoValues::UriEntry.new(self, 'install').value
43
40
  end
44
41
  end
45
42
  end
@@ -6,14 +6,8 @@ module Avm
6
6
  module Instances
7
7
  class Base
8
8
  module AutoValues
9
- require_sub __FILE__
10
-
11
- common_concern do
12
- %w[Admin Data Database Filesystem Install Mailer Ruby Source System Web]
13
- .each do |class_name|
14
- include const_get(class_name)
15
- end
16
- end
9
+ require_sub __FILE__, include_modules: true
10
+ common_concern
17
11
  end
18
12
  end
19
13
  end
@@ -49,7 +49,7 @@ module Avm
49
49
  database: URI_FIELDS + %w[id limit name system timeout extra],
50
50
  docker: %w[registry],
51
51
  fs: %w[url],
52
- install: URI_FIELDS + %w[id],
52
+ install: URI_FIELDS + %w[id groupname],
53
53
  mailer: {
54
54
  '' => %w[id from reply_to],
55
55
  smtp: URI_FIELDS + %w[address domain authentication openssl_verify_mode starttls_auto tls]
@@ -8,8 +8,9 @@ module Avm
8
8
  class SourceGenerators < ::Avm::Registry::FromGems
9
9
  # @return [Avm::Instances::Base, nil]
10
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
11
+ detect_args = detect_args.dup
12
+ stereotype_name = detect_args.shift
13
+ klass.application_stereotype.name == stereotype_name ? klass.new(*detect_args) : nil
13
14
  end
14
15
  end
15
16
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/source_generators/option_list'
3
4
  require 'avm/with/application_stereotype'
4
5
  require 'eac_ruby_utils/core_ext'
5
6
 
@@ -7,8 +8,22 @@ module Avm
7
8
  module SourceGenerators
8
9
  class Base
9
10
  include ::Avm::With::ApplicationStereotype
10
- common_constructor :target_path do
11
+
12
+ class << self
13
+ # @return [Avm::SourceGenerators::OptionList]
14
+ def option_list
15
+ Avm::SourceGenerators::OptionList.new
16
+ end
17
+ end
18
+
19
+ common_constructor :target_path, :options, default: [{}] do
11
20
  self.target_path = target_path.to_pathname
21
+ self.options = option_list.validate(options)
22
+ end
23
+
24
+ # @return [Avm::SourceGenerators::OptionList]
25
+ def option_list
26
+ self.class.option_list
12
27
  end
13
28
 
14
29
  def perform
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module SourceGenerators
5
+ class Option
6
+ common_constructor :name, :description, default: [nil] do
7
+ self.name = name.to_sym
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/source_generators/option'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class OptionList
9
+ enable_immutable
10
+ immutable_accessor :option, type: :array
11
+
12
+ alias immutable_option option
13
+
14
+ def option(*args)
15
+ immutable_option(::Avm::SourceGenerators::Option.new(*args))
16
+ end
17
+
18
+ # @return [Hash<Symbol, String>]
19
+ def validate(options_hash)
20
+ options_hash.transform_keys { |k| validate_option(k) }
21
+ end
22
+
23
+ def validate_option(option_name)
24
+ option_name = option_name.to_sym
25
+
26
+ return option_name if options.any? { |option| option.name == option_name }
27
+
28
+ raise "No option found with name \"#{option_name}\""
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/registry'
4
+ require 'eac_cli/core_ext'
5
+
6
+ module Avm
7
+ module SourceGenerators
8
+ class Runner
9
+ OPTION_NAME_VALUE_SEPARATOR = ':'
10
+
11
+ runner_with :help do
12
+ arg_opt '-o', '--option', 'Option for generator.', repeat: true, optional: true
13
+ pos_arg :stereotype_name
14
+ pos_arg :target_path
15
+ end
16
+
17
+ def run
18
+ start_banner
19
+ generate
20
+ end
21
+
22
+ def generate
23
+ infom 'Generating...'
24
+ generator.perform
25
+ success "Source generated in \"#{generator.target_path}\""
26
+ end
27
+
28
+ def start_banner
29
+ infov 'Stereotype', stereotype_name
30
+ infov 'Target path', target_path
31
+ infov 'Generator', generator.class
32
+ end
33
+
34
+ def generator_uncached
35
+ ::Avm::Registry.source_generators
36
+ .detect_optional(stereotype_name, target_path, options) ||
37
+ fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
38
+ end
39
+
40
+ delegate :stereotype_name, to: :parsed
41
+
42
+ # @return [Hash<String, String>]
43
+ def options
44
+ parsed.option.map { |v| v.split(OPTION_NAME_VALUE_SEPARATOR) }.to_h
45
+ end
46
+
47
+ def target_path
48
+ parsed.target_path.to_pathname
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Avm
6
+ module Sources
7
+ class Runner
8
+ runner_with :help, :subcommands do
9
+ desc 'Root command for sources.'
10
+ arg_opt '-C', '--path', 'Path to the source.', default: '.'
11
+ subcommands
12
+ end
13
+
14
+ def extra_available_subcommands
15
+ optional_source.if_present({}, &:extra_available_subcommands)
16
+ end
17
+
18
+ def source_banner
19
+ infov 'Source', source
20
+ end
21
+
22
+ # @return [Pathname]
23
+ def source_path
24
+ parsed.path.to_pathname
25
+ end
26
+
27
+ private
28
+
29
+ def source_uncached
30
+ ::Avm::Registry.sources.detect(source_path)
31
+ end
32
+
33
+ def optional_source_uncached
34
+ ::Avm::Registry.sources.detect_optional(source_path)
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.33.0'
4
+ VERSION = '0.35.0'
5
5
  end
@@ -24,10 +24,12 @@ RSpec.describe ::Avm::Instances::Base do
24
24
  ::Avm::Instances::EntryKeys::DATABASE_PORT => 5432,
25
25
  ::Avm::Instances::EntryKeys::INSTALL_HOSTNAME => 'myhost.com',
26
26
  ::Avm::Instances::EntryKeys::INSTALL_USERNAME => 'myuser',
27
+ ::Avm::Instances::EntryKeys::INSTALL_GROUPNAME => 'myuser',
27
28
  ::Avm::Instances::EntryKeys::INSTALL_URL => 'ssh://otheruser@otherhost.com'
28
29
  },
29
30
  'app_2' => {
30
31
  ::Avm::Instances::EntryKeys::DATABASE_HOSTNAME => '127.0.0.1',
32
+ ::Avm::Instances::EntryKeys::INSTALL_GROUPNAME => 'myuser',
31
33
  ::Avm::Instances::EntryKeys::SOURCE_INSTANCE_ID => 'app_dev'
32
34
  },
33
35
  'app_3' => {
@@ -48,6 +50,13 @@ RSpec.describe ::Avm::Instances::Base do
48
50
  ::Avm::Instances::EntryKeys::MAILER_SMTP_AUTHENTICATION => 'plain',
49
51
  ::Avm::Instances::EntryKeys::MAILER_SMTP_STARTTLS_AUTO => 'true'
50
52
  },
53
+ 'app_4' => {
54
+ ::Avm::Instances::EntryKeys::INSTALL_SCHEME => 'ssh',
55
+ ::Avm::Instances::EntryKeys::INSTALL_HOSTNAME => 'host4.net',
56
+ ::Avm::Instances::EntryKeys::INSTALL_USERNAME => 'user4',
57
+ ::Avm::Instances::EntryKeys::INSTALL_GROUPNAME => 'group4',
58
+ ::Avm::Instances::EntryKeys::INSTALL_URL => 'ssh://user4@host4.net'
59
+ },
51
60
  'mailer_0' => {
52
61
  ::Avm::Instances::EntryKeys::MAILER_FROM => 'noreply@example.net',
53
62
  ::Avm::Instances::EntryKeys::MAILER_REPLY_TO => '',
@@ -62,8 +71,16 @@ RSpec.describe ::Avm::Instances::Base do
62
71
  }.each do |instance_id, values|
63
72
  values.each do |input, expected|
64
73
  context "when a auto value is requested for \"#{instance_id}.#{input}\"" do
74
+ let(:instance) { described_class.by_id(instance_id) }
75
+
76
+ it do
77
+ expect(described_class.ancestors.map(&:name)).to(
78
+ include('Avm::Instances::Base::AutoValues::Install')
79
+ )
80
+ end
81
+
65
82
  it ".read_entry should return \"#{expected}\"" do
66
- expect(described_class.by_id(instance_id).read_entry(input)).to eq(expected)
83
+ expect(instance.read_entry(input)).to eq(expected)
67
84
  end
68
85
  end
69
86
  end
@@ -22,6 +22,12 @@ app_3:
22
22
  id: app_1
23
23
  mailer:
24
24
  id: mailer_0
25
+ app_4:
26
+ install:
27
+ scheme: ssh
28
+ username: user4
29
+ hostname: host4.net
30
+ groupname: group4
25
31
  mailer_0:
26
32
  mailer:
27
33
  from: 'noreply@example.net'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/runner'
4
+
5
+ ::RSpec.describe ::Avm::Sources::Runner do
6
+ it do
7
+ expect { described_class.run(argv: %w[--help]) }.not_to raise_error
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/instances/base'
4
+
5
+ module Avm
6
+ module EacGenericBase0
7
+ module Instances
8
+ class Base < ::Avm::Instances::Base
9
+ end
10
+ end
11
+ end
12
+ end
@@ -3,7 +3,9 @@
3
3
  require 'eac_ruby_utils/core_ext'
4
4
 
5
5
  module Avm
6
- module Rails
7
- require_sub __FILE__
6
+ module EacGenericBase0
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
8
10
  end
9
11
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacGenericBase0
5
- VERSION = '0.4.0'
5
+ VERSION = '0.5.0'
6
6
  end
7
7
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ local_gemfile = ::File.join(::File.dirname(__FILE__), 'Gemfile.local')
8
+ eval_gemfile local_gemfile if ::File.exist?(local_gemfile)
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'avm/eac_latex_base0/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'avm-eac_latex_base0'
9
+ s.version = Avm::EacLatexBase0::VERSION
10
+ s.authors = ['Put here the authors']
11
+ s.summary = 'Put here de description.'
12
+
13
+ s.files = Dir['{lib}/**/*']
14
+
15
+ s.add_dependency 'avm', '~> 0.34'
16
+ s.add_dependency 'avm-eac_webapp_base0', '~> 0.3', '>= 0.3.1'
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.97'
18
+
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.5', '>= 0.5.1'
20
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/apache_host'
4
+
5
+ module Avm
6
+ module EacLatexBase0
7
+ module Instances
8
+ class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
9
+ def document_root
10
+ instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
11
+ end
12
+
13
+ def extra_content
14
+ ''
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/instance'
4
+
5
+ module Avm
6
+ module EacLatexBase0
7
+ module Instances
8
+ class Base < ::Avm::EacWebappBase0::Instance
9
+ FILES_UNITS = {}.freeze
10
+ end
11
+ end
12
+ end
13
+ end