Class: Bookbinder::Commands::Imprint
- Inherits:
-
Object
- Object
- Bookbinder::Commands::Imprint
- Includes:
- Naming
- Defined in:
- lib/bookbinder/commands/imprint.rb
Instance Method Summary collapse
-
#initialize(base_streams, output_locations: nil, config_fetcher: nil, preprocessor: nil, cloner_factory: nil, section_repository: nil, directory_preparer: nil) ⇒ Imprint
constructor
A new instance of Imprint.
- #run(cli_arguments) ⇒ Object
- #usage ⇒ Object
Methods included from Naming
#command_for?, #command_type, #flag?
Constructor Details
#initialize(base_streams, output_locations: nil, config_fetcher: nil, preprocessor: nil, cloner_factory: nil, section_repository: nil, directory_preparer: nil) ⇒ Imprint
Returns a new instance of Imprint.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bookbinder/commands/imprint.rb', line 9 def initialize(base_streams, output_locations: nil, config_fetcher: nil, preprocessor: nil, cloner_factory: nil, section_repository: nil, directory_preparer: nil) @base_streams = base_streams @output_locations = output_locations @config_fetcher = config_fetcher @preprocessor = preprocessor @cloner_factory = cloner_factory @section_repository = section_repository @directory_preparer = directory_preparer end |
Instance Method Details
#run(cli_arguments) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bookbinder/commands/imprint.rb', line 30 def run(cli_arguments) = Components::CommandOptions.new(cli_arguments, base_streams).tap(&:validate!) config = config_fetcher.fetch_config cloner = cloner_factory.produce(.local_repo_dir) directory_preparer.prepare_directories(output_locations) sections = section_repository.fetch( configured_sections: config.sections, destination_dir: output_locations.cloned_preprocessing_dir, ref_override: .ref_override, cloner: cloner, streams: base_streams ) preprocessor.preprocess( sections, output_locations, options: ., output_streams: .streams, config: config ) .streams[:success].puts "Bookbinder printed your pdf(s) into #{output_locations.pdf_artifact_dir}" 0 end |
#usage ⇒ Object
26 27 28 |
# File 'lib/bookbinder/commands/imprint.rb', line 26 def usage ["imprint <local|remote> [--verbose] [--dita-flags=\\\"<dita-option>=<value>\\\"]", "Generate a PDF for a given book"] end |