Class: EpubTools::CompileBook
- Inherits:
-
Object
- Object
- EpubTools::CompileBook
- Defined in:
- lib/epub_tools/compile_book.rb
Overview
Orchestrates extraction, splitting, validation, and packaging of book EPUBs
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#build_dir ⇒ Object
readonly
Returns the value of attribute build_dir.
-
#cover_image ⇒ Object
readonly
Returns the value of attribute cover_image.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#source_dir ⇒ Object
readonly
Returns the value of attribute source_dir.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#initialize(title:, author:, source_dir:, cover_image: nil, output_file: nil, build_dir: nil, verbose: false) ⇒ CompileBook
constructor
title: String, author: String, source_dir: path to input epubs cover_image: optional path to cover image, output_file: filename for final epub build_dir: optional working directory for intermediate files.
-
#run ⇒ Object
Run the full compile workflow.
Constructor Details
#initialize(title:, author:, source_dir:, cover_image: nil, output_file: nil, build_dir: nil, verbose: false) ⇒ CompileBook
title: String, author: String, source_dir: path to input epubs cover_image: optional path to cover image, output_file: filename for final epub build_dir: optional working directory for intermediate files
14 15 16 17 18 19 20 21 22 |
# File 'lib/epub_tools/compile_book.rb', line 14 def initialize(title:, author:, source_dir:, cover_image: nil, output_file: nil, build_dir: nil, verbose: false) @title = title @author = @source_dir = source_dir @cover_image = cover_image @output_file = output_file || default_output_file @build_dir = build_dir || File.join(Dir.pwd, '.epub_tools_build') @verbose = verbose end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def @author end |
#build_dir ⇒ Object (readonly)
Returns the value of attribute build_dir.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def build_dir @build_dir end |
#cover_image ⇒ Object (readonly)
Returns the value of attribute cover_image.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def cover_image @cover_image end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def output_file @output_file end |
#source_dir ⇒ Object (readonly)
Returns the value of attribute source_dir.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def source_dir @source_dir end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def title @title end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/epub_tools/compile_book.rb', line 9 def verbose @verbose end |
Instance Method Details
#run ⇒ Object
Run the full compile workflow
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/epub_tools/compile_book.rb', line 25 def run clean_build_dir prepare_dirs extract_xhtmls split_xhtmls validate_sequence initialize_epub add_chapters pack_epub log "Done. Output EPUB: #{File.(output_file)}" clean_build_dir end |