Skip to content

Commit

Permalink
Merge pull request #1760 from kmuto/system-plantuml
Browse files Browse the repository at this point in the history
find plantuml from system folder also
  • Loading branch information
kmuto authored Oct 27, 2021
2 parents 29941d5 + f903d1d commit 172533e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/format.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` フォルダにあること

##

Expand Down
2 changes: 1 addition & 1 deletion doc/format.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 11 additions & 1 deletion lib/review/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 172533e

Please sign in to comment.