Class: Faml::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/faml/cli.rb

Instance Method Summary collapse

Instance Method Details

#compile(file) ⇒ Object



17
18
19
# File 'lib/faml/cli.rb', line 17

def compile(file)
  puts compile_file(file, format: options[:format].to_sym)
end

#render(file) ⇒ Object



10
11
12
13
# File 'lib/faml/cli.rb', line 10

def render(file)
  code = compile_file(file, format: options[:format].to_sym)
  puts instance_eval(code, file)
end

#stats(*paths) ⇒ Object



29
30
31
32
# File 'lib/faml/cli.rb', line 29

def stats(*paths)
  require_relative 'stats'
  Stats.new(*paths).report
end

#temple(file) ⇒ Object



23
24
25
26
# File 'lib/faml/cli.rb', line 23

def temple(file)
  require 'pp'
  pp Faml::Compiler.new(filename: file, format: options[:format].to_sym).call(parse_file(file))
end

#versionObject



36
37
38
39
40
41
42
# File 'lib/faml/cli.rb', line 36

def version
  if options[:numeric]
    puts VERSION
  else
    puts "faml #{VERSION}"
  end
end