avm-eac_asciidoctor_base0 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96b69b3f900af61453fcb4945f09b28b62df452d094c2b69ca19cc48ed3cff17
4
- data.tar.gz: 92934bd6d39e951f350f9bf26b9b9da26b19be9ca46ed9e0c5aabda550f2e475
3
+ metadata.gz: a5fbd0a229513ac90eeb7557b8008af7b971608320f5830be7f1357040f023a3
4
+ data.tar.gz: a25f236473d377d4c309f6aa10031a74c8e2ebceec4324d068e4ba459fba7b32
5
5
  SHA512:
6
- metadata.gz: b038e101b9dce5872edb410b8955c80d6b910f1f6d19c10cd4f1e99f5068d4a00031b3231fb2b929d8faf155efdb637f608fd952f6eb95b70e1dccdcf304b555
7
- data.tar.gz: 449b9fdee9cd6853f82325ec82bbf7bbcc46e11d5d2b38b5010aef1e4d1b513b955940ddf9c69b63fa82b72da36e717a7331dcb37c66d632211b71bf7b0a3d50
6
+ metadata.gz: 0556277e63d86d1097e74fbecb444f45c49ac7072420bfacbd0ad01a3749e51706fe4e0180afc47cd8e730a44891609b58f87412ee8a5909e53a9c1a290c23b4
7
+ data.tar.gz: 164ee18189ecac41a852c175def57661e2e180d9b480a2a190cce65e01d43672540eae38cb2dd95148a0cafebe6a02e2aa3f5f4c91865d9336022ba9591d2dcc
@@ -10,6 +10,24 @@ module Avm
10
10
  module Instances
11
11
  class Base < ::Avm::EacWebappBase0::Instances::Base
12
12
  FILES_UNITS = {}.freeze
13
+ AUTHOR_EMAIL_ENTRY_PATH = 'install.email'
14
+ AUTHOR_NAME_ENTRY_PATH = 'install.name'
15
+ AUTHOR_NAME_INITIALS_ENTRY_PATH = 'install.name_initials'
16
+
17
+ # @return [String]
18
+ def author_email
19
+ entry(AUTHOR_EMAIL_ENTRY_PATH).value!
20
+ end
21
+
22
+ # @return [String]
23
+ def author_name
24
+ entry(AUTHOR_NAME_ENTRY_PATH).value!
25
+ end
26
+
27
+ # @return [String]
28
+ def author_name_initials
29
+ entry(AUTHOR_NAME_INITIALS_ENTRY_PATH).value!
30
+ end
13
31
  end
14
32
  end
15
33
  end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ module Instances
8
+ class Build
9
+ class Document
10
+ class HeaderMacroValue
11
+ enable_method_class
12
+ enable_settings_provider
13
+ enable_simple_cache
14
+ common_constructor :document
15
+
16
+ delegate :build, to: :document
17
+ delegate :instance, to: :build
18
+ delegate :author_email, :author_name, to: :instance
19
+
20
+ ATTRIBUTES = ['Author Initials', 'toc', 'icons', 'numbered', 'website'].freeze
21
+ TOC = 'left'
22
+ ICONS = ''
23
+ NUMBERED = ''
24
+
25
+ def attributes_lines
26
+ ATTRIBUTES.map do |attr|
27
+ [":#{attr}:", attribute_value(attr)].reject(&:blank?).join(' ')
28
+ end
29
+ end
30
+
31
+ def attribute_value(attr)
32
+ setting_value(attr.variableize)
33
+ end
34
+
35
+ def author_initials
36
+ instance.author_name_initials
37
+ end
38
+
39
+ def author_line
40
+ "#{author_name} <#{author_email}>"
41
+ end
42
+
43
+ def result
44
+ result_lines.join("\n")
45
+ end
46
+
47
+ def result_lines
48
+ [author_line] + attributes_lines
49
+ end
50
+
51
+ def website
52
+ instance.web_url
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module Avm
6
+ module EacAsciidoctorBase0
7
+ module Instances
8
+ class Build
9
+ class Document
10
+ class PreProcessLine
11
+ enable_method_class
12
+ enable_simple_cache
13
+
14
+ MACRO_PARSER = %r{\A\s*//\#(\S+.*)}.to_parser do |m|
15
+ m[1]
16
+ end
17
+
18
+ common_constructor :document, :line
19
+
20
+ def result
21
+ if macro?
22
+ macro_value
23
+ else
24
+ line
25
+ end
26
+ end
27
+
28
+ def macro?
29
+ macro_name.present?
30
+ end
31
+
32
+ def macro_parser
33
+ MACRO_PARSER
34
+ end
35
+
36
+ def macro_value
37
+ document.send("#{macro_name}_macro_value")
38
+ end
39
+
40
+ private
41
+
42
+ def macro_name_uncached
43
+ macro_parser.parse(line)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'asciidoctor'
4
+ require 'eac_ruby_utils/core_ext'
4
5
 
5
6
  module Avm
6
7
  module EacAsciidoctorBase0
7
- module Sources
8
+ module Instances
8
9
  class Build
9
10
  class Document
11
+ require_sub __FILE__
12
+
10
13
  ROOT_BODY_TARGET_BASENAME = 'index'
11
14
 
12
15
  enable_simple_cache
@@ -31,14 +34,6 @@ module Avm
31
34
  ).basename_sub('.*') { |b| "#{b}.html" }
32
35
  end
33
36
 
34
- def mydebug
35
- root_source_path.print_debug(title: 'Document')
36
- children.count.print_debug(label: 'children.count')
37
- body_source_path.print_debug(label: 'body_source')
38
- body_source_path.file?.print_debug(label: 'body_source.file?')
39
- body_target_path.print_debug(label: 'body_target')
40
- end
41
-
42
37
  def perform
43
38
  perform_self
44
39
  perform_children
@@ -46,8 +41,8 @@ module Avm
46
41
 
47
42
  def perform_self
48
43
  infov 'Building', root_source_path
49
- ::Asciidoctor.convert_file(
50
- body_source_path.to_path,
44
+ ::Asciidoctor.convert(
45
+ pre_processed_body_source_content,
51
46
  to_file: body_target_path.to_path, safe: :unsafe, mkdirs: true
52
47
  )
53
48
  end
@@ -56,6 +51,11 @@ module Avm
56
51
  children.each(&:perform)
57
52
  end
58
53
 
54
+ # @return [String]
55
+ def pre_processed_body_source_content
56
+ body_source_path.read.each_line.map { |line| pre_process_line(line.rstrip) + "\n" }.join
57
+ end
58
+
59
59
  def tree_documents_count
60
60
  children.inject(1) { |a, e| a + e.tree_documents_count }
61
61
  end
@@ -5,14 +5,14 @@ require 'eac_ruby_utils/fs/clearable_directory'
5
5
 
6
6
  module Avm
7
7
  module EacAsciidoctorBase0
8
- module Sources
8
+ module Instances
9
9
  class Build
10
10
  require_sub __FILE__
11
11
  enable_speaker
12
12
  enable_simple_cache
13
13
  enable_listable
14
14
  lists.add_symbol :option, :target_directory
15
- common_constructor :source, :options, default: [{}] do
15
+ common_constructor :instance, :options, default: [{}] do
16
16
  self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
17
17
  end
18
18
 
@@ -29,7 +29,12 @@ module Avm
29
29
  end
30
30
 
31
31
  def root_document
32
- ::Avm::EacAsciidoctorBase0::Sources::Build::Document.new(self, nil, nil)
32
+ ::Avm::EacAsciidoctorBase0::Instances::Build::Document.new(self, nil, nil)
33
+ end
34
+
35
+ # @return [Avm::EacAsciidoctorBase0::Sources::Base]
36
+ def source
37
+ instance.application.local_source
33
38
  end
34
39
 
35
40
  def target_directory
@@ -2,16 +2,16 @@
2
2
 
3
3
  require 'avm/eac_webapp_base0/instances/deploy'
4
4
  require 'avm/eac_asciidoctor_base0/sources/base'
5
- require 'avm/eac_asciidoctor_base0/sources/build'
5
+ require 'avm/eac_asciidoctor_base0/instances/build'
6
6
 
7
7
  module Avm
8
8
  module EacAsciidoctorBase0
9
9
  module Instances
10
10
  class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
11
11
  def build_content
12
- ::Avm::EacAsciidoctorBase0::Sources::Build.new(
12
+ ::Avm::EacAsciidoctorBase0::Instances::Build.new(
13
13
  project,
14
- ::Avm::EacAsciidoctorBase0::Sources::Build::OPTION_TARGET_DIRECTORY => build_dir
14
+ ::Avm::EacAsciidoctorBase0::Instances::Build::OPTION_TARGET_DIRECTORY => build_dir
15
15
  ).perform
16
16
  end
17
17
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/eac_asciidoctor_base0/sources/build'
3
+ require 'avm/eac_asciidoctor_base0/instances/build'
4
4
  require 'eac_cli/core_ext'
5
5
  require 'os'
6
6
 
@@ -24,8 +24,10 @@ module Avm
24
24
  private
25
25
 
26
26
  def build_uncached
27
- ::Avm::EacAsciidoctorBase0::Sources::Build.new(runner_context.call(:source),
28
- target_directory: parsed.target_dir)
27
+ ::Avm::EacAsciidoctorBase0::Instances::Build.new(
28
+ runner_context.call(:source).instance,
29
+ target_directory: parsed.target_dir
30
+ )
29
31
  end
30
32
 
31
33
  def default_target_directory
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.9.0'
5
+ VERSION = '0.10.0'
6
6
  end
7
7
  end
@@ -1,4 +1,5 @@
1
1
  = EacAsciidoctorBase0 Generated Source =
2
+ //#header
2
3
 
3
4
  == First Section
4
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-eac_asciidoctor_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-30 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -56,20 +56,14 @@ dependencies:
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '0.106'
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: 0.106.1
59
+ version: '0.107'
63
60
  type: :runtime
64
61
  prerelease: false
65
62
  version_requirements: !ruby/object:Gem::Requirement
66
63
  requirements:
67
64
  - - "~>"
68
65
  - !ruby/object:Gem::Version
69
- version: '0.106'
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: 0.106.1
66
+ version: '0.107'
73
67
  - !ruby/object:Gem::Dependency
74
68
  name: os
75
69
  requirement: !ruby/object:Gem::Requirement
@@ -143,6 +137,10 @@ files:
143
137
  - lib/avm/eac_asciidoctor_base0/instances/apache_host.rb
144
138
  - lib/avm/eac_asciidoctor_base0/instances/apache_path.rb
145
139
  - lib/avm/eac_asciidoctor_base0/instances/base.rb
140
+ - lib/avm/eac_asciidoctor_base0/instances/build.rb
141
+ - lib/avm/eac_asciidoctor_base0/instances/build/document.rb
142
+ - lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb
143
+ - lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb
146
144
  - lib/avm/eac_asciidoctor_base0/instances/deploy.rb
147
145
  - lib/avm/eac_asciidoctor_base0/runners.rb
148
146
  - lib/avm/eac_asciidoctor_base0/runners/base.rb
@@ -150,8 +148,6 @@ files:
150
148
  - lib/avm/eac_asciidoctor_base0/source_generators/base.rb
151
149
  - lib/avm/eac_asciidoctor_base0/sources.rb
152
150
  - lib/avm/eac_asciidoctor_base0/sources/base.rb
153
- - lib/avm/eac_asciidoctor_base0/sources/build.rb
154
- - lib/avm/eac_asciidoctor_base0/sources/build/document.rb
155
151
  - lib/avm/eac_asciidoctor_base0/sources/runners.rb
156
152
  - lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
157
153
  - lib/avm/eac_asciidoctor_base0/version.rb