Class: PythonUmlClass

Inherits:
AppMainBase show all
Defined in:
lib/python_uml_class.rb

Overview

require “create_uml_class.rb”

Instance Method Summary collapse

Methods inherited from AppMainBase

#add_history, #app_send, #initialize, #resume, #set_config, #set_ws, #suspend

Constructor Details

This class inherits a constructor from AppMainBase

Instance Method Details

#start(argv) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/python_uml_class.rb', line 7

def start(argv)
  super
  begin
    @abort = false
    puts argv
    in_dir = argv[0]
    out_file = argv[1]

    # 履歴の保存
    add_history("history.json", in_dir)
    add_history("out_history.json", out_file)

    # Browserにメッセージ送信
    #app_send("popup:start app #{argv[0]}")

    out_svg = out_file.gsub(File.extname(out_file), "") + ".svg"

    # uml作成
    load "create_uml_class.rb"

    uml = create_uml_class(in_dir, out_file)

    File.open(out_file, "w") do |f|
      f.puts uml
    end

    # PlantUMLの実行
    FileUtils.rm_f out_svg
    cmd = "#{@config["plantuml"]} #{out_file}"
    puts cmd
    system cmd
    if File.exist? out_svg
      yield File.read out_svg
    else
      yield "exec error"
      yield cmd
    end
  rescue
    puts $!
    puts $@
    yield $!.to_s.toutf8
    yield $@.to_s.toutf8
  end
end

#stopObject



52
53
54
# File 'lib/python_uml_class.rb', line 52

def stop()
  super
end