Class: Laser::Cutter::CLI::Generate
- Defined in:
- lib/laser/cutter/cli/generate.rb
Overview
The generate command: draws a box into a PDF or an SVG, with a progress bar, and saves or reads its settings as JSON.
Constant Summary collapse
- BANNER =
The first line of the opening box.
"Laser-Cutter (ruby gem) Version #{Laser::Cutter::VERSION}, © 2015-2026 Konstantin Gredeskoul".freeze
- BOX_CHROME =
Columns a box spends on its borders and padding.
6- DIMENSIONS =
What the opening box reports, in this order.
%i[width height depth thickness notch kerf].freeze
- RUN_ONLY =
Options that describe the run rather than the box, kept out of a saved configuration.
%i[verbose read write open format args].freeze
Constants inherited from Command
Instance Method Summary collapse
Methods inherited from Command
finalize!, inherited, #progress, #ui
Instance Method Details
#call(format:, verbose:, **options) ⇒ void
This method returns an undefined value.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/laser/cutter/cli/generate.rb', line 66 def call(format:, verbose:, **) config = configuration() ui.debug('Configuration:', JSON.pretty_generate(config.to_hash)) if verbose config.validate! renderer = Renderer.for(format, config) ui.info(BANNER, dimensions(config), "Format: #{format.upcase}") ConfigFile.new([:write]).write(config.to_hash, out) if [:write] progress("Drawing #{File.basename(config.file)}", total: renderer.total) do || renderer.render { .advance } end report(format, File.(config.file)) system('open', config.file) if [:open] end |