quby-compiler 0.3.6 → 0.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a56013c91225af82fd15a27e8195ca88b22dcb3ea94354ab2ef62cef50532bf2
4
- data.tar.gz: 6412e7e3ef45dd548dc10eea9e2b72da4b7cc64d94d9de2a3ede13db70c5be25
3
+ metadata.gz: 9afe2a68ca9334f324a6d096918e625d432016b631794fdfe1db307acd25ebff
4
+ data.tar.gz: 87cce57c50f1509b48ef072d53dfa4f56a8880b3dc82c002dbd9c6b70a368c7b
5
5
  SHA512:
6
- metadata.gz: 67d746a71ccbd1c0780a836579000efdf50e825a10906a10992abaf3612340039e9670320814d6cb7f6baf3eb041e85c3872496e4d95a70ed4195d61632b969a
7
- data.tar.gz: 51151607042665ecbdd7f4b9448e24a220350cd132ec1e5ef509dfd71b5abca5668686de5231cfd40a27e43ecead4003e1f41ab04e01f952fae95ecc3f96a7cf
6
+ metadata.gz: 32acc8cd41565840352dc2c5b3137aca5f31422ee000424dd0b412d9ae9cadde00ff7d1eb5b92eb54b6b4ee493bd581413aee3c93fd01c2fd176fc57d7ec2e3b
7
+ data.tar.gz: 6f677f3ea56d37009e637298d58d1969761fa6793c412b42dc8068ca99bb47a185427d31beae7e29b60236ea724929e911ebafca78db2e0a2755babf9b1956bd
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
+ # 0.3.7
2
+
3
+ * Remove last_update
4
+
1
5
  # 0.3.6
2
6
 
3
7
  * `outcome_table` panel dsl method now exports the given outcome table definition to `roqua.json`
4
- This can't be used in combination with the `outcome_table: ` attibute in score schemas.
8
+ This can't be used in combination with the `outcome_table: ` attribute in score schemas.
5
9
 
6
10
  # 0.3.5
7
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quby-compiler (0.3.5)
4
+ quby-compiler (0.3.7)
5
5
  actionview (>= 5.0)
6
6
  activemodel (>= 5.0)
7
7
  activesupport (>= 5.0)
@@ -15,41 +15,42 @@ PATH
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- actionview (6.0.4)
19
- activesupport (= 6.0.4)
18
+ actionview (6.1.4)
19
+ activesupport (= 6.1.4)
20
20
  builder (~> 3.1)
21
21
  erubi (~> 1.4)
22
22
  rails-dom-testing (~> 2.0)
23
23
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- active_interaction (4.0.2)
24
+ active_interaction (4.0.6)
25
25
  activemodel (>= 5, < 7)
26
- activemodel (6.0.4)
27
- activesupport (= 6.0.4)
28
- activerecord (6.0.4)
29
- activemodel (= 6.0.4)
30
- activesupport (= 6.0.4)
31
- activesupport (6.0.4)
26
+ activesupport (>= 5, < 7)
27
+ activemodel (6.1.4)
28
+ activesupport (= 6.1.4)
29
+ activerecord (6.1.4)
30
+ activemodel (= 6.1.4)
31
+ activesupport (= 6.1.4)
32
+ activesupport (6.1.4)
32
33
  concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (>= 0.7, < 2)
34
- minitest (~> 5.1)
35
- tzinfo (~> 1.1)
36
- zeitwerk (~> 2.2, >= 2.2.2)
37
- appsignal (3.0.8)
34
+ i18n (>= 1.6, < 2)
35
+ minitest (>= 5.1)
36
+ tzinfo (~> 2.0)
37
+ zeitwerk (~> 2.3)
38
+ appsignal (3.0.15)
38
39
  rack
39
40
  builder (3.2.4)
40
41
  coderay (1.1.3)
41
42
  concurrent-ruby (1.1.9)
42
43
  crass (1.0.6)
43
44
  diff-lcs (1.4.4)
44
- dry-configurable (0.12.1)
45
+ dry-configurable (0.13.0)
45
46
  concurrent-ruby (~> 1.0)
46
- dry-core (~> 0.5, >= 0.5.0)
47
- dry-container (0.8.0)
47
+ dry-core (~> 0.6)
48
+ dry-container (0.9.0)
48
49
  concurrent-ruby (~> 1.0)
49
- dry-configurable (~> 0.1, >= 0.1.3)
50
- dry-core (0.6.0)
50
+ dry-configurable (~> 0.13, >= 0.13.0)
51
+ dry-core (0.7.1)
51
52
  concurrent-ruby (~> 1.0)
52
- dry-inflector (0.2.0)
53
+ dry-inflector (0.2.1)
53
54
  dry-logic (1.2.0)
54
55
  concurrent-ruby (~> 1.0)
55
56
  dry-core (~> 0.5, >= 0.5)
@@ -67,31 +68,31 @@ GEM
67
68
  i18n (1.8.10)
68
69
  concurrent-ruby (~> 1.0)
69
70
  ice_nine (0.11.2)
70
- loofah (2.10.0)
71
+ loofah (2.12.0)
71
72
  crass (~> 1.0.2)
72
73
  nokogiri (>= 1.5.9)
73
74
  method_source (1.0.0)
74
- mini_portile2 (2.5.3)
75
+ mini_portile2 (2.6.1)
75
76
  minitest (5.14.4)
76
77
  naught (1.1.0)
77
- nokogiri (1.11.7)
78
- mini_portile2 (~> 2.5.0)
78
+ nokogiri (1.12.5)
79
+ mini_portile2 (~> 2.6.1)
79
80
  racc (~> 1.4)
80
81
  nokogumbo (2.0.5)
81
82
  nokogiri (~> 1.8, >= 1.8.4)
82
83
  pry (0.13.1)
83
84
  coderay (~> 1.1)
84
85
  method_source (~> 1.0)
85
- racc (1.5.2)
86
+ racc (1.6.0)
86
87
  rack (2.2.3)
87
88
  rails-dom-testing (2.0.3)
88
89
  activesupport (>= 4.2.0)
89
90
  nokogiri (>= 1.6)
90
- rails-html-sanitizer (1.3.0)
91
+ rails-html-sanitizer (1.4.2)
91
92
  loofah (~> 2.3)
92
93
  rake (12.3.3)
93
94
  redcarpet (3.5.1)
94
- roqua-support (0.4.0)
95
+ roqua-support (0.4.1)
95
96
  active_interaction (>= 3.0, < 5.0)
96
97
  activesupport (>= 5.2, < 6.2)
97
98
  appsignal (>= 2.9, < 3.1)
@@ -110,12 +111,11 @@ GEM
110
111
  diff-lcs (>= 1.2.0, < 2.0)
111
112
  rspec-support (~> 3.9.0)
112
113
  rspec-support (3.9.3)
113
- thread_safe (0.3.6)
114
- tzinfo (1.2.9)
115
- thread_safe (~> 0.1)
114
+ tzinfo (2.0.4)
115
+ concurrent-ruby (~> 1.0)
116
116
  with_advisory_lock (3.2.0)
117
117
  activerecord (>= 3.2)
118
- zeitwerk (2.4.2)
118
+ zeitwerk (2.5.1)
119
119
 
120
120
  PLATFORMS
121
121
  ruby
@@ -127,4 +127,4 @@ DEPENDENCIES
127
127
  rspec (~> 3.0)
128
128
 
129
129
  BUNDLED WITH
130
- 2.1.4
130
+ 2.2.15
data/exe/quby-compile CHANGED
@@ -8,7 +8,6 @@ require "quby/compiler"
8
8
 
9
9
  output_path = "output"
10
10
  lookup_tables_path = "lookup_tables"
11
- seeds_path = "seeds"
12
11
 
13
12
  OptionParser.new do |opts|
14
13
  opts.banner = "Usage: quby-compile FILE_OR_DIRS [options]"
@@ -19,10 +18,6 @@ OptionParser.new do |opts|
19
18
  opts.on("--lookup-tables=INPUT") do |value|
20
19
  lookup_tables_path = value
21
20
  end
22
-
23
- opts.on("--seeds=INPUT") do |value|
24
- puts '--seeds is a deprecated option, questionnaire definitions should use seed_patches to conserve seed tweaks'
25
- end
26
21
  end.parse!
27
22
 
28
23
  paths = ARGV.flat_map do |file_or_dir|
@@ -40,10 +35,7 @@ paths.each do |path|
40
35
 
41
36
  key = File.basename(File.dirname(path))
42
37
  sourcecode = File.read(path)
43
- last_update = File.mtime(path)
44
- seed_path = File.join(seeds_path, "#{key}.yml")
45
- seeds = File.exist?(seed_path) ? YAML.load(File.read(seed_path)) : nil
46
- compiled = Quby::Compiler.compile(key, sourcecode, path: path, seeds: seeds, lookup_tables: lookup_tables, last_update: last_update)
38
+ compiled = Quby::Compiler.compile(key, sourcecode, path: path, lookup_tables: lookup_tables)
47
39
 
48
40
  FileUtils.mkdir_p(File.join(output_path, key))
49
41
  compiled[:outputs].each do |type, output|
@@ -9,15 +9,15 @@ module Quby
9
9
  module Compiler
10
10
  module DSL
11
11
  def self.build_from_definition(definition)
12
- Entities::Questionnaire.new(definition.key, last_update: definition.timestamp).tap do |questionnaire|
12
+ Entities::Questionnaire.new(definition.key).tap do |questionnaire|
13
13
  builder = QuestionnaireBuilder.new(questionnaire, lookup_tables: definition.lookup_tables)
14
14
  builder.instance_eval(definition.sourcecode, definition.path) if definition.sourcecode
15
15
  questionnaire.callback_after_dsl_enhance_on_questions
16
16
  end
17
17
  end
18
18
 
19
- def self.build(key, sourcecode = nil, path: nil, timestamp: nil, lookup_tables: {}, &block)
20
- Entities::Questionnaire.new(key, last_update: timestamp).tap do |questionnaire|
19
+ def self.build(key, sourcecode = nil, path: nil, lookup_tables: {}, &block)
20
+ Entities::Questionnaire.new(key).tap do |questionnaire|
21
21
  builder = QuestionnaireBuilder.new(questionnaire, lookup_tables: lookup_tables)
22
22
  builder.instance_eval(sourcecode, path || key) if sourcecode
23
23
  builder.instance_eval(&block) if block
@@ -29,10 +29,9 @@ module Quby
29
29
 
30
30
  RESPONDENT_TYPES = %i( profess patient parent second_parent teacher caregiver )
31
31
 
32
- def initialize(key, last_update: Time.now)
32
+ def initialize(key)
33
33
  @key = key
34
34
  @sbg_domains = []
35
- @last_update = Time.at(last_update.to_i)
36
35
  @score_calculations = {}.with_indifferent_access
37
36
  @charts = Charting::Charts.new
38
37
  @fields = Fields.new(self)
@@ -92,7 +91,6 @@ module Quby
92
91
 
93
92
  attr_accessor :last_author
94
93
  attr_accessor :allow_hotkeys # allow hotkeys for :all views, just :bulk views (default), or :none for never
95
- attr_accessor :last_update
96
94
 
97
95
  attr_accessor :charts
98
96
 
@@ -7,12 +7,12 @@ module Quby
7
7
  @lookup_tables = lookup_tables
8
8
  end
9
9
 
10
- def compile(key:, sourcecode:, seeds:, path: nil, last_update: nil, &block)
10
+ def compile(key:, sourcecode:, path: nil, &block)
11
11
  if block # defined in block for tests
12
12
  questionnaire = DSL.build(key, path: path, &block)
13
13
  else # sourcecode given as string
14
14
  tempfile = Tempfile.new([key, '.rb'])
15
- questionnaire = Entities::Questionnaire.new(key, last_update: last_update)
15
+ questionnaire = Entities::Questionnaire.new(key)
16
16
  Thread.current["quby-questionnaire-loading"] = Quby::Compiler::DSL::QuestionnaireBuilder.new(questionnaire, lookup_tables: lookup_tables)
17
17
 
18
18
  tempfile.puts "Thread.current['quby-questionnaire-loading'].instance_eval do"
@@ -41,7 +41,7 @@ module Quby
41
41
  seeds: Output.new(
42
42
  key: :seeds,
43
43
  filename: "seeds.yml",
44
- content: YAML.dump(Outputs::SeedSerializer.new(questionnaire, seeds).generate),
44
+ content: YAML.dump(Outputs::SeedSerializer.new(questionnaire).generate),
45
45
  ),
46
46
  quby_frontend_v1: Output.new(
47
47
  key: :quby_frontend_v1,
@@ -322,7 +322,6 @@ module Quby
322
322
  licensor: questionnaire.licensor,
323
323
  language: questionnaire.language,
324
324
  renderer_version: questionnaire.renderer_version,
325
- last_update: questionnaire.last_update,
326
325
  last_author: questionnaire.last_author,
327
326
  extra_css: questionnaire.extra_css,
328
327
  allow_switch_to_bulk: questionnaire.allow_switch_to_bulk,
@@ -7,23 +7,19 @@ module Quby
7
7
  attr_reader :questionnaire
8
8
  attr_reader :seeds
9
9
 
10
- def initialize(questionnaire, seeds)
10
+ def initialize(questionnaire)
11
11
  @questionnaire = questionnaire
12
12
  @seeds = seeds || []
13
13
  end
14
14
 
15
15
  def generate
16
- roqua_keys = seeds.present? ? seeds.map { |seed| seed["key"] } : questionnaire.roqua_keys
17
-
18
- roqua_keys.map do |roqua_key|
19
- seed = seeds.find { |seed| seed["key"] == roqua_key } || {}
20
-
16
+ questionnaire.roqua_keys.map do |roqua_key|
21
17
  new_seed = Services::QubyProxy.new(
22
18
  questionnaire,
23
19
  quby_key: questionnaire.key,
24
20
  roqua_key: roqua_key,
25
21
  skip_score_keys_consistency_check: true
26
- ).generate(seed)
22
+ ).generate
27
23
 
28
24
  Services::SeedDiff.new.apply_patch(new_seed, questionnaire.seeds_patch[roqua_key])
29
25
  end
@@ -15,8 +15,8 @@ module Quby
15
15
 
16
16
  def validate(definition)
17
17
  questionnaire = DSL.build_from_definition(definition)
18
+ validate_metadata(questionnaire)
18
19
  validate_fields(questionnaire)
19
- validate_title(questionnaire)
20
20
  validate_questions(questionnaire)
21
21
  validate_scores(questionnaire)
22
22
  validate_table_edgecases(questionnaire)
@@ -32,6 +32,20 @@ module Quby
32
32
  backtrace: exception.backtrace[0..20]})
33
33
  end
34
34
 
35
+ def validate_metadata(questionnaire)
36
+ if questionnaire.title.blank?
37
+ fail "Questionnaire title is missing."
38
+ end
39
+
40
+ if questionnaire.short_description && questionnaire.short_description.size > 255
41
+ fail "Questionnaire short_description is too long."
42
+ end
43
+
44
+ if questionnaire.description && questionnaire.description.size > 255
45
+ fail "Questionnaire description is too long."
46
+ end
47
+ end
48
+
35
49
  def validate_fields(questionnaire)
36
50
  questionnaire.fields.input_keys
37
51
  .find { |k| !k.is_a?(Symbol) }
@@ -41,12 +55,6 @@ module Quby
41
55
  &.tap { |k| fail "Answer key #{k} is not a symbol" }
42
56
  end
43
57
 
44
- def validate_title(questionnaire)
45
- if questionnaire.title.blank?
46
- fail "Questionnaire title is missing."
47
- end
48
- end
49
-
50
58
  def validate_questions(questionnaire)
51
59
  questionnaire.answer_keys.each do |key|
52
60
  validate_key_format(key)
@@ -22,7 +22,8 @@ module Quby
22
22
  @options = options
23
23
  end
24
24
 
25
- def generate(seed)
25
+ def generate
26
+ seed = {}
26
27
  question_titles = generate_question_titles
27
28
  d_qtypes = {}
28
29
  vars = []
@@ -1,5 +1,5 @@
1
1
  module Quby
2
2
  module Compiler
3
- VERSION = "0.3.6"
3
+ VERSION = "0.3.7"
4
4
  end
5
5
  end
data/lib/quby/compiler.rb CHANGED
@@ -29,13 +29,11 @@ require 'quby/compiler/outputs'
29
29
 
30
30
  module Quby
31
31
  module Compiler
32
- def self.compile(key, sourcecode, path: nil, seeds:, lookup_tables:, last_update: nil, &block)
32
+ def self.compile(key, sourcecode, path: nil, lookup_tables:, &block)
33
33
  Quby::Compiler::Instance.new(lookup_tables: lookup_tables).compile(
34
34
  key: key,
35
35
  sourcecode: sourcecode,
36
36
  path: path,
37
- seeds: seeds,
38
- last_update: last_update,
39
37
  &block
40
38
  )
41
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quby-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-19 00:00:00.000000000 Z
11
+ date: 2021-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -136,7 +136,7 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- description:
139
+ description:
140
140
  email:
141
141
  - marten@veldthuis.com
142
142
  executables:
@@ -256,7 +256,7 @@ licenses:
256
256
  - MIT
257
257
  metadata:
258
258
  homepage_uri: https://gitlab.roqua.nl/roqua/quby-compiler
259
- post_install_message:
259
+ post_install_message:
260
260
  rdoc_options: []
261
261
  require_paths:
262
262
  - lib
@@ -271,8 +271,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
- rubygems_version: 3.1.4
275
- signing_key:
274
+ rubygems_version: 3.2.15
275
+ signing_key:
276
276
  specification_version: 4
277
277
  summary: Quby::Compiler compiles a DSL for questionnaires to JSON
278
278
  test_files: []