eac_tools 0.42.0 → 0.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb +24 -5
  5. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +13 -26
  6. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb +3 -1
  7. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +1 -1
  8. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb +28 -0
  9. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +47 -0
  10. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +40 -0
  11. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +7 -0
  12. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  13. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +2 -1
  14. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +4 -0
  15. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc +0 -1
  16. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title +1 -0
  17. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css +0 -0
  18. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +0 -1
  19. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +1 -0
  20. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -0
  21. metadata +10 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cc7fffb0a2dc335ea8d9bb791d3aac22b783dbf2556d7812ece97708fee0be9
4
- data.tar.gz: 23081d70c8762bca09ee9389b361f3b0fed45f30a09c7649f9caaf28948559f3
3
+ metadata.gz: 65b0eefb0e0ef10a3abfd27894a02ee0d4c7de07af8aa4f26a20d4ac4fd6dcbd
4
+ data.tar.gz: 6b07c4255b3d7ce70942927f6293d185ee7103bfd83fd6cc39fb0f69383293ac
5
5
  SHA512:
6
- metadata.gz: 10510fc8717ce648a96da24ca0796ac2bc0f4b57424dc7efad470b86cd71585b3fbf8dd9df03818a6b4f2d739accc8f7758925d65f9bbfdf04dec360bf82fca4
7
- data.tar.gz: 17442df47bb3b1944d1ce2a4b0b976aaf36edb54e6c13aad74655fc32295159caa5e31835a08b2853ea63b4db2f5311f6823af588ec2b649ca3d27f4a1dd0ea0
6
+ metadata.gz: d67d744fc384ea9a92c1b39aa98bfda3f53c72125a48cd76d00963c94b51fdf1bdceffb2f489da4b03475a26afcdc660c9cc6ee0cfc911d6312f66ef37a1a3e5
7
+ data.tar.gz: ea8f9e685277a7e941ebe4e76593df2065505098e961d014ebe87f4d297e394e5b2f94d97574978d60e0cadf932e7a7b81add2e7b3cc89d92aff8d6967b6f67a
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eac_tools (0.42.0)
4
+ eac_tools (0.43.0)
5
5
  avm (~> 0.55)
6
- avm-eac_asciidoctor_base0 (~> 0.10)
6
+ avm-eac_asciidoctor_base0 (~> 0.11)
7
7
  avm-eac_generic_base0 (~> 0.8)
8
8
  avm-eac_latex_base0 (~> 0.3)
9
9
  avm-eac_php_base0 (~> 0.3)
@@ -33,7 +33,7 @@ PATH
33
33
  PATH
34
34
  remote: sub/avm-eac_asciidoctor_base0
35
35
  specs:
36
- avm-eac_asciidoctor_base0 (0.10.0)
36
+ avm-eac_asciidoctor_base0 (0.11.0)
37
37
  asciidoctor (~> 2.0, >= 2.0.18)
38
38
  avm-eac_webapp_base0 (~> 0.12, >= 0.12.2)
39
39
  eac_ruby_utils (~> 0.107)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacTools
4
- VERSION = '0.42.0'
4
+ VERSION = '0.43.0'
5
5
  end
@@ -13,7 +13,7 @@ module Avm
13
13
  enable_simple_cache
14
14
  common_constructor :document
15
15
 
16
- delegate :build, to: :document
16
+ delegate :build, :source_document, to: :document
17
17
  delegate :instance, to: :build
18
18
  delegate :author_email, :author_name, to: :instance
19
19
 
@@ -22,10 +22,13 @@ module Avm
22
22
  ICONS = ''
23
23
  NUMBERED = ''
24
24
 
25
+ # @return [String]
26
+ def attribute_line(name, value)
27
+ [":#{name}:", value].reject(&:blank?).join(' ')
28
+ end
29
+
25
30
  def attributes_lines
26
- ATTRIBUTES.map do |attr|
27
- [":#{attr}:", attribute_value(attr)].reject(&:blank?).join(' ')
28
- end
31
+ ATTRIBUTES.map { |attr| attribute_line(attr, attribute_value(attr)) }
29
32
  end
30
33
 
31
34
  def attribute_value(attr)
@@ -45,7 +48,23 @@ module Avm
45
48
  end
46
49
 
47
50
  def result_lines
48
- [author_line] + attributes_lines
51
+ [stylesheet_line, title_line, author_line] + attributes_lines
52
+ end
53
+
54
+ # @return [String]
55
+ def stylesheet_line
56
+ attribute_line('stylesheet', stylesheet_path)
57
+ end
58
+
59
+ # @return [Pathname]
60
+ def stylesheet_path
61
+ source_document.source.theme_stylesheet_path
62
+ .relative_path_from(document.convert_base_dir)
63
+ end
64
+
65
+ # @return [String]
66
+ def title_line
67
+ "= #{source_document.title}"
49
68
  end
50
69
 
51
70
  def website
@@ -14,35 +14,32 @@ module Avm
14
14
 
15
15
  enable_simple_cache
16
16
  enable_speaker
17
- common_constructor :build, :parent_document, :basename
18
-
19
- # Absolute path to the Asciidoctor file.
20
- #
21
- # @return [Pathname]
22
- def body_source_path
23
- root_source_path.join(
24
- ::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
25
- )
26
- end
17
+ common_constructor :build, :parent_document, :source_document
27
18
 
28
19
  # Absolute path to the output of Asciidoctor's source file.
29
20
  #
30
21
  # @return [Pathname]
31
22
  def body_target_path
32
23
  build.target_directory.join(
33
- parent_document.present? ? subpath : ROOT_BODY_TARGET_BASENAME
24
+ parent_document.present? ? source_document.subpath : ROOT_BODY_TARGET_BASENAME
34
25
  ).basename_sub('.*') { |b| "#{b}.html" }
35
26
  end
36
27
 
28
+ # @return [Pathname]
29
+ def convert_base_dir
30
+ source_document.root_path
31
+ end
32
+
37
33
  def perform
38
34
  perform_self
39
35
  perform_children
40
36
  end
41
37
 
42
38
  def perform_self
43
- infov 'Building', root_source_path
39
+ infov 'Building', source_document.root_path
44
40
  ::Asciidoctor.convert(
45
41
  pre_processed_body_source_content,
42
+ base_dir: convert_base_dir,
46
43
  to_file: body_target_path.to_path, safe: :unsafe, mkdirs: true
47
44
  )
48
45
  end
@@ -53,29 +50,19 @@ module Avm
53
50
 
54
51
  # @return [String]
55
52
  def pre_processed_body_source_content
56
- body_source_path.read.each_line.map { |line| pre_process_line(line.rstrip) + "\n" }.join
53
+ source_document.body_path.read.each_line
54
+ .map { |line| pre_process_line(line.rstrip) + "\n" }.join
57
55
  end
58
56
 
59
57
  def tree_documents_count
60
58
  children.inject(1) { |a, e| a + e.tree_documents_count }
61
59
  end
62
60
 
63
- # Absolute path to the document's source root.
64
- #
65
- # @return [Pathname]
66
- def root_source_path
67
- build.source.content_directory.join(subpath)
68
- end
69
-
70
- def subpath
71
- parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
72
- end
73
-
74
61
  private
75
62
 
76
63
  def children_uncached
77
- root_source_path.children.select(&:directory?)
78
- .map { |path| self.class.new(build, self, path.basename) }
64
+ source_document.children
65
+ .map { |source_child| self.class.new(build, self, source_child) }
79
66
  end
80
67
  end
81
68
  end
@@ -13,6 +13,7 @@ module Avm
13
13
  enable_listable
14
14
  lists.add_symbol :option, :target_directory
15
15
  common_constructor :instance, :options, default: [{}] do
16
+ instance.assert_argument(::Avm::EacAsciidoctorBase0::Instances::Base, 'instance')
16
17
  self.options = self.class.lists.option.hash_keys_validate!(options.symbolize_keys)
17
18
  end
18
19
 
@@ -29,7 +30,8 @@ module Avm
29
30
  end
30
31
 
31
32
  def root_document
32
- ::Avm::EacAsciidoctorBase0::Instances::Build::Document.new(self, nil, nil)
33
+ ::Avm::EacAsciidoctorBase0::Instances::Build::Document
34
+ .new(self, nil, source.root_document)
33
35
  end
34
36
 
35
37
  # @return [Avm::EacAsciidoctorBase0::Sources::Base]
@@ -10,7 +10,7 @@ module Avm
10
10
  class Deploy < ::Avm::EacWebappBase0::Instances::Deploy
11
11
  def build_content
12
12
  ::Avm::EacAsciidoctorBase0::Instances::Build.new(
13
- project,
13
+ instance,
14
14
  ::Avm::EacAsciidoctorBase0::Instances::Build::OPTION_TARGET_DIRECTORY => build_dir
15
15
  ).perform
16
16
  end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacAsciidoctorBase0
8
+ module Sources
9
+ class Base
10
+ class Document
11
+ module Title
12
+ TITLE_BASENAME = 'title'
13
+
14
+ # @return [String]
15
+ def title
16
+ title_path.read.strip
17
+ end
18
+
19
+ # @return [Pathname]
20
+ def title_path
21
+ root_path.join(TITLE_BASENAME)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacAsciidoctorBase0
8
+ module Sources
9
+ class Base
10
+ class Document
11
+ enable_simple_cache
12
+ enable_speaker
13
+ require_sub __FILE__, include_modules: true
14
+ common_constructor :source, :parent_document, :basename
15
+
16
+ # Absolute path to the Asciidoctor file.
17
+ #
18
+ # @return [Pathname]
19
+ def body_path
20
+ root_path.join(
21
+ ::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
22
+ )
23
+ end
24
+
25
+ # Absolute path to the document's source root.
26
+ #
27
+ # @return [Pathname]
28
+ def root_path
29
+ source.content_directory.join(subpath)
30
+ end
31
+
32
+ # @return [Pathname]
33
+ def subpath
34
+ parent_document.if_present('.'.to_pathname) { |pd| pd.subpath.join(basename) }
35
+ end
36
+
37
+ private
38
+
39
+ def children_uncached
40
+ root_path.children.select(&:directory?)
41
+ .map { |path| self.class.new(source, self, path.basename) }
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'asciidoctor'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module Avm
7
+ module EacAsciidoctorBase0
8
+ module Sources
9
+ class Base
10
+ module Theme
11
+ CONFIGURATION_THEME_KEY = 'theme'
12
+ DEFAULT_THEME_DIRECTORY_SUBPATH = 'theme'
13
+ THEME_STYLESHEET_BASENAME = 'main.css'
14
+
15
+ # @return [Pathname]
16
+ def default_theme_directory
17
+ path.join(DEFAULT_THEME_DIRECTORY_SUBPATH)
18
+ end
19
+
20
+ # @return [Pathname]
21
+ def theme_directory
22
+ theme_directory_by_configuration || default_theme_directory
23
+ end
24
+
25
+ # @return [Pathname]
26
+ def theme_directory_by_configuration
27
+ configuration_entry(CONFIGURATION_THEME_KEY).value.if_present do |v|
28
+ v.to_pathname.expand_path(path)
29
+ end
30
+ end
31
+
32
+ # @return [Pathname]
33
+ def theme_stylesheet_path
34
+ theme_directory.join(THEME_STYLESHEET_BASENAME)
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -12,10 +12,17 @@ module Avm
12
12
  CONTENT_DOCUMENT_BASENAME = ::Pathname.new('body.adoc')
13
13
  MAIN_FILE_SUBPATH = CONTENT_DIRECTORY_SUBPATH.join(CONTENT_DOCUMENT_BASENAME)
14
14
 
15
+ require_sub __FILE__, include_modules: true
16
+
15
17
  def content_directory
16
18
  path.join(CONTENT_DIRECTORY_SUBPATH)
17
19
  end
18
20
 
21
+ # @return [Avm::EacAsciidoctorBase0::Sources::Base::Document
22
+ def root_document
23
+ ::Avm::EacAsciidoctorBase0::Sources::Base::Document.new(self, nil, nil)
24
+ end
25
+
19
26
  def valid?
20
27
  path.join(MAIN_FILE_SUBPATH).file?
21
28
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module EacAsciidoctorBase0
5
- VERSION = '0.10.0'
5
+ VERSION = '0.11.0'
6
6
  end
7
7
  end
@@ -1,4 +1,5 @@
1
- = EacAsciidoctorBase0 Generated Source =
1
+ :stylesheet: ../theme/main.css
2
+ = EacAsciidoctorBase0 Generated Source
2
3
  The Author <theauthor@example.net>
3
4
  :Author Initials: T.A.
4
5
  :toc: left
@@ -34,6 +34,10 @@ require 'eac_fs/comparator'
34
34
  main_document,
35
35
  target_dir.join(::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME)
36
36
  )
37
+ ::FileUtils.cp(
38
+ source.root_document.title_path,
39
+ target_dir.join(::Avm::EacAsciidoctorBase0::Sources::Base::Document::TITLE_BASENAME)
40
+ )
37
41
  end
38
42
  instance.perform
39
43
  end
@@ -1,4 +1,3 @@
1
- = EacAsciidoctorBase0 Generated Source =
2
1
  //#header
3
2
 
4
3
  == First Section
@@ -1,4 +1,3 @@
1
- = EacAsciidoctorBase0 Generated Source =
2
1
  //#header
3
2
 
4
3
  == First Section
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.0
4
+ version: 0.43.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Put here the authors
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.10'
33
+ version: '0.11'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.10'
40
+ version: '0.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_generic_base0
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -316,6 +316,9 @@ files:
316
316
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators/base.rb
317
317
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb
318
318
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb
319
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb
320
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb
321
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb
319
322
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners.rb
320
323
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
321
324
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb
@@ -328,10 +331,14 @@ files:
328
331
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/index.html
329
332
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb
330
333
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc
334
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title
335
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css
331
336
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb
332
337
  - sub/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb
333
338
  - sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb
334
339
  - sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc
340
+ - sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title
341
+ - sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css
335
342
  - sub/avm-eac_generic_base0/Gemfile
336
343
  - sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec
337
344
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0.rb