Class: Apical::CLI

Inherits:
Thor
  • Object
show all
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 options[:output_path]
               File.open(options[:output_path], 'w')
             else
               $stdout
             end


    case options[:format]
    when 'html'
      HtmlWriter.new(doc).write(output)
    else
      ConsoleWriter.new(doc).write(output)
    end
  end
end

#versionObject



6
7
8
# File 'lib/apical/cli.rb', line 6

def version
  puts Apical::VERSION
end