forked from amckinnell/umlgraph_tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile
26 lines (20 loc) · 866 Bytes
/
rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require_relative "src/uml_creator"
desc "Clean the /out and /temp directories"
task :clean do
Dir.glob("out/*").each { |file| File.delete(file) }
Dir.glob("temp/*").each { |file| File.delete(file) }
end
desc "Generate a diagram for each template"
task :default do
Dir.glob("templates/*.yml").sort.each { |template| generate_diagram(template) }
end
desc "Generate a diagram for each template matching the template pattern"
task :generate, [:template_pattern] do |_, args|
Dir.glob("templates/*#{args.template_pattern}*.yml").sort.each { |template| generate_diagram(template) }
end
def generate_diagram(template)
basename = File.basename(template, File.extname(template))
dot_file = "temp/#{basename}.java"
UmlCreator.new(template_filename: template, output_filename: dot_file).create
system("./umlgraph #{dot_file} out/#{basename}.png png")
end