ruql 0.1.3 → 1.0.3
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 +5 -5
- data/.gitignore +14 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/LICENSE +6 -0
- data/README.md +308 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/ruql +88 -98
- data/bin/setup +8 -0
- data/examples/estilo.css +1 -0
- data/examples/example.rb +37 -0
- data/examples/file.html +94 -0
- data/examples/help.txt +55 -0
- data/examples/preguntas-TFG-20140224-0050.txt +32 -0
- data/examples/preguntas-TFG-20140224-0050.xml +168 -0
- data/examples/prueba.js +3 -0
- data/lib/ruql.rb +7 -3
- data/lib/ruql/answer.rb +2 -14
- data/lib/ruql/multiple_choice.rb +1 -1
- data/lib/ruql/open_assessment/open_assessment.rb +1 -1
- data/lib/ruql/question.rb +11 -46
- data/lib/ruql/quiz.rb +47 -36
- data/lib/ruql/renderers/edxml_renderer.rb +1 -1
- data/lib/ruql/renderers/html5_renderer.rb +58 -16
- data/lib/ruql/renderers/json_renderer.rb +35 -1
- data/lib/ruql/renderers/xml_renderer.rb +148 -0
- data/lib/ruql/select_multiple.rb +1 -0
- data/lib/ruql/stats.rb +18 -0
- data/lib/ruql/true_false.rb +1 -1
- data/lib/ruql/version.rb +3 -0
- data/ruql.gemspec +43 -0
- metadata +57 -39
- data/templates/autoqcm.tex.erb +0 -1
- data/templates/html5.html.erb +0 -42
- data/templates/htmlform.html.erb +0 -44
data/lib/ruql/select_multiple.rb
CHANGED
data/lib/ruql/stats.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Ruql
|
2
|
+
class Stats
|
3
|
+
attr_reader :output, :quiz
|
4
|
+
# a pseudo-renderer that just prints stats about the quiz
|
5
|
+
def initialize(quiz, options={})
|
6
|
+
@quiz = quiz
|
7
|
+
@output = []
|
8
|
+
end
|
9
|
+
def render_quiz
|
10
|
+
@output << "%3d questions" % quiz.questions.length
|
11
|
+
@output << " %3d (%d points) in no group" % [quiz.ungrouped_questions.length, quiz.ungrouped_points]
|
12
|
+
@output << " %3d (%d points) in %d groups" % [quiz.grouped_questions.length, quiz.grouped_points, quiz.groups.length]
|
13
|
+
@output << "%3d effective questions on quiz" % quiz.num_questions
|
14
|
+
@output << "%3d max points possible" % quiz.points
|
15
|
+
@output.join("\n")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/ruql/true_false.rb
CHANGED
data/lib/ruql/version.rb
ADDED
data/ruql.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'ruql/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'ruql'
|
8
|
+
s.version = Ruql::VERSION
|
9
|
+
s.summary = "Ruby question language"
|
10
|
+
s.description = "Ruby-embedded DSL for creating short-answer quiz questions"
|
11
|
+
s.authors = ["Armando Fox"]
|
12
|
+
s.email = 'fox@berkeley.edu'
|
13
|
+
s.homepage = 'http://github.com/saasbook/ruql'
|
14
|
+
s.license = 'CC By-SA'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if s.respond_to?(:metadata)
|
19
|
+
s.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
|
21
|
+
s.metadata["homepage_uri"] = s.homepage
|
22
|
+
s.metadata["source_code_uri"] = s.homepage
|
23
|
+
#s.metadata["changelog_uri"] = ''
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
|
+
end
|
33
|
+
|
34
|
+
s.executables << 'ruql'
|
35
|
+
|
36
|
+
s.require_paths= ['lib']
|
37
|
+
|
38
|
+
s.add_development_dependency "bundler", "~> 1.17"
|
39
|
+
s.add_development_dependency "rake", "~> 10.0"
|
40
|
+
s.add_development_dependency "byebug"
|
41
|
+
s.add_development_dependency "rspec", "~> 3.0"
|
42
|
+
s.add_development_dependency "rspec_its"
|
43
|
+
end
|
metadata
CHANGED
@@ -1,93 +1,108 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armando Fox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
14
15
|
requirement: !ruby/object:Gem::Requirement
|
15
16
|
requirements:
|
16
|
-
- -
|
17
|
+
- - "~>"
|
17
18
|
- !ruby/object:Gem::Version
|
18
|
-
version: '
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
19
21
|
prerelease: false
|
20
|
-
name: builder
|
21
22
|
version_requirements: !ruby/object:Gem::Requirement
|
22
23
|
requirements:
|
23
|
-
- -
|
24
|
+
- - "~>"
|
24
25
|
- !ruby/object:Gem::Version
|
25
|
-
version: '
|
26
|
-
type: :runtime
|
26
|
+
version: '1.17'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
28
29
|
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
33
35
|
prerelease: false
|
34
|
-
name: getopt
|
35
36
|
version_requirements: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
|
-
- -
|
38
|
+
- - "~>"
|
38
39
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
type: :runtime
|
40
|
+
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: byebug
|
42
43
|
requirement: !ruby/object:Gem::Requirement
|
43
44
|
requirements:
|
44
|
-
- -
|
45
|
+
- - ">="
|
45
46
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
47
49
|
prerelease: false
|
48
|
-
name: rspec
|
49
50
|
version_requirements: !ruby/object:Gem::Requirement
|
50
51
|
requirements:
|
51
|
-
- -
|
52
|
+
- - ">="
|
52
53
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
54
|
-
type: :development
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
56
57
|
requirement: !ruby/object:Gem::Requirement
|
57
58
|
requirements:
|
58
|
-
- - ~>
|
59
|
+
- - "~>"
|
59
60
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
61
63
|
prerelease: false
|
62
|
-
name: activesupport
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
64
65
|
requirements:
|
65
|
-
- - ~>
|
66
|
+
- - "~>"
|
66
67
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
type: :development
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec_its
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
71
72
|
requirements:
|
72
|
-
- -
|
73
|
+
- - ">="
|
73
74
|
- !ruby/object:Gem::Version
|
74
75
|
version: '0'
|
76
|
+
type: :development
|
75
77
|
prerelease: false
|
76
|
-
name: byebug
|
77
78
|
version_requirements: !ruby/object:Gem::Requirement
|
78
79
|
requirements:
|
79
|
-
- -
|
80
|
+
- - ">="
|
80
81
|
- !ruby/object:Gem::Version
|
81
82
|
version: '0'
|
82
|
-
type: :development
|
83
83
|
description: Ruby-embedded DSL for creating short-answer quiz questions
|
84
|
-
email: fox@
|
84
|
+
email: fox@berkeley.edu
|
85
85
|
executables:
|
86
86
|
- ruql
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
90
97
|
- bin/ruql
|
98
|
+
- bin/setup
|
99
|
+
- examples/estilo.css
|
100
|
+
- examples/example.rb
|
101
|
+
- examples/file.html
|
102
|
+
- examples/help.txt
|
103
|
+
- examples/preguntas-TFG-20140224-0050.txt
|
104
|
+
- examples/preguntas-TFG-20140224-0050.xml
|
105
|
+
- examples/prueba.js
|
91
106
|
- lib/ruql.rb
|
92
107
|
- lib/ruql/answer.rb
|
93
108
|
- lib/ruql/dropdown.rb
|
@@ -107,33 +122,36 @@ files:
|
|
107
122
|
- lib/ruql/renderers/html_form_renderer.rb
|
108
123
|
- lib/ruql/renderers/json_renderer.rb
|
109
124
|
- lib/ruql/renderers/qualtrics_renderer.rb
|
125
|
+
- lib/ruql/renderers/xml_renderer.rb
|
110
126
|
- lib/ruql/select_multiple.rb
|
127
|
+
- lib/ruql/stats.rb
|
111
128
|
- lib/ruql/tex_output.rb
|
112
129
|
- lib/ruql/true_false.rb
|
113
|
-
-
|
114
|
-
-
|
115
|
-
- templates/htmlform.html.erb
|
130
|
+
- lib/ruql/version.rb
|
131
|
+
- ruql.gemspec
|
116
132
|
homepage: http://github.com/saasbook/ruql
|
117
133
|
licenses:
|
118
134
|
- CC By-SA
|
119
|
-
metadata:
|
135
|
+
metadata:
|
136
|
+
allowed_push_host: https://rubygems.org
|
137
|
+
homepage_uri: http://github.com/saasbook/ruql
|
138
|
+
source_code_uri: http://github.com/saasbook/ruql
|
120
139
|
post_install_message:
|
121
140
|
rdoc_options: []
|
122
141
|
require_paths:
|
123
142
|
- lib
|
124
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
144
|
requirements:
|
126
|
-
- -
|
145
|
+
- - ">="
|
127
146
|
- !ruby/object:Gem::Version
|
128
147
|
version: '0'
|
129
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
149
|
requirements:
|
131
|
-
- -
|
150
|
+
- - ">="
|
132
151
|
- !ruby/object:Gem::Version
|
133
152
|
version: '0'
|
134
153
|
requirements: []
|
135
|
-
|
136
|
-
rubygems_version: 2.2.5
|
154
|
+
rubygems_version: 3.0.8
|
137
155
|
signing_key:
|
138
156
|
specification_version: 4
|
139
157
|
summary: Ruby question language
|
data/templates/autoqcm.tex.erb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|
data/templates/html5.html.erb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title><%= quiz.title %></title>
|
4
|
-
<style type="text/css" media="all">
|
5
|
-
body { font-family: Times, serif; }
|
6
|
-
.header { text-align: right; font-weight: bold; padding-right: 30%; line-height: 300%; }
|
7
|
-
h1 { text-align: center; }
|
8
|
-
ol.questions { list-style-type: number; }
|
9
|
-
li.question { page-break-inside: avoid; border-bottom: 1px solid grey; }
|
10
|
-
li.multiplechoice ol.answers { list-style-type: lower-alpha; }
|
11
|
-
li.selectmultiple ol.answers { vertical-align: center; list-style-type: none; list-style-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAQMAAAC3R49OAAAABlBMVEUAAAD///+l2Z/dAAAAEklEQVQImWNgAIL6/w+ogoEAAKI4Kp2NVIeDAAAAAElFTkSuQmCC'); }
|
12
|
-
li.truefalse ol.answers { list-style-type: none; }
|
13
|
-
.correct { color: green; font-weight: bold; border: 1px solid black; padding: 0.2ex; }
|
14
|
-
.incorrect { color: red }
|
15
|
-
.explanation { font-style: italic }
|
16
|
-
.instructions { clear: both; border: 1px solid black; align: center; padding: 2ex; margin: 2ex; }
|
17
|
-
</style>
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<div class="header">
|
21
|
-
<div id="name">Name:</div>
|
22
|
-
<div id="sid">SID:</div>
|
23
|
-
</div>
|
24
|
-
<h1><%= quiz.title %></h1>
|
25
|
-
<div class="instructions">
|
26
|
-
<ul>
|
27
|
-
<li>No books, notes, or electronic devices allowed. </li>
|
28
|
-
<li>Time limit is 30 minutes.</li>
|
29
|
-
<li><%= quiz.num_questions %> multiple-choice questions, points indicated per question,
|
30
|
-
<%= quiz.points %> points total. Points per question are intended
|
31
|
-
to reflect approximate times they should take, at about 1 point per minute.</li>
|
32
|
-
<li>For 'select all that apply' questions worth N points,
|
33
|
-
you get 1/N of the points for each RIGHT answer that you check, plus
|
34
|
-
1/N of the points for each WRONG answer that you correctly
|
35
|
-
leave unchecked. That is, equal weight is given to deciding
|
36
|
-
whether each choice is part of the right answer or not.</li>
|
37
|
-
</ul>
|
38
|
-
<b>Good skill!</b>
|
39
|
-
</div>
|
40
|
-
<%= yield %>
|
41
|
-
</body>
|
42
|
-
</html>
|
data/templates/htmlform.html.erb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title><%= quiz.title %></title>
|
4
|
-
<style type="text/css" media="all">
|
5
|
-
body { font-family: Times, serif; }
|
6
|
-
.header { text-align: right; font-weight: bold; padding-right: 30%; line-height: 300%; }
|
7
|
-
h1 { text-align: center; }
|
8
|
-
ol.questions { list-style-type: number; }
|
9
|
-
li.question { page-break-inside: avoid; border-bottom: 1px solid grey; padding-bottom: 2ex; }
|
10
|
-
li.multiplechoice ol.answers { list-style-type: lower-alpha; }
|
11
|
-
li.multiplechoice ol.answers li { padding-bottom: 0.5ex; }
|
12
|
-
li.selectmultiple ol.answers { vertical-align: center; list-style-type: none; list-style-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUAQMAAAC3R49OAAAABlBMVEUAAAD///+l2Z/dAAAAEklEQVQImWNgAIL6/w+ogoEAAKI4Kp2NVIeDAAAAAElFTkSuQmCC'); }
|
13
|
-
li.truefalse ol.answers { list-style-type: none; }
|
14
|
-
li.truefalse ol.answers li { width: 15%; display: inline-block; }
|
15
|
-
.correct { color: green }
|
16
|
-
.incorrect { color: red }
|
17
|
-
.explanation { font-style: italic }
|
18
|
-
.instructions { clear: both; border: 1px solid black; align: center; padding: 2ex; margin: 2ex; }
|
19
|
-
</style>
|
20
|
-
</head>
|
21
|
-
<body>
|
22
|
-
<div class="header">
|
23
|
-
<div id="name">Name:</div>
|
24
|
-
<div id="sid">SID:</div>
|
25
|
-
</div>
|
26
|
-
<h1><%= quiz.title %></h1>
|
27
|
-
<div class="instructions">
|
28
|
-
<ul>
|
29
|
-
<li>No books, notes, or electronic devices allowed. </li>
|
30
|
-
<li>Time limit is 30 minutes.</li>
|
31
|
-
<li><%= quiz.num_questions %> multiple-choice questions, points indicated per question,
|
32
|
-
<%= quiz.points %> points total. Points per question are intended
|
33
|
-
to reflect approximate times they should take, at about 1 point per minute.</li>
|
34
|
-
<li>For 'select all that apply' questions worth N points,
|
35
|
-
you get 1/N of the points for each RIGHT answer that you check, plus
|
36
|
-
1/N of the points for each WRONG answer that you correctly
|
37
|
-
leave unchecked. That is, equal weight is given to deciding
|
38
|
-
whether each choice is part of the right answer or not.</li>
|
39
|
-
</ul>
|
40
|
-
<b>Good skill!</b>
|
41
|
-
</div>
|
42
|
-
<%= yield %>
|
43
|
-
</body>
|
44
|
-
</html>
|