From 25a53b2c83e864db99f6b2283dbf7e21e3a8b464 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Wed, 18 Sep 2024 08:11:58 -0700 Subject: [PATCH] Fix bug determining version in ext_pdf_doc backend Signed-off-by: Derek Hower --- backends/ext_pdf_doc/tasks.rake | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backends/ext_pdf_doc/tasks.rake b/backends/ext_pdf_doc/tasks.rake index 8cdcde5f0..723975da6 100644 --- a/backends/ext_pdf_doc/tasks.rake +++ b/backends/ext_pdf_doc/tasks.rake @@ -120,7 +120,12 @@ rule %r{#{$root}/gen/ext_pdf_doc/.*/adoc/.*_extension\.adoc} => proc { |tname| erb.filename = template_path.to_s ext = arch_def.extension(ext_name) - version_num = ENV.key?("EXT_VERSION") ? ENV["EXT_VERSION"] : ext.versions.sort { |v| Gem::Version.new(v["version"]) }.last["version"] + version_num = + if ENV.key?("EXT_VERSION") + ENV["EXT_VERSION"] + else + ext.versions.max { |a, b| Gem::Version.new(a["version"]) <=> Gem::Version.new(b["version"]) }["version"] + end ext_version = ext.versions.find { |v| v["version"] == version_num } FileUtils.mkdir_p File.dirname(t.name) File.write t.name, AsciidocUtils.resolve_links(arch_def.find_replace_links(erb.result(binding)))