From f903d1d52a42267524aa96614f87d7ea148644e0 Mon Sep 17 00:00:00 2001 From: Kenshi Muto Date: Wed, 27 Oct 2021 15:53:56 +0900 Subject: [PATCH] find plantuml from system folder also --- doc/format.ja.md | 2 +- doc/format.md | 2 +- lib/review/builder.rb | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/doc/format.ja.md b/doc/format.ja.md index e228c433f..ba2db61f2 100644 --- a/doc/format.ja.md +++ b/doc/format.ja.md @@ -396,7 +396,7 @@ plot sin(x) * Gnuplot ( http://www.gnuplot.info/ ) : `gnuplot` コマンドへのパスを OS に設定すること * Blockdiag ( http://blockdiag.com/ ) : `blockdiag` コマンドへのパスを OS に設定すること。PDF を生成する場合は ReportLab もインストールすること * aafigure ( https://launchpad.net/aafigure ) : `aafigure` コマンドへのパスを OS に設定すること -* PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダにあること +* PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダ、または `/usr/share/plantuml` あるいは `/usr/share/java` フォルダにあること ## 表 diff --git a/doc/format.md b/doc/format.md index 816460e30..eeda444c8 100644 --- a/doc/format.md +++ b/doc/format.md @@ -423,7 +423,7 @@ Before using these tools, you should installed them and configured path appropri * Gnuplot ( http://www.gnuplot.info/ ) : set path to `gnuplot` command * Blockdiag ( http://blockdiag.com/ ) : set path to `blockdiag` command. Install ReportLab also to make a PDF * aafigure ( https://launchpad.net/aafigure ) : set path to `aafigure` command -* PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder +* PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder, `/usr/share/plantuml` or `/usr/share/java`. ## Tables diff --git a/lib/review/builder.rb b/lib/review/builder.rb index 8aec855ff..69f7bea3b 100644 --- a/lib/review/builder.rb +++ b/lib/review/builder.rb @@ -669,7 +669,17 @@ def graph_plantuml(id, file_path, _line, tf_path) ext = 'eps' file_path.sub!(/\.pdf\Z/, '.eps') end - system_graph(id, 'java', '-jar', 'plantuml.jar', "-t#{ext}", '-charset', 'UTF-8', tf_path) + plant_path = nil + if File.exist?('plantuml.jar') + plant_path = 'plantuml.jar' + elsif File.exist?('/usr/share/plantuml/plantuml.jar') + plant_path = '/usr/share/plantuml/plantuml.jar' + elsif File.exist?('/usr/share/java/plantuml.jar') + plant_path = '/usr/share/java/plantuml.jar' + else + error!('missing plantuml.jar. Please put plantuml.jar at the working folder.') + end + system_graph(id, 'java', '-jar', plant_path, "-t#{ext}", '-charset', 'UTF-8', tf_path) FileUtils.mv("#{tf_path}.#{ext}", file_path) file_path end