Class: Bidi2pdf::CLI
- Inherits:
-
Thor
- Object
- Thor
- Bidi2pdf::CLI
- Defined in:
- lib/bidi2pdf/cli.rb
Overview
rubocop:disable Metrics/AbcSize
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
81 82 83 |
# File 'lib/bidi2pdf/cli.rb', line 81 def exit_on_failure? true end |
Instance Method Details
#render ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bidi2pdf/cli.rb', line 86 def render load_config configure Bidi2pdf.logger.info "Rendering: #{[:url]} -> #{[:output]}" Bidi2pdf.logger.info "Print options: #{.inspect}" if () if launcher.launch ensure launcher.stop if defined?(@launcher) && @launcher end |
#template ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/bidi2pdf/cli.rb', line 112 def template config = { "url" => "https://example.com", "output" => "output.pdf", "headless" => true, "print_options" => { "background" => true, "orientation" => "portrait", "margin" => { "top" => 1.0, "bottom" => 1.0, "left" => 1.0, "right" => 1.0 } } } File.write([:output], config.to_yaml) puts "Config template written to #{[:output]}" end |