avm-tools 0.129.1 → 0.132.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/avm/tools/runner/app_src.rb +4 -14
  3. data/lib/avm/tools/runner/source_generate.rb +2 -35
  4. data/lib/avm/tools/version.rb +1 -1
  5. metadata +4 -46
  6. data/lib/avm/eac_writings_base0/apache_host.rb +0 -17
  7. data/lib/avm/eac_writings_base0/commons.rb +0 -12
  8. data/lib/avm/eac_writings_base0/deploy.rb +0 -36
  9. data/lib/avm/eac_writings_base0/file_build/base_stereotype.rb +0 -19
  10. data/lib/avm/eac_writings_base0/file_build/chapter_index.rb +0 -23
  11. data/lib/avm/eac_writings_base0/file_build/tex_source.rb +0 -33
  12. data/lib/avm/eac_writings_base0/file_build.rb +0 -45
  13. data/lib/avm/eac_writings_base0/instance.rb +0 -11
  14. data/lib/avm/eac_writings_base0/project.rb +0 -33
  15. data/lib/avm/eac_writings_base0/project_build/chapters_content.rb +0 -47
  16. data/lib/avm/eac_writings_base0/project_build/copy_files.rb +0 -42
  17. data/lib/avm/eac_writings_base0/project_build.rb +0 -117
  18. data/lib/avm/eac_writings_base0.rb +0 -9
  19. data/lib/avm/rails.rb +0 -9
  20. data/lib/avm/ruby/bundler.rb +0 -11
  21. data/lib/avm/ruby/gems/generator.rb +0 -165
  22. data/lib/avm/ruby/gems.rb +0 -11
  23. data/lib/avm/ruby.rb +0 -9
  24. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb +0 -45
  25. data/lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb +0 -35
  26. data/lib/avm/tools/runner/app_src/eac_writings_base0/info.rb +0 -34
  27. data/lib/avm/tools/runner/app_src/eac_writings_base0.rb +0 -33
  28. data/lib/avm/tools/runner/eac_writings_base0.rb +0 -14
  29. data/lib/avm/tools/runner/ruby/gems/generate.rb +0 -39
  30. data/lib/avm/tools/runner/ruby/gems.rb +0 -19
  31. data/lib/avm/tools/runner/ruby/rubocop.rb +0 -30
  32. data/lib/avm/tools/runner/ruby.rb +0 -17
  33. data/template/avm/eac_writings_base0/commons/all.tex +0 -5
  34. data/template/avm/eac_writings_base0/commons/ebook.tex +0 -11
  35. data/template/avm/eac_writings_base0/commons/images.tex +0 -11
  36. data/template/avm/eac_writings_base0/commons/links.tex +0 -2
  37. data/template/avm/eac_writings_base0/commons/portuguese.tex +0 -8
  38. data/template/avm/eac_writings_base0/commons/source_code/java.tex +0 -15
  39. data/template/avm/eac_writings_base0/commons/source_code.tex +0 -21
  40. data/template/avm/eac_writings_base0/commons/utils.tex +0 -6
  41. data/template/avm/eac_writings_base0/deploy/index.html.template +0 -9
  42. data/template/avm/ruby/gems/generator/gemspec.template +0 -18
  43. data/template/avm/ruby/gems/generator/root_lib.template +0 -7
  44. data/template/avm/ruby/gems/generator/static/Gemfile +0 -5
  45. data/template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb +0 -3
  46. data/template/avm/ruby/gems/generator/static/spec/spec_helper.rb +0 -4
  47. data/template/avm/ruby/gems/generator/version.template +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f5d19e88ae6cbf388d46a45edc8e119da03cf22830eb9ce545e5231b9a3386b
4
- data.tar.gz: e2e7507a7d8ea822d034d8a39a91450393858f49d0f5c62edd0519b3baa24d41
3
+ metadata.gz: 9648969bee993364d2ece3102586eccf9eafcd7a8edfde0960cab80bf06f3fe3
4
+ data.tar.gz: b0c806bebd2ae820c11874b4ae1e2e173dd013b25e462d85c39c8a93825dfa2a
5
5
  SHA512:
6
- metadata.gz: c9d1004d678667bd5df8fe9ec275f62bcebc21fd308b6640a504c15ac8093cfe603f907bb6cd7e47a654acbfcb01fbca25d103b168d6cf13b92dd32814d77a61
7
- data.tar.gz: 46ef40a420bd173412be7736a14d0294de7e570db8d00a9a2d24e75d43a83f524c732a76b110518ae13048366284464cc94a45e14d92b802f304714a4b8428ad
6
+ metadata.gz: 54ed3de6d9aa181c92aef0645dcc3b76949ca0d63b4d6d39abf5aa023566a8610c990ceaa34981a0967ac459c3c23fe819bdc3a33b45497a4be9bf88d8cd22f1
7
+ data.tar.gz: 66e74ff1862a77c581c9196d42ebf4d9b082cf44b70424676995d309f990f5f02eb85b70dcef004036267b7dc04f7f2bb09da474f67d83c5b1f2cd42997af919
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'avm/sources/runner'
3
4
  require 'avm/tools/app_src'
4
5
  require 'eac_cli/core_ext'
5
6
 
6
7
  module Avm
7
8
  module Tools
8
9
  class Runner
9
- class AppSrc
10
+ class AppSrc < ::Avm::Sources::Runner
10
11
  require_sub __FILE__
11
- runner_with :help, :subcommands do
12
- desc 'Utilities for local projects.'
13
- arg_opt '-C', '--path', 'Path to local project instance.'
14
- subcommands
15
- end
16
12
 
17
13
  def instance_banner
18
14
  infov 'Instance', instance
@@ -20,19 +16,13 @@ module Avm
20
16
  end
21
17
 
22
18
  def subject
23
- instance.avm_instance
19
+ source
24
20
  end
25
21
 
26
- delegate :extra_available_subcommands, to: :subject
27
-
28
22
  private
29
23
 
30
24
  def instance_uncached
31
- ::Avm::Tools::AppSrc.new(instance_path)
32
- end
33
-
34
- def instance_path_uncached
35
- (parsed.path || '.').to_pathname.expand_path
25
+ ::Avm::Tools::AppSrc.new(source_path)
36
26
  end
37
27
  end
38
28
  end
@@ -1,44 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'avm/runners/base'
4
- require 'eac_cli/core_ext'
3
+ require 'avm/source_generators/runner'
5
4
 
6
5
  module Avm
7
6
  module Tools
8
7
  class Runner
9
- class SourceGenerate
10
- runner_with :help do
11
- pos_arg :stereotype_name
12
- pos_arg :target_path
13
- end
14
-
15
- def run
16
- start_banner
17
- generate
18
- end
19
-
20
- def generate
21
- infom 'Generating...'
22
- generator.perform
23
- success "Source generated in \"#{generator.target_path}\""
24
- end
25
-
26
- def start_banner
27
- infov 'Stereotype', stereotype_name
28
- infov 'Target path', target_path
29
- infov 'Generator', generator.class
30
- end
31
-
32
- def generator_uncached
33
- ::Avm::Registry.source_generators.detect_optional(stereotype_name, target_path) ||
34
- fatal_error("No generator found for stereotype \"#{stereotype_name}\"")
35
- end
36
-
37
- delegate :stereotype_name, to: :parsed
38
-
39
- def target_path
40
- parsed.target_path.to_pathname
41
- end
8
+ class SourceGenerate < ::Avm::SourceGenerators::Runner
42
9
  end
43
10
  end
44
11
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avm
4
4
  module Tools
5
- VERSION = '0.129.1'
5
+ VERSION = '0.132.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avm-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.129.1
4
+ version: 0.132.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-04 00:00:00.000000000 Z
11
+ date: 2022-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aranha-parsers
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.30'
33
+ version: '0.34'
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.30'
40
+ version: '0.34'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: avm-eac_ruby_base1
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -252,19 +252,6 @@ files:
252
252
  - Gemfile
253
253
  - exe/avm
254
254
  - lib/avm.rb
255
- - lib/avm/eac_writings_base0.rb
256
- - lib/avm/eac_writings_base0/apache_host.rb
257
- - lib/avm/eac_writings_base0/commons.rb
258
- - lib/avm/eac_writings_base0/deploy.rb
259
- - lib/avm/eac_writings_base0/file_build.rb
260
- - lib/avm/eac_writings_base0/file_build/base_stereotype.rb
261
- - lib/avm/eac_writings_base0/file_build/chapter_index.rb
262
- - lib/avm/eac_writings_base0/file_build/tex_source.rb
263
- - lib/avm/eac_writings_base0/instance.rb
264
- - lib/avm/eac_writings_base0/project.rb
265
- - lib/avm/eac_writings_base0/project_build.rb
266
- - lib/avm/eac_writings_base0/project_build/chapters_content.rb
267
- - lib/avm/eac_writings_base0/project_build/copy_files.rb
268
255
  - lib/avm/launcher/context.rb
269
256
  - lib/avm/launcher/context/instance_collector.rb
270
257
  - lib/avm/launcher/context/instance_discovery.rb
@@ -324,21 +311,12 @@ files:
324
311
  - lib/avm/projects/stereotypes/ruby_gem.rb
325
312
  - lib/avm/projects/stereotypes/ruby_gem/local_project_mixin.rb
326
313
  - lib/avm/projects/stereotypes/ruby_gem/publish.rb
327
- - lib/avm/rails.rb
328
- - lib/avm/ruby.rb
329
- - lib/avm/ruby/bundler.rb
330
- - lib/avm/ruby/gems.rb
331
- - lib/avm/ruby/gems/generator.rb
332
314
  - lib/avm/stereotypes.rb
333
315
  - lib/avm/tools.rb
334
316
  - lib/avm/tools/app_src.rb
335
317
  - lib/avm/tools/core_ext.rb
336
318
  - lib/avm/tools/runner.rb
337
319
  - lib/avm/tools/runner/app_src.rb
338
- - lib/avm/tools/runner/app_src/eac_writings_base0.rb
339
- - lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
340
- - lib/avm/tools/runner/app_src/eac_writings_base0/build_single.rb
341
- - lib/avm/tools/runner/app_src/eac_writings_base0/info.rb
342
320
  - lib/avm/tools/runner/app_src/info.rb
343
321
  - lib/avm/tools/runner/app_src/issue.rb
344
322
  - lib/avm/tools/runner/app_src/issue/complete.rb
@@ -356,7 +334,6 @@ files:
356
334
  - lib/avm/tools/runner/config.rb
357
335
  - lib/avm/tools/runner/config/load_path.rb
358
336
  - lib/avm/tools/runner/eac_webapp_base0.rb
359
- - lib/avm/tools/runner/eac_writings_base0.rb
360
337
  - lib/avm/tools/runner/files.rb
361
338
  - lib/avm/tools/runner/files/format.rb
362
339
  - lib/avm/tools/runner/files/rotate.rb
@@ -377,10 +354,6 @@ files:
377
354
  - lib/avm/tools/runner/launcher/instances.rb
378
355
  - lib/avm/tools/runner/launcher/projects.rb
379
356
  - lib/avm/tools/runner/launcher/publish.rb
380
- - lib/avm/tools/runner/ruby.rb
381
- - lib/avm/tools/runner/ruby/gems.rb
382
- - lib/avm/tools/runner/ruby/gems/generate.rb
383
- - lib/avm/tools/runner/ruby/rubocop.rb
384
357
  - lib/avm/tools/runner/self.rb
385
358
  - lib/avm/tools/runner/self/docker.rb
386
359
  - lib/avm/tools/runner/self/registry.rb
@@ -389,21 +362,6 @@ files:
389
362
  - lib/avm/tools/version.rb
390
363
  - locale/en.yml
391
364
  - locale/pt-BR.yml
392
- - template/avm/eac_writings_base0/commons/all.tex
393
- - template/avm/eac_writings_base0/commons/ebook.tex
394
- - template/avm/eac_writings_base0/commons/images.tex
395
- - template/avm/eac_writings_base0/commons/links.tex
396
- - template/avm/eac_writings_base0/commons/portuguese.tex
397
- - template/avm/eac_writings_base0/commons/source_code.tex
398
- - template/avm/eac_writings_base0/commons/source_code/java.tex
399
- - template/avm/eac_writings_base0/commons/utils.tex
400
- - template/avm/eac_writings_base0/deploy/index.html.template
401
- - template/avm/ruby/gems/generator/gemspec.template
402
- - template/avm/ruby/gems/generator/root_lib.template
403
- - template/avm/ruby/gems/generator/static/Gemfile
404
- - template/avm/ruby/gems/generator/static/spec/rubocop_spec.rb
405
- - template/avm/ruby/gems/generator/static/spec/spec_helper.rb
406
- - template/avm/ruby/gems/generator/version.template
407
365
  - template/avm/self/docker_image/Dockerfile
408
366
  - template/avm/self/docker_image/entrypoint.sh
409
367
  homepage:
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/apache_host'
4
-
5
- module Avm
6
- module EacWritingsBase0
7
- class ApacheHost < ::Avm::EacWebappBase0::ApacheHost
8
- def document_root
9
- instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
10
- end
11
-
12
- def extra_content
13
- ''
14
- end
15
- end
16
- end
17
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_templates/core_ext'
4
- require 'singleton'
5
-
6
- module Avm
7
- module EacWritingsBase0
8
- class Commons
9
- include ::Singleton
10
- end
11
- end
12
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/deploy'
4
- require 'avm/eac_writings_base0/project'
5
- require 'avm/eac_writings_base0/project_build'
6
-
7
- module Avm
8
- module EacWritingsBase0
9
- class Deploy < ::Avm::EacWebappBase0::Deploy
10
- def build_content
11
- ::Avm::EacWritingsBase0::ProjectBuild.new(project, output_file:
12
- build_dir.join(pdf_path))
13
- end
14
-
15
- def title
16
- instance.id.humanize
17
- end
18
-
19
- def pdf_path
20
- "#{instance.id.underscore}.pdf"
21
- end
22
-
23
- def variables_source
24
- self
25
- end
26
-
27
- private
28
-
29
- def project_uncached
30
- ::Avm::EacWritingsBase0::Project.new(
31
- instance.source_instance.read_entry(::Avm::Instances::EntryKeys::FS_PATH)
32
- )
33
- end
34
- end
35
- end
36
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module EacWritingsBase0
5
- class FileBuild
6
- module BaseStereotype
7
- private
8
-
9
- def target_subpath
10
- subpath
11
- end
12
-
13
- def copy(target_path)
14
- FileUtils.copy_file(source_path, target_path)
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module EacWritingsBase0
5
- class FileBuild
6
- module ChapterIndex
7
- class << self
8
- def match?(subpath)
9
- ::File.basename(subpath) == 'index.tex'
10
- end
11
- end
12
-
13
- private
14
-
15
- def target_subpath
16
- ::Avm::EacWritingsBase0::ProjectBuild.chapter_filename(
17
- File.basename(File.dirname(subpath))
18
- ) + '.tex'
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module EacWritingsBase0
5
- class FileBuild
6
- module TexSource
7
- class << self
8
- def match?(subpath)
9
- ::File.extname(subpath) == '.tex'
10
- end
11
- end
12
-
13
- private
14
-
15
- def copy(target_path)
16
- ::File.write(target_path, target_content)
17
- end
18
-
19
- def target_content
20
- s = ::File.read(source_path)
21
- replacements.each do |from, to|
22
- s = s.gsub(from, to)
23
- end
24
- s
25
- end
26
-
27
- def replacements
28
- { '%dir%' => ::File.dirname(subpath) }
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module EacWritingsBase0
7
- class FileBuild
8
- require_sub __FILE__
9
- include ::Avm::EacWritingsBase0::FileBuild::BaseStereotype
10
- DEFAULT_STEREOTYPES = [::Avm::EacWritingsBase0::FileBuild::ChapterIndex,
11
- ::Avm::EacWritingsBase0::FileBuild::TexSource].freeze
12
-
13
- class << self
14
- def stereotypes
15
- DEFAULT_STEREOTYPES
16
- end
17
- end
18
-
19
- common_constructor :project, :subpath do
20
- self.class.stereotypes.each do |stereotype|
21
- singleton_class.prepend(stereotype) if stereotype.match?(subpath)
22
- end
23
- end
24
-
25
- def build_to_dir(build_root_target_dir)
26
- create_target_dir(build_root_target_dir)
27
- copy(target_path(build_root_target_dir))
28
- end
29
-
30
- private
31
-
32
- def create_target_dir(build_root_target_dir)
33
- FileUtils.mkdir_p(File.dirname(target_path(build_root_target_dir)))
34
- end
35
-
36
- def source_path
37
- File.join(project.root, subpath)
38
- end
39
-
40
- def target_path(build_root_target_dir)
41
- File.join(build_root_target_dir, target_subpath)
42
- end
43
- end
44
- end
45
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_webapp_base0/instance'
4
-
5
- module Avm
6
- module EacWritingsBase0
7
- class Instance < ::Avm::EacWebappBase0::Instance
8
- FILES_UNITS = {}.freeze
9
- end
10
- end
11
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module EacWritingsBase0
7
- class Project
8
- common_constructor :root do
9
- self.root = root.to_pathname
10
- end
11
-
12
- def chapters
13
- chapters_file.read.split("\n").map(&:strip).reject { |c| c == '' }
14
- end
15
-
16
- def chapters_file
17
- root.join('chapters')
18
- end
19
-
20
- def name
21
- root.basename.to_s
22
- end
23
-
24
- def default_output_dir
25
- root.join('dist')
26
- end
27
-
28
- def default_output_file
29
- root.join("#{name}.pdf")
30
- end
31
- end
32
- end
33
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Avm
4
- module EacWritingsBase0
5
- class ProjectBuild
6
- class << self
7
- def chapter_filename(chapter_name)
8
- "chapter_#{chapter_name}"
9
- end
10
- end
11
-
12
- module ChaptersContent
13
- private
14
-
15
- def chapter
16
- options[:chapter]
17
- end
18
-
19
- def chapter_filename(chapter_name)
20
- ::Avm::EacWritingsBase0::ProjectBuild.chapter_filename(chapter_name)
21
- end
22
-
23
- def check_chapter
24
- return unless chapter
25
- return if project.chapters.include?(chapter)
26
-
27
- fatal_error("Chapter not found: \"#{chapter}\" (List: #{project.chapters})")
28
- end
29
-
30
- def include_content
31
- main_path = source_temp_dir.join('main.tex')
32
- main_path.write(main_path.read.gsub(CONTENT_VAR, include_chapters_content))
33
- end
34
-
35
- def include_chapters_content
36
- r = chapters_content
37
- r = "\\maketitle\n\n#{r}" if chapter.blank?
38
- r
39
- end
40
-
41
- def chapters_content
42
- project.chapters.map { |c| "\\include{#{chapter_filename(c)}}" }.join("\n")
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/eac_writings_base0/commons'
4
- require 'avm/eac_writings_base0/file_build'
5
-
6
- module Avm
7
- module EacWritingsBase0
8
- class ProjectBuild
9
- module CopyFiles
10
- def copy_project_files
11
- copy_project_dir('.')
12
- end
13
-
14
- def copy_project_obj(subpath)
15
- return if File.basename(subpath).start_with?('.')
16
-
17
- if File.directory?(File.join(project.root, subpath))
18
- copy_project_dir(subpath)
19
- else
20
- copy_project_file(subpath)
21
- end
22
- end
23
-
24
- def copy_project_file(subpath)
25
- ::Avm::EacWritingsBase0::FileBuild.new(project, subpath).build_to_dir(source_temp_dir)
26
- end
27
-
28
- def copy_project_dir(subpath)
29
- Dir.entries(File.join(project.root, subpath)).each do |f|
30
- copy_project_obj(File.join(subpath, f))
31
- end
32
- end
33
-
34
- def copy_commons_files
35
- target_dir = source_temp_dir.join('commons')
36
- target_dir.mkpath
37
- ::Avm::EacWritingsBase0::Commons.instance.template.apply(self, target_dir)
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,117 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'avm/executables'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/fs/temp'
6
- require 'eac_ruby_utils/fs/clearable_directory'
7
-
8
- module Avm
9
- module EacWritingsBase0
10
- class ProjectBuild
11
- require_sub __FILE__, include_modules: true
12
- enable_speaker
13
-
14
- CONTENT_VAR = '%%%CONTENT%%%'
15
-
16
- common_constructor :project, :options do
17
- run
18
- end
19
-
20
- private
21
-
22
- attr_reader :source_temp_dir
23
-
24
- def run
25
- start_banner
26
- check_chapter
27
- build
28
- success('Done!')
29
- end
30
-
31
- def start_banner
32
- infov('Chapter', chapter)
33
- infov('Output file', output_file)
34
- end
35
-
36
- def build
37
- on_temp_source_dir do
38
- copy_project_files
39
- copy_commons_files
40
- include_content
41
- compile
42
- check
43
- move_output_to_target
44
- open_output
45
- end
46
- end
47
-
48
- def check
49
- return if ::File.size(temp_output_file).positive?
50
-
51
- fatal_error("Zero-size file builded: #{temp_output_file}")
52
- end
53
-
54
- def compile
55
- compile_command.execute!.each_line do |line|
56
- if line.include?('No file')
57
- raise 'Command returned without error, but there is at least one "No file" line in' \
58
- "log: #{line}"
59
- end
60
- end
61
- end
62
-
63
- def compile_command
64
- ::Avm::Executables.latex.command(*compile_command_args).chdir(source_temp_dir)
65
- end
66
-
67
- def compile_command_args
68
- r = ["-output-director=#{build_dir}", '-output-format=pdf',
69
- '-interaction=nonstopmode', '-halt-on-error', '-file-line-error']
70
- r << if chapter.present?
71
- "\\includeonly{#{chapter_filename(chapter)}}\\input{main.tex}"
72
- else
73
- './main.tex'
74
- end
75
- r
76
- end
77
-
78
- def move_output_to_target
79
- File.rename(temp_output_file, output_file)
80
- infov('Size', ::Filesize.from("#{File.size(output_file)} B").pretty)
81
- end
82
-
83
- def temp_output_file
84
- File.join(build_dir, 'main.pdf')
85
- end
86
-
87
- def on_temp_source_dir
88
- if options[:source_dir].present?
89
- @source_temp_dir = ::EacRubyUtils::Fs::ClearableDirectory.new(options.source_dir).clear
90
- yield
91
- else
92
- ::EacRubyUtils::Fs::Temp.on_directory do |directory|
93
- @source_temp_dir = directory
94
- yield
95
- end
96
- end
97
- end
98
-
99
- def build_dir
100
- r = project.root.join('build')
101
- r.mkpath
102
- r
103
- end
104
-
105
- def output_file
106
- (options[:output_file] || project.default_output_file)
107
- end
108
-
109
- def open_output
110
- return unless options[:open]
111
-
112
- infom("Opening \"#{output_file}\"")
113
- ::Avm::Executables.xdg_open.command(output_file).system!
114
- end
115
- end
116
- end
117
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Avm
6
- module EacWritingsBase0
7
- require_sub __FILE__
8
- end
9
- end