Class: Faml::CLI

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

Instance Method Summary collapse

Instance Method Details

#compile(file) ⇒ Object



20
21
22
# File 'lib/faml/cli.rb', line 20

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

#render(file) ⇒ Object



12
13
14
15
# File 'lib/faml/cli.rb', line 12

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

#stats(*paths) ⇒ Object



33
34
35
36
# File 'lib/faml/cli.rb', line 33

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

#temple(file) ⇒ Object



27
28
29
30
# File 'lib/faml/cli.rb', line 27

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

#versionObject



40
41
42
43
44
45
46
# File 'lib/faml/cli.rb', line 40

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