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
- #config ⇒ Object
- #prepare(infile = nil) ⇒ Object
- #reify(data_file) ⇒ Object
- #render(outfile) ⇒ Object
- #template(infile = nil) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
19 20 21 |
# File 'lib/magma/app.rb', line 19 def exit_on_failure? true end |
Instance Method Details
#config ⇒ Object
26 27 28 29 30 |
# File 'lib/magma/app.rb', line 26 def config config = CONFIG.merge() File.open(CONFIG_FILE, 'w') { |f| f.write config.to_yaml } puts config.to_yaml end |
#prepare(infile = nil) ⇒ Object
83 84 85 |
# File 'lib/magma/app.rb', line 83 def prepare(infile = nil) Preparer.call infile, end |
#reify(data_file) ⇒ Object
33 34 35 |
# File 'lib/magma/app.rb', line 33 def reify(data_file) Reifier.call data_file, end |
#render(outfile) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/magma/app.rb', line 50 def render(outfile) if [:skip_template] Renderer.call outfile, else template = Tempfile.new [File.basename(outfile), '.mlt'] begin Reifier.call([:data_file]) if [:data_file] 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 |