Class: Gisele::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/gisele/command.rb

Overview

Gisele - A Process Analyzer Toolset

SYNOPSIS

gisele [--version] [--help]
gisele [--ast | --graph] PROCESS_FILE

OPTIONS #summarized_options

DESCRIPTION

The Gisele process analyzer toolset provides tools and technique to model and analyze
complex process models such as care processes.

When --no-sugar is specified, syntactic sugar is first removed before making any other
transformation. For now, this rewrites all `if` statements as explicit `case` guarded
commands.

When --ast is used, the command parses the process file and prints its Abstract Syntax
Tree (AST) on standard output. By default, this option prints the AST for manual
debugging, that is with colors and extra information. Use --ast=ruby to get a ruby
array for automatic processing.

When --graph is used, the command parses the process file. It then converts the AST into
a directed graph representing the process as a box-and-arrow workflow and outputs it on
standard output. For now, the only output format available is dot (from graphviz).

Instance Method Summary collapse

Instance Method Details

#execute(args) ⇒ Object

Raises:

  • (Quickl::Help)


74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/gisele/command.rb', line 74

def execute(args)
  raise Quickl::Help unless args.size == 1

  unless (file = Path(args.first)).exist?
    raise Quickl::IOAccessError, "File does not exists: #{file}"
  end

  ast = Gisele.ast(file)
  ast = Language::SugarRemoval.call(ast) unless @sugar

  send :"compile_#{@compile_mode.first}", ast, *@compile_mode[1..-1]
end