Class: Apical::CLI
- Inherits:
-
Thor
- Object
- Thor
- Apical::CLI
- Defined in:
- lib/apical/cli.rb
Instance Method Summary collapse
Instance Method Details
#compile(*files) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/apical/cli.rb', line 13 def compile(*files) files.each do |file| $:.unshift File.dirname(file) block = eval("Proc.new { #{File.read(file)} }") doc = Apical.new(&block) output = if [:output_path] File.open([:output_path], 'w') else $stdout end case [:format] when 'html' HtmlWriter.new(doc).write(output) else ConsoleWriter.new(doc).write(output) end end end |