ruql-prairielearn 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +39 -0
- data/README.md +107 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/ruql/prairielearn.rb +3 -0
- data/lib/ruql/prairielearn/prairielearn.rb +91 -0
- data/lib/ruql/prairielearn/question.rb +96 -0
- data/lib/ruql/prairielearn/version.rb +5 -0
- data/ruql-prairielearn.gemspec +42 -0
- data/templates/info.json.erb +10 -0
- data/templates/pl-checkbox.html.erb +34 -0
- data/templates/pl-multiple-choice.html.erb +27 -0
- metadata +138 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 72df128708909f9e1a7312c278cde75c7837fb80399de110d76610ecdf0d44ca
|
|
4
|
+
data.tar.gz: 9325c936da9ff429bf452cb111bea41d3839850fb3fb6f05846912a01311bfbb
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 43ab486232fad83299403b9fc88c1d58ffe10cc474a9713677d32bf02f1b0a9ac17250809806a41df7cea2e690254e44bf4755e3a4ed24b7d820a004bb7fc0c9
|
|
7
|
+
data.tar.gz: '0917791ee973d9ff9c95a9ce4fb44a6eba4fa8a1e1fec64fceb2414779ae1ad656f0fdae48e1675986fd3b47d1935fe5b4ce53319a27d2955680bd16452c43dc'
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
ruql-prairielearn (0.1.0)
|
|
5
|
+
builder (~> 3.0)
|
|
6
|
+
ruql (~> 1.0, >= 1.0.2)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
builder (3.2.4)
|
|
12
|
+
diff-lcs (1.4.4)
|
|
13
|
+
rake (10.5.0)
|
|
14
|
+
rspec (3.10.0)
|
|
15
|
+
rspec-core (~> 3.10.0)
|
|
16
|
+
rspec-expectations (~> 3.10.0)
|
|
17
|
+
rspec-mocks (~> 3.10.0)
|
|
18
|
+
rspec-core (3.10.1)
|
|
19
|
+
rspec-support (~> 3.10.0)
|
|
20
|
+
rspec-expectations (3.10.1)
|
|
21
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
22
|
+
rspec-support (~> 3.10.0)
|
|
23
|
+
rspec-mocks (3.10.2)
|
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
25
|
+
rspec-support (~> 3.10.0)
|
|
26
|
+
rspec-support (3.10.2)
|
|
27
|
+
ruql (1.0.4)
|
|
28
|
+
|
|
29
|
+
PLATFORMS
|
|
30
|
+
ruby
|
|
31
|
+
|
|
32
|
+
DEPENDENCIES
|
|
33
|
+
bundler (~> 1.17)
|
|
34
|
+
rake (~> 10.0)
|
|
35
|
+
rspec (~> 3.0)
|
|
36
|
+
ruql-prairielearn!
|
|
37
|
+
|
|
38
|
+
BUNDLED WITH
|
|
39
|
+
1.17.3
|
data/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Ruql::Prairielearn
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ruql/prairielearn`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'ruql-prairielearn'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install ruql-prairielearn
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
`ruql prairielearn --default-topic=`_topic_ `[--omit-tags=`_tag1,tag2_`] [--extra-tags=`_tag1,tag2,tag3_`] ruql_file.rb`
|
|
27
|
+
|
|
28
|
+
Converts questions in `ruql_file.rb` into a set of PrairieLearn question
|
|
29
|
+
generators. Each question will go in its own subdirectory containing
|
|
30
|
+
`question.html` and `info.json`. These are assumed to be questions
|
|
31
|
+
that require no special server-side files.
|
|
32
|
+
The attribute `singleVariant` will be set to `true` in
|
|
33
|
+
`info.json` since these questions are by definition single-variant.
|
|
34
|
+
|
|
35
|
+
Supported RuQL question types and their PrairieLearn equivalent
|
|
36
|
+
elements are as follows; unsupported questions are ignored with a
|
|
37
|
+
warning printed to standard error:
|
|
38
|
+
|
|
39
|
+
* `choice_answer` --
|
|
40
|
+
|
|
41
|
+
* `select_multiple` --
|
|
42
|
+
|
|
43
|
+
* `truefalse` --
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### If a RuQL question has one or more `tags`:
|
|
47
|
+
|
|
48
|
+
* The first tag (with all non-alphanumeric characters replaced by de-dup'd underscores, and all lowercased)
|
|
49
|
+
will be used as the subdirectory name;
|
|
50
|
+
for example, `P&D vs. Agile` will become `p_d_vs_agile`. If there are
|
|
51
|
+
name collisions, then `_2`, `_3`, etc. will be appended to subsequent
|
|
52
|
+
names.
|
|
53
|
+
|
|
54
|
+
* The first tag, first-word-capitalized but
|
|
55
|
+
otherwise verbatim, will be used as the question's `title`
|
|
56
|
+
attribute in `info.json`. Question titles need not be unique,
|
|
57
|
+
so it's fine for multiple questions to have the same title.
|
|
58
|
+
|
|
59
|
+
* If a tag begins with `topic:`, the rest of the tag is used as the
|
|
60
|
+
question's `topic` in `info.json`, which means it must appear in the
|
|
61
|
+
list of topics in `infoCourse.json`.
|
|
62
|
+
|
|
63
|
+
### If the question does not have `tags`:
|
|
64
|
+
|
|
65
|
+
* A random UUID will be generated as the subdirectory name and also
|
|
66
|
+
used as the question's `title`.
|
|
67
|
+
|
|
68
|
+
* The value of the required `--default-topic=` option on the command line will be used
|
|
69
|
+
as the topic.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### PrairieLearn-specific interpretation of certain tags
|
|
73
|
+
|
|
74
|
+
If a question's tag list includes any tags given in the `--omit-tags`
|
|
75
|
+
command line argument, that question
|
|
76
|
+
won't be converted to PL format at all. At Berkeley we use this for questions
|
|
77
|
+
that were designed to be simple manually-constructed variants placed into the same logical
|
|
78
|
+
RuQL group for delivery via Canvas; we hand-convert those to
|
|
79
|
+
PrairieLearn and use its question generator ability.
|
|
80
|
+
|
|
81
|
+
Furthermore, the tag `radio` will be added for single-answer multiple
|
|
82
|
+
choice (`choice_answer` in RuQL) questions, and `checkbox` will be
|
|
83
|
+
added for select-all-that-apply (`select_multiple` in RuQL) questions.
|
|
84
|
+
|
|
85
|
+
### Additional tags
|
|
86
|
+
|
|
87
|
+
You can optionally specify `--extra-tags=tag1,tag2,tag3` on the command line
|
|
88
|
+
(where each tag can contain any characters except commas; it's your
|
|
89
|
+
job to escape them properly from the shell) as extra tags that will be
|
|
90
|
+
added to *all* questions. For example, this can indicate who imported
|
|
91
|
+
the questions.
|
|
92
|
+
|
|
93
|
+
The final list of a question's tags is sorted in alphabetical order.
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
98
|
+
|
|
99
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
100
|
+
|
|
101
|
+
## Contributing
|
|
102
|
+
|
|
103
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ruql-prairielearn. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
104
|
+
|
|
105
|
+
## Code of Conduct
|
|
106
|
+
|
|
107
|
+
Everyone interacting in the Ruql::Prairielearn project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruql-prairielearn/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ruql/prairielearn"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
module Ruql
|
|
2
|
+
class Prairielearn
|
|
3
|
+
require 'builder'
|
|
4
|
+
|
|
5
|
+
attr_reader :output
|
|
6
|
+
|
|
7
|
+
def initialize(quiz,options={})
|
|
8
|
+
@quiz = quiz
|
|
9
|
+
@subdirs = [] # since need unique subdir names
|
|
10
|
+
@output = ''
|
|
11
|
+
@default_topic = options.delete('--default-topic') or
|
|
12
|
+
raise Ruql::OptionsError.new("--default-topic must be specified")
|
|
13
|
+
@omit_tags = options.delete('--omit-tags').to_s.split(',')
|
|
14
|
+
@extra_tags = options.delete('--extra-tags').to_s.split(',')
|
|
15
|
+
@path = options.delete('--path')
|
|
16
|
+
if (@partial_credit = options.delete('--partial-credit'))
|
|
17
|
+
raise Ruql::OptionsError.new('--partial-credit must be one of EDC or PC if given') unless
|
|
18
|
+
%w(edc pc).include?(@partial_credit.downcase)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.allowed_options
|
|
23
|
+
opts = [
|
|
24
|
+
['--default-topic', GetoptLong::REQUIRED_ARGUMENT],
|
|
25
|
+
['--omit-tags', GetoptLong::REQUIRED_ARGUMENT],
|
|
26
|
+
['--extra-tags', GetoptLong::REQUIRED_ARGUMENT],
|
|
27
|
+
['--partial-credit', GetoptLong::REQUIRED_ARGUMENT],
|
|
28
|
+
['--path', GetoptLong::REQUIRED_ARGUMENT]
|
|
29
|
+
]
|
|
30
|
+
help = <<eos
|
|
31
|
+
The PrairieLearn renderer supports these options:
|
|
32
|
+
|
|
33
|
+
--default-topic=TopicName
|
|
34
|
+
REQUIRED: value of "topic" attribute for info.json for questions lacking
|
|
35
|
+
a tag of the form 'topic:TopicName'
|
|
36
|
+
--extra-tags=tag1,tag2
|
|
37
|
+
These tags will be added to all questions' tag lists.
|
|
38
|
+
--omit-tags=tag1,tag2
|
|
39
|
+
Any RuQL questions having tags matching these will be skipped.
|
|
40
|
+
--partial-credit={EDC|PC}
|
|
41
|
+
Grading method for "select all that apply" questions. If omitted, default is
|
|
42
|
+
no partial credit ("all or nothing"). See documentation at
|
|
43
|
+
https://prairielearn.readthedocs.io/en/latest/elements/#pl-checkbox-element
|
|
44
|
+
--path=path/to/questions/subdir
|
|
45
|
+
If given, place each question's subdir inside this directory, which must exist.
|
|
46
|
+
If not given, the subdirectory questions/ will be used, and created if needed.
|
|
47
|
+
WARNING: in the latter case, question files may be overwritten!
|
|
48
|
+
|
|
49
|
+
A RuQL question's first tag will be used as the question's "title" attribute and subdirectory
|
|
50
|
+
name (properly escaped). If no tags, uuid's will be used for these purposes. Subdirectory
|
|
51
|
+
names will be appended with _2, 3, as needed to ensure uniqueness.
|
|
52
|
+
eos
|
|
53
|
+
return [help, opts]
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def render_quiz
|
|
57
|
+
begin
|
|
58
|
+
questions_path = get_or_make_questions_subdir!
|
|
59
|
+
@quiz.questions.each do |q|
|
|
60
|
+
@plq = Ruql::Prairielearn::Question.new(q,@partial_credit,@extra_tags,@default_topic,questions_path)
|
|
61
|
+
if @omit_tags.any? { |t| q.tags.include? t }
|
|
62
|
+
@output << " Skip #{@plq.digest}\n"
|
|
63
|
+
next
|
|
64
|
+
end
|
|
65
|
+
@plq.create_question_files!
|
|
66
|
+
@output << "Create #{File.basename questions_path}/#{File.basename @plq.question_dir} topic=#{@plq.topic} tags=[#{@plq.tags.join ','}]\n"
|
|
67
|
+
end
|
|
68
|
+
self
|
|
69
|
+
rescue StandardError => e
|
|
70
|
+
STDERR.puts "Exiting: #{e.backtrace}"
|
|
71
|
+
Ruql::Prairielearn::Question.clean_up_after_error!
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
private
|
|
76
|
+
|
|
77
|
+
def get_or_make_questions_subdir!
|
|
78
|
+
# if @path was given, use it; otherwise look for/use 'questions'
|
|
79
|
+
@path ||= 'questions'
|
|
80
|
+
# if a subdir exists with that name, use it
|
|
81
|
+
if File.directory?(@path)
|
|
82
|
+
File.absolute_path @path
|
|
83
|
+
else
|
|
84
|
+
# create a questions dir
|
|
85
|
+
Dir.mkdir(@path)
|
|
86
|
+
File.absolute_path @path
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module Ruql
|
|
2
|
+
class Prairielearn
|
|
3
|
+
class Question
|
|
4
|
+
require 'securerandom' # for uuid generation
|
|
5
|
+
require 'erb'
|
|
6
|
+
require 'fileutils'
|
|
7
|
+
|
|
8
|
+
attr_reader :question, :partial_credit, :tags, :uuid, :topic, :title, :question_dir, :digest, :none_of_the_above
|
|
9
|
+
|
|
10
|
+
@@dirnames = {} # keep track of titles seen, since subdir names must be unique
|
|
11
|
+
|
|
12
|
+
def initialize(question,partial_credit,extra_tags,default_topic,path='.')
|
|
13
|
+
@gem_root = Gem.loaded_specs['ruql-prairielearn'].full_gem_path
|
|
14
|
+
@@path ||= path
|
|
15
|
+
@question = question
|
|
16
|
+
@partial_credit = partial_credit
|
|
17
|
+
@extra_tags = extra_tags
|
|
18
|
+
@json_template = File.join(@gem_root, 'templates', 'info.json.erb')
|
|
19
|
+
@multiple_choice_template = File.join(@gem_root, 'templates', 'pl-multiple-choice.html.erb')
|
|
20
|
+
@select_multiple_template = File.join(@gem_root, 'templates', 'pl-checkbox.html.erb')
|
|
21
|
+
@uuid = SecureRandom.uuid
|
|
22
|
+
@tags = @question.question_tags
|
|
23
|
+
@digest = @question.question_text.strip[0,40] + '...'
|
|
24
|
+
@title = (@tags.empty? ? @uuid : @tags.first)
|
|
25
|
+
@topic = (t = @tags.any? { |tag| tag =~ /^topic:/ }) ?
|
|
26
|
+
@tags.delete(t).gsub(/^topic:/, '') :
|
|
27
|
+
default_topic
|
|
28
|
+
@tags += extra_tags
|
|
29
|
+
@none_of_the_above = question.answers.any? { |a| a =~ /^none of (these|the above)$/i }
|
|
30
|
+
@question_dir = nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def create_question_files!
|
|
34
|
+
begin
|
|
35
|
+
@question_dir = dirname()
|
|
36
|
+
Dir.mkdir(@question_dir) unless File.directory?(@question_dir)
|
|
37
|
+
create_json!
|
|
38
|
+
create_question_html!
|
|
39
|
+
rescue RuntimeError => e
|
|
40
|
+
raise Ruql::QuizContentError.new(e.message)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# If anything goes wrong, delete any files we created
|
|
45
|
+
def self.clean_up_after_error!
|
|
46
|
+
@@dirnames.each_pair do |dir,num|
|
|
47
|
+
fullpath = File.join(@@path,dir)
|
|
48
|
+
STDERR.puts "delete #{fullpath}"
|
|
49
|
+
FileUtils.rm_rf fullpath
|
|
50
|
+
if num > 1
|
|
51
|
+
2.upto(num).each do |otherdir|
|
|
52
|
+
fullpath = File.join(@@path,"#{dir}_#{otherdir}")
|
|
53
|
+
STDERR.puts "delete #{fullpath}"
|
|
54
|
+
FileUtils.rm_rf fullpath
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
|
|
62
|
+
def create_json!
|
|
63
|
+
json = ERB.new(IO.read(File.expand_path @json_template),nil,'-').result(binding)
|
|
64
|
+
File.open(File.join(@question_dir, 'info.json'), 'w') do |f|
|
|
65
|
+
f.puts json
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def create_question_html!
|
|
70
|
+
case question
|
|
71
|
+
when MultipleChoice then template = @multiple_choice_template
|
|
72
|
+
when SelectMultiple then template = @select_multiple_template
|
|
73
|
+
else raise Ruql::QuizContentError.new("Unknown question type: '#{@digest}'")
|
|
74
|
+
end
|
|
75
|
+
html = ERB.new(IO.read(File.expand_path template),nil,'-').result(binding)
|
|
76
|
+
File.open(File.join(@question_dir, 'question.html'), 'w') do |f|
|
|
77
|
+
f.puts html
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def dirname
|
|
82
|
+
try_name = @title.downcase.gsub( /[^a-z0-9\-]+/i, '_')
|
|
83
|
+
if @@dirnames.has_key?(try_name)
|
|
84
|
+
@@dirnames[try_name] += 1
|
|
85
|
+
try_name << "_#{@@dirnames[try_name]}"
|
|
86
|
+
else
|
|
87
|
+
@@dirnames[try_name] = 1
|
|
88
|
+
end
|
|
89
|
+
File.join(@@path, try_name)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "ruql/prairielearn/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ruql-prairielearn"
|
|
8
|
+
spec.version = Ruql::Prairielearn::VERSION
|
|
9
|
+
spec.authors = ["Armando Fox"]
|
|
10
|
+
spec.email = ["fox@berkeley.edu"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{PrairieLearn-format renderer for RuQL.}
|
|
13
|
+
spec.homepage = %q{https://github.com/saasbook/ruql-prairielearn}
|
|
14
|
+
|
|
15
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
16
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
17
|
+
if spec.respond_to?(:metadata)
|
|
18
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
21
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
|
22
|
+
else
|
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
|
24
|
+
"public gem pushes."
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
spec.add_runtime_dependency 'ruql', '~> 1.0', '>= 1.0.2'
|
|
28
|
+
spec.add_runtime_dependency 'builder', '~> 3.0'
|
|
29
|
+
|
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
34
|
+
end
|
|
35
|
+
spec.bindir = "exe"
|
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
37
|
+
spec.require_paths = ["lib"]
|
|
38
|
+
|
|
39
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
|
40
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
42
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<pl-question-panel>
|
|
2
|
+
|
|
3
|
+
<%= question.question_text %>
|
|
4
|
+
|
|
5
|
+
</pl-question-panel>
|
|
6
|
+
|
|
7
|
+
<pl-checkbox
|
|
8
|
+
answers-name="t"
|
|
9
|
+
<% if partial_credit.nil? -%>
|
|
10
|
+
partial-credit="false"
|
|
11
|
+
<% else %>
|
|
12
|
+
partial-credit="true"
|
|
13
|
+
partial-credit-method="<%= partial_credit.downcase %>"
|
|
14
|
+
<% end -%>
|
|
15
|
+
hide-letter-keys="true"
|
|
16
|
+
hide-help-text="false"
|
|
17
|
+
fixed-order="false">
|
|
18
|
+
|
|
19
|
+
<% question.answers.each do |answer| -%>
|
|
20
|
+
<pl-answer correct="<%= !!(answer.correct?) %>">
|
|
21
|
+
<%= answer.answer_text %>
|
|
22
|
+
<% if answer.has_explanation? -%>
|
|
23
|
+
<!-- begin hint -->
|
|
24
|
+
<pl-hide-in-panel question="true" submission="true" answer="true">
|
|
25
|
+
<div class="pl-answer-hint">
|
|
26
|
+
<%= answer.explanation %>
|
|
27
|
+
</div>
|
|
28
|
+
</pl-hide-in-panel>
|
|
29
|
+
<!-- end hint -->
|
|
30
|
+
<% end -%>
|
|
31
|
+
</pl-answer>
|
|
32
|
+
|
|
33
|
+
<% end -%>
|
|
34
|
+
</pl-checkbox>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<pl-question-panel>
|
|
2
|
+
|
|
3
|
+
<%= question.question_text %>
|
|
4
|
+
|
|
5
|
+
</pl-question-panel>
|
|
6
|
+
|
|
7
|
+
<pl-multiple-choice
|
|
8
|
+
answers-name="t"
|
|
9
|
+
none-of-the-above="<%= none_of_the_above %>"
|
|
10
|
+
hide-letter-keys="true">
|
|
11
|
+
|
|
12
|
+
<% question.answers.each do |answer| -%>
|
|
13
|
+
<pl-answer correct="<%= !!(answer.correct?) %>">
|
|
14
|
+
<%= answer.answer_text %>
|
|
15
|
+
<% if answer.has_explanation? -%>
|
|
16
|
+
<!-- begin hint -->
|
|
17
|
+
<pl-hide-in-panel question="true" submission="true" answer="true">
|
|
18
|
+
<div class="pl-answer-hint">
|
|
19
|
+
<%= answer.explanation %>
|
|
20
|
+
</div>
|
|
21
|
+
</pl-hide-in-panel>
|
|
22
|
+
<!-- end hint -->
|
|
23
|
+
<% end -%>
|
|
24
|
+
</pl-answer>
|
|
25
|
+
|
|
26
|
+
<% end -%>
|
|
27
|
+
</pl-multiple-choice>
|
metadata
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ruql-prairielearn
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Armando Fox
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: ruql
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.0'
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 1.0.2
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '1.0'
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 1.0.2
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: builder
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.0'
|
|
40
|
+
type: :runtime
|
|
41
|
+
prerelease: false
|
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.0'
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: bundler
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '1.17'
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '1.17'
|
|
61
|
+
- !ruby/object:Gem::Dependency
|
|
62
|
+
name: rake
|
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '10.0'
|
|
68
|
+
type: :development
|
|
69
|
+
prerelease: false
|
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '10.0'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: rspec
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '3.0'
|
|
82
|
+
type: :development
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '3.0'
|
|
89
|
+
description:
|
|
90
|
+
email:
|
|
91
|
+
- fox@berkeley.edu
|
|
92
|
+
executables: []
|
|
93
|
+
extensions: []
|
|
94
|
+
extra_rdoc_files: []
|
|
95
|
+
files:
|
|
96
|
+
- ".gitignore"
|
|
97
|
+
- ".rspec"
|
|
98
|
+
- ".travis.yml"
|
|
99
|
+
- Gemfile
|
|
100
|
+
- Gemfile.lock
|
|
101
|
+
- README.md
|
|
102
|
+
- Rakefile
|
|
103
|
+
- bin/console
|
|
104
|
+
- bin/setup
|
|
105
|
+
- lib/ruql/prairielearn.rb
|
|
106
|
+
- lib/ruql/prairielearn/prairielearn.rb
|
|
107
|
+
- lib/ruql/prairielearn/question.rb
|
|
108
|
+
- lib/ruql/prairielearn/version.rb
|
|
109
|
+
- ruql-prairielearn.gemspec
|
|
110
|
+
- templates/info.json.erb
|
|
111
|
+
- templates/pl-checkbox.html.erb
|
|
112
|
+
- templates/pl-multiple-choice.html.erb
|
|
113
|
+
homepage: https://github.com/saasbook/ruql-prairielearn
|
|
114
|
+
licenses: []
|
|
115
|
+
metadata:
|
|
116
|
+
allowed_push_host: https://rubygems.org
|
|
117
|
+
homepage_uri: https://github.com/saasbook/ruql-prairielearn
|
|
118
|
+
source_code_uri: https://github.com/saasbook/ruql-prairielearn
|
|
119
|
+
post_install_message:
|
|
120
|
+
rdoc_options: []
|
|
121
|
+
require_paths:
|
|
122
|
+
- lib
|
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
|
+
requirements:
|
|
125
|
+
- - ">="
|
|
126
|
+
- !ruby/object:Gem::Version
|
|
127
|
+
version: '0'
|
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
|
+
requirements:
|
|
130
|
+
- - ">="
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '0'
|
|
133
|
+
requirements: []
|
|
134
|
+
rubygems_version: 3.0.8
|
|
135
|
+
signing_key:
|
|
136
|
+
specification_version: 4
|
|
137
|
+
summary: PrairieLearn-format renderer for RuQL.
|
|
138
|
+
test_files: []
|