Skip to content
Snippets Groups Projects
Commit 1f0b6186 authored by Jorn van de Beek's avatar Jorn van de Beek
Browse files

Assume definitions supply keys in the dirname instead of filename

parent ffef01d3
No related branches found
No related tags found
1 merge request!17CLI: Assume definitions supply keys in the dirname instead of filename
Pipeline #85347 passed
......@@ -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|
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment