Class: Magma::App
- Inherits:
-
Thor
- Object
- Thor
- Magma::App
- Defined in:
- lib/magma/app.rb
Overview
The CLI application
Class Method Summary collapse
Instance Method Summary collapse
- #prepare(infile = nil) ⇒ Object
- #render(outfile) ⇒ Object
- #template(infile = nil) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
14 15 16 |
# File 'lib/magma/app.rb', line 14 def exit_on_failure? true end |
Instance Method Details
#prepare(infile = nil) ⇒ Object
64 65 66 |
# File 'lib/magma/app.rb', line 64 def prepare(infile = nil) Preparer.call infile, end |
#render(outfile) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/magma/app.rb', line 32 def render(outfile) if [:skip_template] Renderer.call outfile, else template = Tempfile.new [File.basename(outfile), '.mlt'] begin Preparer.call [:infile], .merge(outfile: template) Templater.call template, .merge(outfile: template) Renderer.call outfile, .merge(infile: template.path) ensure template.close template.unlink end end end |
#template(infile = nil) ⇒ Object
56 57 58 |
# File 'lib/magma/app.rb', line 56 def template(infile = nil) Templater.call infile, end |
#version ⇒ Object
69 70 71 |
# File 'lib/magma/app.rb', line 69 def version puts Magma::VERSION end |