eac_tools 0.17.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +26 -14
  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/version.rb +1 -1
  10. data/sub/avm/spec/lib/avm/instances/base_spec.rb +18 -1
  11. data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
  12. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb +12 -0
  13. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb +11 -0
  14. data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
  15. data/sub/avm-eac_latex_base0/Gemfile +8 -0
  16. data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +20 -0
  17. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +19 -0
  18. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +13 -0
  19. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +38 -0
  20. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances.rb +11 -0
  21. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/base.rb +44 -0
  22. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb +49 -0
  23. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/commons.rb +16 -0
  24. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/copy_files.rb +45 -0
  25. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/base_stereotype.rb +23 -0
  26. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/chapter_index.rb +27 -0
  27. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/tex_source.rb +37 -0
  28. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file.rb +49 -0
  29. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +119 -0
  30. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb +43 -0
  31. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_single.rb +33 -0
  32. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/info.rb +32 -0
  33. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners.rb +13 -0
  34. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources.rb +11 -0
  35. data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +7 -0
  36. data/sub/{avm-tools/lib/avm/eac_writings_base0.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0.rb} +1 -1
  37. data/sub/avm-eac_latex_base0/spec/rubocop_spec.rb +3 -0
  38. data/sub/avm-eac_latex_base0/spec/spec_helper.rb +4 -0
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/preferred_version_requirements.rb +43 -0
  48. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb +1 -1
  49. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/bundler/gemfile_local.rb +84 -0
  50. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/runners/update_dependencies_requirements.rb +48 -0
  51. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update_dependency_requirements.rb +51 -0
  52. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  53. data/sub/avm-eac_ruby_base1/locale/en.yml +2 -0
  54. data/sub/avm-eac_ruby_base1/locale/pt-BR.yml +2 -0
  55. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/preferred_version_requirements_spec.rb +23 -0
  56. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile +3 -0
  57. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile +3 -0
  58. data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile +3 -0
  59. data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +1 -0
  60. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
  61. data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
  62. data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +4 -3
  63. data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
  64. data/sub/eac_cli/lib/eac_cli/runner_with/subcommands.rb +5 -1
  65. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  66. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
  67. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
  68. data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
  69. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  70. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
  71. metadata +89 -37
  72. data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
  73. data/sub/avm-tools/lib/avm/eac_writings_base0/apache_host.rb +0 -17
  74. data/sub/avm-tools/lib/avm/eac_writings_base0/commons.rb +0 -12
  75. data/sub/avm-tools/lib/avm/eac_writings_base0/deploy.rb +0 -36
  76. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
  77. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
  78. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
  79. data/sub/avm-tools/lib/avm/eac_writings_base0/file_build.rb +0 -45
  80. data/sub/avm-tools/lib/avm/eac_writings_base0/instance.rb +0 -11
  81. data/sub/avm-tools/lib/avm/eac_writings_base0/project.rb +0 -33
  82. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
  83. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
  84. data/sub/avm-tools/lib/avm/eac_writings_base0/project_build.rb +0 -117
  85. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
  86. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
  87. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
  88. data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
  89. data/sub/avm-tools/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 331f73c00105798972e35c3eb8049f412eceecf7ce6805f2b96be3d97999c3c9
4
- data.tar.gz: ebe8e2dc8c9245bfa657a9ff036620280e4e81c808e85f98bc543758bac64738
3
+ metadata.gz: 93a1c9566bf766012fca596e4627a7a9fdda33311bb370e2dcd652b7c9d60b24
4
+ data.tar.gz: 42d0ac14487052b8a3578059f0f76bc7e3ed96d9005cdf6ad5a494dc4addc23c
5
5
  SHA512:
6
- metadata.gz: 2cb086332be7545caf2bd3d288f35c11ab444b7dc826a7798f8b45c65e6e33a10e7209c19e72acb2a7c5ae5940cd55881c9c94fe9f4786c0093d2fe87cf7ada3
7
- data.tar.gz: c4376b3c09a9c577c2c97e6434edbd13d268d21d09d1a6d5ec4e2808ca56d2c3cb3f094cdcda91e964eef70b6480407b693a8913af4b0b6427221580250ef8b4
6
+ metadata.gz: 175adf6a2e99f67dce013f433fab9bc820fbfb9ba6d2236bf4e551ac23c012e44e476c8588f1e789d95e9433211ccd0e0390c6bd4d02847ad5f793c1219be183
7
+ data.tar.gz: ca95cc7bcbefea6560fa5c16c8f8245911e06493ea90be2a54068435caf4ce0b0bfc9536267abfaf2ac59c88ec61f6c96f9407dd44c2353383a88c680571df9f
data/Gemfile.lock CHANGED
@@ -1,18 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.17.0)
4
+ eac_tools (0.20.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.13)
13
+ avm-eac_ruby_base1 (~> 0.17)
12
14
  avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
13
- avm-eac_wordpress_base0 (~> 0.1)
14
- avm-tools (~> 0.130)
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,7 +80,7 @@ PATH
70
80
  PATH
71
81
  remote: sub/avm-eac_ruby_base1
72
82
  specs:
73
- avm-eac_ruby_base1 (0.13.0)
83
+ avm-eac_ruby_base1 (0.17.0)
74
84
  avm (~> 0.34)
75
85
  avm-eac_generic_base0 (~> 0.2)
76
86
  eac_ruby_utils (~> 0.95, >= 0.95.1)
@@ -88,14 +98,15 @@ 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.130.0)
109
+ avm-tools (0.131.0)
99
110
  aranha-parsers (~> 0.4)
100
111
  avm (~> 0.34)
101
112
  avm-eac_ruby_base1 (~> 0.8)
@@ -113,7 +124,7 @@ PATH
113
124
  PATH
114
125
  remote: sub/avm
115
126
  specs:
116
- avm (0.34.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)
@@ -127,7 +138,7 @@ PATH
127
138
  PATH
128
139
  remote: sub/eac_cli
129
140
  specs:
130
- eac_cli (0.27.7)
141
+ eac_cli (0.27.8)
131
142
  colorize (~> 0.8.1)
132
143
  eac_config (~> 0.8)
133
144
  eac_ruby_utils (~> 0.95)
@@ -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.17.0'
4
+ VERSION = '0.20.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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Avm
4
- VERSION = '0.34.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,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
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacGenericBase0
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
10
+ end
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
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_webapp_base0/deploy'
4
+ require 'avm/eac_latex_base0/sources/base'
5
+ require 'avm/eac_latex_base0/sources/build'
6
+
7
+ module Avm
8
+ module EacLatexBase0
9
+ module Instances
10
+ class Deploy < ::Avm::EacWebappBase0::Deploy
11
+ def build_content
12
+ ::Avm::EacLatexBase0::Sources::Build.new(project, output_file:
13
+ build_dir.join(pdf_path))
14
+ end
15
+
16
+ def title
17
+ instance.id.humanize
18
+ end
19
+
20
+ def pdf_path
21
+ "#{instance.id.underscore}.pdf"
22
+ end
23
+
24
+ def variables_source
25
+ self
26
+ end
27
+
28
+ private
29
+
30
+ def project_uncached
31
+ ::Avm::EacLatexBase0::Sources::Base.new(
32
+ instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
33
+ )
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacLatexBase0
7
+ module Instances
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/sources/base'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacLatexBase0
8
+ module Sources
9
+ class Base < ::Avm::Sources::Base
10
+ def chapters
11
+ chapters_file.read.split("\n").map(&:strip).reject { |c| c == '' }
12
+ end
13
+
14
+ def chapters_file
15
+ root.join('chapters')
16
+ end
17
+
18
+ def main_file
19
+ path.join('main.tex')
20
+ end
21
+
22
+ def name
23
+ root.basename.to_s
24
+ end
25
+
26
+ def default_output_dir
27
+ root.join('dist')
28
+ end
29
+
30
+ def default_output_file
31
+ root.join("#{name}.pdf")
32
+ end
33
+
34
+ def root
35
+ path
36
+ end
37
+
38
+ def valid?
39
+ main_file.file?
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avm
4
+ module EacLatexBase0
5
+ module Sources
6
+ class Build
7
+ class << self
8
+ def chapter_filename(chapter_name)
9
+ "chapter_#{chapter_name}"
10
+ end
11
+ end
12
+
13
+ module ChaptersContent
14
+ private
15
+
16
+ def chapter
17
+ options[:chapter]
18
+ end
19
+
20
+ def chapter_filename(chapter_name)
21
+ ::Avm::EacLatexBase0::Sources::Build.chapter_filename(chapter_name)
22
+ end
23
+
24
+ def check_chapter
25
+ return unless chapter
26
+ return if project.chapters.include?(chapter)
27
+
28
+ fatal_error("Chapter not found: \"#{chapter}\" (List: #{project.chapters})")
29
+ end
30
+
31
+ def include_content
32
+ main_path = source_temp_dir.join('main.tex')
33
+ main_path.write(main_path.read.gsub(CONTENT_VAR, include_chapters_content))
34
+ end
35
+
36
+ def include_chapters_content
37
+ r = chapters_content
38
+ r = "\\maketitle\n\n#{r}" if chapter.blank?
39
+ r
40
+ end
41
+
42
+ def chapters_content
43
+ project.chapters.map { |c| "\\include{#{chapter_filename(c)}}" }.join("\n")
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_templates/core_ext'
4
+ require 'singleton'
5
+
6
+ module Avm
7
+ module EacLatexBase0
8
+ module Sources
9
+ class Build
10
+ class Commons
11
+ include ::Singleton
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'avm/eac_latex_base0/sources/build/commons'
4
+ require 'avm/eac_latex_base0/sources/build/file'
5
+
6
+ module Avm
7
+ module EacLatexBase0
8
+ module Sources
9
+ class Build
10
+ module CopyFiles
11
+ def copy_project_files
12
+ copy_project_dir('.')
13
+ end
14
+
15
+ def copy_project_obj(subpath)
16
+ return if File.basename(subpath).start_with?('.')
17
+
18
+ if File.directory?(File.join(project.root, subpath))
19
+ copy_project_dir(subpath)
20
+ else
21
+ copy_project_file(subpath)
22
+ end
23
+ end
24
+
25
+ def copy_project_file(subpath)
26
+ ::Avm::EacLatexBase0::Sources::Build::File.new(project, subpath)
27
+ .build_to_dir(source_temp_dir)
28
+ end
29
+
30
+ def copy_project_dir(subpath)
31
+ Dir.entries(File.join(project.root, subpath)).each do |f|
32
+ copy_project_obj(File.join(subpath, f))
33
+ end
34
+ end
35
+
36
+ def copy_commons_files
37
+ target_dir = source_temp_dir.join('commons')
38
+ target_dir.mkpath
39
+ ::Avm::EacLatexBase0::Sources::Build::Commons.instance.template.apply(self, target_dir)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end