eac_tools 0.41.0 → 0.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -23
  3. data/lib/eac_tools/version.rb +1 -1
  4. data/sub/avm/avm.gemspec +4 -4
  5. data/sub/avm/lib/avm/applications/base.rb +24 -3
  6. data/sub/avm/lib/avm/entries/entry.rb +5 -0
  7. data/sub/avm/lib/avm/instances/base.rb +5 -12
  8. data/sub/avm/lib/avm/instances/ids.rb +30 -0
  9. data/sub/avm/lib/avm/rspec/setup.rb +8 -0
  10. data/sub/avm/lib/avm/sources/base/instance.rb +2 -14
  11. data/sub/avm/lib/avm/version.rb +1 -1
  12. data/sub/avm/spec/spec_helper.rb +1 -1
  13. data/sub/avm-eac_asciidoctor_base0/avm-eac_asciidoctor_base0.gemspec +1 -1
  14. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb +18 -0
  15. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb +78 -0
  16. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb +50 -0
  17. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb +71 -0
  18. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/{sources → instances}/build.rb +10 -3
  19. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb +4 -4
  20. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document/title.rb +28 -0
  21. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/document.rb +47 -0
  22. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base/theme.rb +40 -0
  23. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb +7 -0
  24. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb +5 -3
  25. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb +1 -1
  26. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb +32 -0
  27. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc +16 -0
  28. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb +48 -0
  29. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc1.html +0 -0
  30. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc2/doc2_1.html +0 -0
  31. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/doc2.html +0 -0
  32. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/{sources → instances}/build_spec_files/index.html +0 -0
  33. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/body.adoc +1 -1
  34. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/content/title +1 -0
  35. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec_files/no_options/theme/main.css +0 -0
  36. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb +14 -0
  37. data/sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb +1 -4
  38. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/body.adoc +1 -1
  39. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/content/title +1 -0
  40. data/sub/avm-eac_asciidoctor_base0/template/avm/eac_asciidoctor_base0/source_generators/base/theme/main.css +0 -0
  41. data/sub/avm-eac_ruby_base1/avm-eac_ruby_base1.gemspec +2 -2
  42. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/dependencies.rb +27 -0
  43. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/gemfile_lock.rb +27 -0
  44. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/options.rb +30 -0
  45. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/version_builder.rb +52 -0
  46. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb +1 -66
  47. data/sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/version.rb +1 -1
  48. data/sub/avm-eac_ruby_base1/spec/lib/avm/eac_ruby_base1/source_generators/base_spec.rb +2 -1
  49. data/sub/eac_cli/eac_cli.gemspec +2 -2
  50. data/sub/eac_cli/lib/eac_cli/config/entry.rb +4 -0
  51. data/sub/eac_cli/lib/eac_cli/version.rb +1 -1
  52. data/sub/eac_config/eac_config.gemspec +2 -2
  53. data/sub/eac_config/lib/eac_config/entry/not_found_error.rb +13 -0
  54. data/sub/eac_config/lib/eac_config/entry.rb +7 -0
  55. data/sub/eac_config/lib/eac_config/version.rb +1 -1
  56. data/sub/eac_ruby_utils/lib/eac_ruby_utils/rspec/setup.rb +9 -0
  57. data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider/setting_value.rb +15 -6
  58. data/sub/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +5 -1
  59. data/sub/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  60. data/sub/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +9 -2
  61. metadata +34 -29
  62. data/sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/document.rb +0 -84
  63. data/sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec.rb +0 -32
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/rspec/stub_speaker'
5
+ require 'eac_ruby_utils/speaker'
4
6
 
5
7
  module EacRubyUtils
6
8
  module Rspec
@@ -13,6 +15,13 @@ module EacRubyUtils
13
15
  obj.rspec_config.setup_manager = obj
14
16
  obj.rspec_config.include(::EacRubyUtils::Rspec::Setup::SetupManager)
15
17
  end
18
+
19
+ # @return [self]
20
+ def stub_eac_speaker
21
+ ::EacRubyUtils::Speaker.context.push(::EacRubyUtils::Rspec::StubSpeaker.new)
22
+
23
+ self
24
+ end
16
25
  end
17
26
  end
18
27
  end
@@ -28,8 +28,7 @@ module EacRubyUtils
28
28
 
29
29
  def value
30
30
  parsed_options.order.each do |method|
31
- value = send("value_by_#{method}")
32
- return value if value
31
+ return send("value_by_#{method}") if send("value_by_#{method}?")
33
32
  end
34
33
  return parsed_options.default if parsed_options.respond_to?(OPTION_DEFAULT)
35
34
  return nil unless parsed_options.required
@@ -39,16 +38,26 @@ module EacRubyUtils
39
38
 
40
39
  def value_by_constant
41
40
  source.class.const_get(constant_name)
42
- rescue NameError
43
- nil
41
+ end
42
+
43
+ def value_by_constant?
44
+ source.class.const_defined?(constant_name)
44
45
  end
45
46
 
46
47
  def value_by_method
47
- source.respond_to?(key, true) ? source.send(key) : nil
48
+ source.send(key)
49
+ end
50
+
51
+ def value_by_method?
52
+ source.respond_to?(key, true)
48
53
  end
49
54
 
50
55
  def value_by_settings_object
51
- source.settings_object[key.to_s] || source.settings_object[key.to_sym]
56
+ source.settings_object.fetch(key)
57
+ end
58
+
59
+ def value_by_settings_object?
60
+ source.settings_object.key?(key)
52
61
  end
53
62
 
54
63
  private
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/hash_with_indifferent_access'
3
4
  require 'eac_ruby_utils/require_sub'
4
5
 
5
6
  module EacRubyUtils
@@ -15,8 +16,11 @@ module EacRubyUtils
15
16
  %w[settings_object method constant]
16
17
  end
17
18
 
19
+ # return [ActiveSupport::HashWithIndifferentAccess]
18
20
  def settings_object
19
- respond_to?(settings_object_name) ? send(settings_object_name) : {}
21
+ ActiveSupport::HashWithIndifferentAccess.new(
22
+ respond_to?(settings_object_name) ? send(settings_object_name) : {}
23
+ )
20
24
  end
21
25
 
22
26
  def settings_object_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.106.1'
4
+ VERSION = '0.107.0'
5
5
  end
@@ -16,6 +16,10 @@ RSpec.describe ::EacRubyUtils::SettingsProvider do
16
16
  'method_b'
17
17
  end
18
18
 
19
+ def key_f
20
+ nil
21
+ end
22
+
19
23
  def settings
20
24
  { 'key_b' => 'setting_b', key_c: 'setting_c' }
21
25
  end
@@ -33,9 +37,12 @@ RSpec.describe ::EacRubyUtils::SettingsProvider do
33
37
  [:key_b] => 'setting_b',
34
38
  ['key_b', { order: %w[constant method settings_object] }] => 'method_b',
35
39
  ['key_c'] => 'setting_c',
36
- ['key_d'] => 'constant_d'
40
+ ['key_d'] => 'constant_d',
41
+ ['key_f'] => nil
37
42
  }.each do |args, expected_value|
38
- it { expect(stub.setting_value(*args)).to eq(expected_value) }
43
+ context "when args are \"#{args}\"" do
44
+ it { expect(stub.setting_value(*args)).to eq(expected_value) }
45
+ end
39
46
  end
40
47
 
41
48
  it do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.43.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: avm
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.54'
19
+ version: '0.55'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.54'
26
+ version: '0.55'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: avm-eac_asciidoctor_base0
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
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.9'
40
+ version: '0.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_generic_base0
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -148,20 +148,14 @@ dependencies:
148
148
  requirements:
149
149
  - - "~>"
150
150
  - !ruby/object:Gem::Version
151
- version: '0.26'
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- version: 0.26.2
151
+ version: '0.27'
155
152
  type: :runtime
156
153
  prerelease: false
157
154
  version_requirements: !ruby/object:Gem::Requirement
158
155
  requirements:
159
156
  - - "~>"
160
157
  - !ruby/object:Gem::Version
161
- version: '0.26'
162
- - - ">="
163
- - !ruby/object:Gem::Version
164
- version: 0.26.2
158
+ version: '0.27'
165
159
  - !ruby/object:Gem::Dependency
166
160
  name: avm-eac_webapp_base0
167
161
  requirement: !ruby/object:Gem::Requirement
@@ -228,20 +222,14 @@ dependencies:
228
222
  requirements:
229
223
  - - "~>"
230
224
  - !ruby/object:Gem::Version
231
- version: '0.106'
232
- - - ">="
233
- - !ruby/object:Gem::Version
234
- version: 0.106.1
225
+ version: '0.107'
235
226
  type: :runtime
236
227
  prerelease: false
237
228
  version_requirements: !ruby/object:Gem::Requirement
238
229
  requirements:
239
230
  - - "~>"
240
231
  - !ruby/object:Gem::Version
241
- version: '0.106'
242
- - - ">="
243
- - !ruby/object:Gem::Version
244
- version: 0.106.1
232
+ version: '0.107'
245
233
  - !ruby/object:Gem::Dependency
246
234
  name: eac_ruby_gem_support
247
235
  requirement: !ruby/object:Gem::Requirement
@@ -317,6 +305,10 @@ files:
317
305
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_host.rb
318
306
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/apache_path.rb
319
307
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/base.rb
308
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build.rb
309
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document.rb
310
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/header_macro_value.rb
311
+ - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/build/document/pre_process_line.rb
320
312
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/instances/deploy.rb
321
313
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners.rb
322
314
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/runners/base.rb
@@ -324,22 +316,29 @@ files:
324
316
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/source_generators/base.rb
325
317
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources.rb
326
318
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/base.rb
327
- - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build.rb
328
- - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/build/document.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
329
322
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners.rb
330
323
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/build.rb
331
324
  - sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/version.rb
325
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec.rb
326
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build/document_spec_files/pre_processed_root_body.adoc
327
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec.rb
328
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/doc1.html
329
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/doc2.html
330
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/doc2/doc2_1.html
331
+ - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/instances/build_spec_files/index.html
332
332
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/source_generators/base_spec.rb
333
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
334
336
  - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/base_spec.rb
335
- - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec.rb
336
- - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec_files/doc1.html
337
- - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec_files/doc2.html
338
- - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec_files/doc2/doc2_1.html
339
- - sub/avm-eac_asciidoctor_base0/spec/lib/avm/eac_asciidoctor_base0/sources/build_spec_files/index.html
340
337
  - sub/avm-eac_asciidoctor_base0/spec/rubocop_spec.rb
341
338
  - sub/avm-eac_asciidoctor_base0/spec/spec_helper.rb
342
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
343
342
  - sub/avm-eac_generic_base0/Gemfile
344
343
  - sub/avm-eac_generic_base0/avm-eac_generic_base0.gemspec
345
344
  - sub/avm-eac_generic_base0/lib/avm/eac_generic_base0.rb
@@ -592,6 +591,10 @@ files:
592
591
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/runners/base/rubocop.rb
593
592
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators.rb
594
593
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base.rb
594
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/dependencies.rb
595
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/gemfile_lock.rb
596
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/options.rb
597
+ - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/source_generators/base/version_builder.rb
595
598
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources.rb
596
599
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base.rb
597
600
  - sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/base/bundle_command.rb
@@ -1008,6 +1011,7 @@ files:
1008
1011
  - sub/avm/lib/avm/instances/base/web.rb
1009
1012
  - sub/avm/lib/avm/instances/docker_image.rb
1010
1013
  - sub/avm/lib/avm/instances/entry_keys.rb
1014
+ - sub/avm/lib/avm/instances/ids.rb
1011
1015
  - sub/avm/lib/avm/instances/runner.rb
1012
1016
  - sub/avm/lib/avm/launcher.rb
1013
1017
  - sub/avm/lib/avm/launcher/context.rb
@@ -1174,6 +1178,7 @@ files:
1174
1178
  - sub/eac_config/eac_config.gemspec
1175
1179
  - sub/eac_config/lib/eac_config.rb
1176
1180
  - sub/eac_config/lib/eac_config/entry.rb
1181
+ - sub/eac_config/lib/eac_config/entry/not_found_error.rb
1177
1182
  - sub/eac_config/lib/eac_config/entry_path.rb
1178
1183
  - sub/eac_config/lib/eac_config/envvars_node.rb
1179
1184
  - sub/eac_config/lib/eac_config/envvars_node/entry.rb
@@ -1,84 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'asciidoctor'
4
-
5
- module Avm
6
- module EacAsciidoctorBase0
7
- module Sources
8
- class Build
9
- class Document
10
- ROOT_BODY_TARGET_BASENAME = 'index'
11
-
12
- enable_simple_cache
13
- enable_speaker
14
- common_constructor :build, :parent_document, :basename
15
-
16
- # Absolute path to the Asciidoctor file.
17
- #
18
- # @return [Pathname]
19
- def body_source_path
20
- root_source_path.join(
21
- ::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME
22
- )
23
- end
24
-
25
- # Absolute path to the output of Asciidoctor's source file.
26
- #
27
- # @return [Pathname]
28
- def body_target_path
29
- build.target_directory.join(
30
- parent_document.present? ? subpath : ROOT_BODY_TARGET_BASENAME
31
- ).basename_sub('.*') { |b| "#{b}.html" }
32
- end
33
-
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
- def perform
43
- perform_self
44
- perform_children
45
- end
46
-
47
- def perform_self
48
- infov 'Building', root_source_path
49
- ::Asciidoctor.convert_file(
50
- body_source_path.to_path,
51
- to_file: body_target_path.to_path, safe: :unsafe, mkdirs: true
52
- )
53
- end
54
-
55
- def perform_children
56
- children.each(&:perform)
57
- end
58
-
59
- def tree_documents_count
60
- children.inject(1) { |a, e| a + e.tree_documents_count }
61
- end
62
-
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
- private
75
-
76
- def children_uncached
77
- root_source_path.children.select(&:directory?)
78
- .map { |path| self.class.new(build, self, path.basename) }
79
- end
80
- end
81
- end
82
- end
83
- end
84
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_asciidoctor_base0/sources/base'
4
- require 'avm/eac_asciidoctor_base0/sources/build'
5
- require 'eac_fs/comparator'
6
-
7
- ::RSpec.describe ::Avm::EacAsciidoctorBase0::Sources::Build do
8
- let(:fixtures_dir) { __dir__.to_pathname.join('build_spec_files') }
9
- let(:fs_comparator) { ::EacFs::Comparator.new.truncate_file('*.html') }
10
- let(:instance) { described_class.new(source) }
11
- let(:source) { avm_source('EacAsciidoctorBase0') }
12
- let(:target_dir) { fixtures_dir }
13
- let(:main_document) do
14
- source.path.join(::Avm::EacAsciidoctorBase0::Sources::Base::MAIN_FILE_SUBPATH)
15
- end
16
-
17
- before do
18
- %w[doc1 doc2 doc2/doc2_1].each do |subpath|
19
- target_dir = source.content_directory.join(subpath)
20
- target_dir.mkpath
21
- ::FileUtils.cp(
22
- main_document,
23
- target_dir.join(::Avm::EacAsciidoctorBase0::Sources::Base::CONTENT_DOCUMENT_BASENAME)
24
- )
25
- end
26
- instance.perform
27
- end
28
-
29
- it do
30
- expect(fs_comparator.build(instance.target_directory)).to eq(fs_comparator.build(target_dir))
31
- end
32
- end