Skip to content

Commit

Permalink
Fix bug in PNG command and expand integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian Weber authored and Arian Weber committed Mar 19, 2024
1 parent 33528bf commit bd19438
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/pg-verify/cli/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ def png()
components = self.class.select_components(options[:only], options[:hide], model)
puml = Transform::PumlTransformation.new(render_labels: !hide_labels).transform_graph(model, only: components)
png = PlantumlBuilder::Formats::PNG.new(puml).load
out_name = File.basename(script_file, '.*')
out_name += "-" + model.name.to_s.gsub(/\W+/, '_').downcase + ".png"
out_name = model.name.to_s.gsub(/\W+/, '_').downcase + ".png"
out_path = File.expand_path(out_name, Settings.outdir)
FileUtils.mkdir_p(Settings.outdir)
File.binwrite(out_path, png)
Expand Down
2 changes: 1 addition & 1 deletion lib/pg-verify/cli/cli_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.load_models(options)
end

raise NoDefaultFileError.new(default_script_file) unless File.file?(default_script_file)
return Interpret::PgScript.new.interpret(dsl_script_file)
return Interpret::PgScript.new.interpret(default_script_file)
end

end
Expand Down
1 change: 1 addition & 0 deletions lib/pg-verify/interpret/pg_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def initialize()
end

def interpret(file, validate: true)
raise "Not a file path string: '#{file}'::#{file.class}" unless file.is_a?(String)
file = File.expand_path(file)
raise NoSuchScriptError.new(file) unless File.file?(file)
@script_file ||= file
Expand Down
2 changes: 1 addition & 1 deletion vscript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"script" => source,
"json-file" => File.join(work_dir, File.basename(source, '.rb') + ".json"),
}
commands = [ "show puml", "test", "dcca" ]
commands = [ "show puml", "test", "dcca", "show png", "simulate" ]
args.each { |argument, file|
commands.each { |command|
log "pgv #{command} #{argument} | #{File.basename(file)}"
Expand Down

0 comments on commit bd19438

Please sign in to comment.