Class: Picatrix::CLI

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

Instance Method Summary collapse

Instance Method Details

#g(dot_file_name, app_name = nil) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/picatrix.rb', line 28

def g(dot_file_name, app_name = nil)
  app_name = File.basename(dot_file_name, ".dot") if app_name.nil?

  puts "using: #{dot_file_name}"
  puts "output: #{app_name}"

  Jenny.new(
    Pacman.new(
      dot_file_name
    ),
    options,
    app_name
  ).just_do_it
end

#prep(dot_file_name, app_name = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/picatrix.rb', line 44

def prep(dot_file_name, app_name = nil)
  app_name = File.basename(dot_file_name, ".dot") if app_name.nil?

  GraphViz.parse(dot_file_name, :path => "/usr/local/bin").
    output(:png => "#{dot_file_name}.png")
  puts "output to #{dot_file_name}.png"

  Buffy.new(
    Pacman.new(
      dot_file_name
    ),
    options,
    app_name
  ).slay

  puts "output to generated/"
  puts "You will need to edit your #{app_name}.proto file to match your schema." +
    " Then you can run `picapica g <app_name>` to generate your application."
end