eac_tools 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -11
- data/lib/eac_tools/version.rb +1 -1
- data/sub/avm/lib/avm/entries/auto_values/uri_entry.rb +24 -0
- data/sub/avm/lib/avm/entries/uri_builder.rb +85 -0
- data/sub/avm/lib/avm/instances/base/auto_values/install.rb +6 -9
- data/sub/avm/lib/avm/instances/base/auto_values.rb +2 -8
- data/sub/avm/lib/avm/instances/entry_keys.rb +1 -1
- data/sub/avm/lib/avm/version.rb +1 -1
- data/sub/avm/spec/lib/avm/instances/base_spec.rb +18 -1
- data/sub/avm/spec/lib/avm/instances/base_spec_configs_storage.yml +6 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances/base.rb +12 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/instances.rb +11 -0
- data/sub/avm-eac_generic_base0/lib/avm/eac_generic_base0/version.rb +1 -1
- data/sub/avm-eac_latex_base0/Gemfile +8 -0
- data/sub/avm-eac_latex_base0/avm-eac_latex_base0.gemspec +20 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/apache_host.rb +19 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/base.rb +13 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances/deploy.rb +38 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/instances.rb +11 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/base.rb +44 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb +49 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/commons.rb +16 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/copy_files.rb +45 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/base_stereotype.rb +23 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/chapter_index.rb +27 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file/tex_source.rb +37 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/file.rb +49 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build.rb +119 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb +43 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_single.rb +33 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/info.rb +32 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners.rb +13 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources.rb +11 -0
- data/sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/version.rb +7 -0
- data/sub/{avm-tools/lib/avm/eac_writings_base0.rb → avm-eac_latex_base0/lib/avm/eac_latex_base0.rb} +1 -1
- data/sub/avm-eac_latex_base0/spec/rubocop_spec.rb +3 -0
- data/sub/avm-eac_latex_base0/spec/spec_helper.rb +4 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
- data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/dashed-mygem/Gemfile +3 -0
- data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec_files/mygem/Gemfile +3 -0
- data/sub/avm-eac_ruby_base1/template/avm/eac_ruby_base1/source_generators/base/static/Gemfile +3 -0
- data/sub/avm-eac_wordpress_base0/avm-eac_wordpress_base0.gemspec +1 -0
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/instances/apache_host.rb +2 -2
- data/sub/avm-eac_wordpress_base0/lib/avm/eac_wordpress_base0/version.rb +1 -1
- data/sub/avm-eac_wordpress_base0/spec/lib/avm/eac_wordpress_base0/instances/apache_host_spec.rb +4 -3
- data/sub/avm-tools/lib/avm/tools/version.rb +1 -1
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/patches/addressable.rb +4 -0
- data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/addressable/uri/query_value_spec.rb +25 -0
- metadata +78 -37
- data/sub/avm/lib/avm/instances/base/auto_values/system.rb +0 -23
- data/sub/avm-tools/lib/avm/eac_writings_base0/apache_host.rb +0 -17
- data/sub/avm-tools/lib/avm/eac_writings_base0/commons.rb +0 -12
- data/sub/avm-tools/lib/avm/eac_writings_base0/deploy.rb +0 -36
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
- data/sub/avm-tools/lib/avm/eac_writings_base0/file_build.rb +0 -45
- data/sub/avm-tools/lib/avm/eac_writings_base0/instance.rb +0 -11
- data/sub/avm-tools/lib/avm/eac_writings_base0/project.rb +0 -33
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
- data/sub/avm-tools/lib/avm/eac_writings_base0/project_build.rb +0 -117
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
- data/sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baba23c169953217d7ae8fb843f6e6ba92026ea05912703fbdaa96d928e26441
|
4
|
+
data.tar.gz: ba6447143ad6a2549e67d876df792093af9de18a54ca960068e7ab066d5e261d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4a52a8b9facf9631f73dce00eebdf34332096e7b69557d9421b5dbe24e349189f906ef5ac4bbaf3dd61d772a0f8aa095c579ef1e023af45c5616c504e865e92
|
7
|
+
data.tar.gz: 28e74a110919a42cad8431eb7893c1e740768f9d4a0ef1a2a486a6cc867d6839a5907a6d122d7183c72b53e618d321f65eb331ca2bfd9810d15de15eaf2d81b1
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
eac_tools (0.
|
4
|
+
eac_tools (0.18.0)
|
5
|
+
avm (~> 0.35)
|
5
6
|
avm-eac_asciidoctor_base0 (~> 0.4)
|
6
|
-
avm-eac_generic_base0 (~> 0.
|
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
|
+
avm-eac_ruby_base1 (~> 0.15)
|
12
14
|
avm-eac_webapp_base0 (~> 0.3, >= 0.3.1)
|
13
15
|
avm-eac_wordpress_base0 (~> 0.1)
|
14
|
-
avm-tools (~> 0.
|
15
|
-
eac_ruby_utils (~> 0.
|
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.
|
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.
|
83
|
+
avm-eac_ruby_base1 (0.15.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.
|
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.
|
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.
|
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.
|
180
|
+
eac_ruby_utils (0.98.0)
|
170
181
|
activesupport (>= 4, < 7)
|
171
182
|
addressable (~> 2.6)
|
172
183
|
bundler
|
@@ -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!
|
data/lib/eac_tools/version.rb
CHANGED
@@ -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
|
11
|
-
|
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
|
-
|
37
|
-
|
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]
|
data/sub/avm/lib/avm/version.rb
CHANGED
@@ -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(
|
83
|
+
expect(instance.read_entry(input)).to eq(expected)
|
67
84
|
end
|
68
85
|
end
|
69
86
|
end
|
@@ -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,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,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,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
|