From 1f0b6186efca21a129fe945a128526079bdceb4f Mon Sep 17 00:00:00 2001 From: Jorn van de Beek <jornvandebeek@roqua.nl> Date: Mon, 31 May 2021 12:38:03 +0200 Subject: [PATCH] Assume definitions supply keys in the dirname instead of filename --- exe/quby-compile | 5 ++--- lib/quby/compiler/instance.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exe/quby-compile b/exe/quby-compile index acadf2e..2bb438f 100755 --- a/exe/quby-compile +++ b/exe/quby-compile @@ -21,7 +21,7 @@ OptionParser.new do |opts| end opts.on("--seeds=INPUT") do |value| - seeds_path = value + puts '--seeds is a deprecated option, questionnaire definitions should use seed_patches to conserve seed tweaks' end end.parse! @@ -38,7 +38,7 @@ lookup_tables = Quby::Compiler::Entities::LookupTables.new(lookup_tables_path) paths.each do |path| puts "Compiling #{path}" - key = File.basename(path, File.extname(path)) + key = File.basename(File.dirname(path)) sourcecode = File.read(path) last_update = File.mtime(path) seed_path = File.join(seeds_path, "#{key}.yml") @@ -46,7 +46,6 @@ paths.each do |path| compiled = Quby::Compiler.compile(key, sourcecode, path: path, seeds: seeds, lookup_tables: lookup_tables, last_update: last_update) FileUtils.mkdir_p(File.join(output_path, key)) - compiled[:outputs].each do |type, output| next unless output File.open(File.join(output_path, key, output.filename), 'w') do |file| diff --git a/lib/quby/compiler/instance.rb b/lib/quby/compiler/instance.rb index 5f724c9..7bad716 100644 --- a/lib/quby/compiler/instance.rb +++ b/lib/quby/compiler/instance.rb @@ -11,7 +11,7 @@ module Quby if block # defined in block for tests questionnaire = DSL.build(key, path: path, &block) else # sourcecode given as string - tempfile = Tempfile.new(key) + tempfile = Tempfile.new([key, '.rb']) questionnaire = Entities::Questionnaire.new(key, last_update: last_update) Thread.current["quby-questionnaire-loading"] = Quby::Compiler::DSL::QuestionnaireBuilder.new(questionnaire, lookup_tables: lookup_tables) -- GitLab