Sha256: 785c9e0ffcbd249bd3dd39ce26c997366f58814508ded4e4230c92e0c160931e

Contents?: true

Size: 1.11 KB

Versions: 113

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'avm/eac_latex_base0/sources/build'
require 'eac_cli/core_ext'

module Avm
  module EacLatexBase0
    module Sources
      module Runners
        class BuildChapters
          runner_with :help do
            arg_opt '-o', '--output-dir', 'Output chapters to specific directory.'
          end

          def run
            runner_context.call(:project_banner)
            output_dir.mkpath
            project.chapters.each_with_index do |c, i|
              ::Avm::EacLatexBase0::Sources::Build.new(project, chapter_build_options(c, i))
            end
          end

          private

          def chapter_build_options(chapter, index)
            output_name = "#{(index + 1).to_s.rjust(3, '0')}_#{chapter}.pdf"
            { output_file: output_dir.join(output_name), chapter: chapter }
          end

          def output_dir_uncached
            (
              parsed.output_dir || project.default_output_dir.join('chapters')
            ).to_pathname
          end

          def project
            runner_context.call(:project)
          end
        end
      end
    end
  end
end

Version data entries

113 entries across 113 versions & 2 rubygems

Version Path
avm-eac_latex_base0-0.3.2 lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.85.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.85.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.84.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.84.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.84.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.83.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.82.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.81.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.80.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.79.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.78.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.77.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.77.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.76.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.76.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.75.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.75.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.75.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb
eac_tools-0.74.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/runners/build_chapters.rb