Sha256: 50e876b24715389b876782132af1fa17f0f28351e39f7a90edd75a79028c50eb

Contents?: true

Size: 1.19 KB

Versions: 74

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

require 'avm/eac_writings_base0/project_build'
require 'eac_cli/core_ext'

module Avm
  module Tools
    class Runner
      class AppSrc
        class EacWritingsBase0
          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::EacWritingsBase0::ProjectBuild.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
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
avm-tools-0.122.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.8.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.7.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.6.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.121.2 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.5.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.4.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.3.0 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
eac_tools-0.2.2 sub/avm-tools/lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.121.1 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.121.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.120.2 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.120.1 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.120.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.119.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.118.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.117.3 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.117.2 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.117.1 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb
avm-tools-0.117.0 lib/avm/tools/runner/app_src/eac_writings_base0/build_chapters.rb