questiongenerator 0.1.0 → 1.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 +5 -5
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +58 -2
- data/lib/questiongenerator.rb +47 -58
- data/lib/questions/de.yml +80 -0
- data/lib/questions/en.yml +51 -25
- data/lib/questions/fr.yml +161 -0
- data/questiongenerator.gemspec +2 -1
- data/spec/questiongenerator_spec.rb +23 -0
- data/spec/spec_helper.rb +93 -0
- metadata +42 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 758784d5d1a0314b051f925492230ceabd04b25b5c3ffd5449949008940e7f14
|
4
|
+
data.tar.gz: fea85ed6d03dc237f32fa53cee8c6644fcd7a02bf173216845f1120c571785de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c82dbab5148bfd888c3783ea1c5c4c37dadc6dcfec27ef5f6899fb8944cc23fbd432d41ebdaed8f4fdb25a5626f072d31a9730fa338ccb5ac8db05eac03137de
|
7
|
+
data.tar.gz: f03721ccb6170cd76dbd11663492972849b3e452f2c0ee0fec797c9fd29bb846f38a5c761a3eecfa1044973bdc2c2091b3146a87249db69a2cfe36b02355db7a
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Add this line to your application's Gemfile:
|
|
10
10
|
|
11
11
|
If you're feeling _edgy_, you can add this line instead:
|
12
12
|
|
13
|
-
gem 'questiongenerator', git: 'https://github.com/
|
13
|
+
gem 'questiongenerator', git: 'https://github.com/nilsding/questiongenerator.git'
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
@@ -31,12 +31,68 @@ puts QuestionGenerator.generate
|
|
31
31
|
# You can also specify the locale, if you want to
|
32
32
|
puts QuestionGenerator.generate locale: :de
|
33
33
|
# => "Was war das letzte, das du gegessen hast?"
|
34
|
+
|
35
|
+
# You can also specify an own prefix or suffix:
|
36
|
+
puts QuestionGenerator.generate locale: :fr, prefix: '[FR] ', suffix: ' ?'
|
37
|
+
# => "[FR] Quelle est la personne la plus célèbre que vous avez rencontrée ?"
|
38
|
+
```
|
39
|
+
|
40
|
+
## How it works
|
41
|
+
|
42
|
+
The question generator uses a simple branching structure inside the specified locale to generate questions from it, here is a quick example:
|
43
|
+
|
44
|
+
```yml
|
45
|
+
Can:
|
46
|
+
you:
|
47
|
+
- swim
|
48
|
+
- speak:
|
49
|
+
- different:
|
50
|
+
- languages
|
51
|
+
- play:
|
52
|
+
- any:
|
53
|
+
- sports
|
54
|
+
- the:
|
55
|
+
- piano
|
56
|
+
- guitar
|
57
|
+
- trumpet
|
58
|
+
- baseball
|
59
|
+
- ski
|
60
|
+
- cook
|
61
|
+
- dance
|
62
|
+
|
63
|
+
# The following example outputs:
|
64
|
+
# Can you swim?
|
65
|
+
# Can you speak different languages?
|
66
|
+
# Can you play any sports?
|
67
|
+
# Can you play the piano?
|
68
|
+
# ...guitar?
|
69
|
+
# ...trumpet?
|
70
|
+
# Can you play baseball?
|
71
|
+
# Can you ski?
|
72
|
+
# Can you cook?
|
73
|
+
# Can you dance?
|
74
|
+
```
|
75
|
+
|
76
|
+
If you can't break sentences in parts in your language, you can also specify the entire question in one line.
|
77
|
+
```yml
|
78
|
+
- Can you swim
|
79
|
+
|
80
|
+
# The following example outputs:
|
81
|
+
# Can you swim?
|
34
82
|
```
|
35
83
|
|
36
84
|
## Contributing
|
37
85
|
|
38
|
-
|
86
|
+
The files for questions are located in `lib/questions/`
|
87
|
+
|
88
|
+
If you want to add a new language, create a new file and name it with the [ISO-639-1 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) of it (just like `en.yml`)
|
89
|
+
|
90
|
+
1. Fork it ( https://github.com/nilsding/questiongenerator/fork )
|
39
91
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
92
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
93
|
4. Push to the branch (`git push origin my-new-feature`)
|
42
94
|
5. Create a new Pull Request
|
95
|
+
|
96
|
+
Please don't add harassing, scaring or upsetting content to the questions or content that otherwise violates the [Retrospring Terms of Service](https://retrospring.net/terms).
|
97
|
+
|
98
|
+
If you add questions in another language to the questiongenerator and purposely add wrong translations, further Pull Requests will be ignored.
|
data/lib/questiongenerator.rb
CHANGED
@@ -1,84 +1,73 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
2
4
|
|
3
5
|
# Generates some questions.
|
4
6
|
module QuestionGenerator
|
5
7
|
# Version of QuestionGenerator
|
6
|
-
VERSION = "
|
8
|
+
VERSION = "1.1.0"
|
7
9
|
|
8
10
|
class << self
|
9
11
|
# The base path to the questions (e.g. +'/home/nilsding/questions'+).
|
10
|
-
|
12
|
+
attr_reader :question_base_path
|
11
13
|
# The default locale, as a symbol.
|
12
14
|
attr_accessor :default_locale
|
13
15
|
end
|
14
16
|
|
17
|
+
module_function
|
18
|
+
|
15
19
|
# Generates a new question.
|
16
20
|
# @param options [Hash] A customizable set of options.
|
17
|
-
# @
|
18
|
-
# @
|
19
|
-
# @
|
20
|
-
# @option options [Boolean] :use_compiled (true) Use compiled questions
|
21
|
-
# instead of generating it. See also {compile}
|
21
|
+
# @param :locale [Symbol] The target locale
|
22
|
+
# @param :prefix [String] Prefix of the question, e.g. +'¿'+
|
23
|
+
# @param :suffix [String] Suffix of the question, e.g. +' ?'+
|
22
24
|
# @return [String] String containing the generated question.
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
suffix: '?',
|
28
|
-
use_compiled: true
|
29
|
-
}.merge!(options)
|
30
|
-
if opts[:use_compiled] and !@compiled[opts[:locale]].nil?
|
31
|
-
opts[:prefix] + @compiled[opts[:locale]].sample + opts[:suffix]
|
32
|
-
else
|
33
|
-
questions = YAML.load_file(File.expand_path("#{opts[:locale].to_s}.yml", @question_base_path))
|
34
|
-
opts[:prefix] + get_question(questions).strip + opts[:suffix]
|
35
|
-
end
|
25
|
+
def generate(locale: @default_locale, prefix: "", suffix: "?")
|
26
|
+
compile(locale:) unless @compiled.key?(locale)
|
27
|
+
|
28
|
+
prefix + @compiled[locale].sample + suffix
|
36
29
|
end
|
37
30
|
|
38
31
|
# Compiles all the questions and stores it into the +@compiled+ hash.
|
39
|
-
# @param
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
32
|
+
# @param :locale [Symbol] The target locale
|
33
|
+
def compile(locale: @default_locale)
|
34
|
+
questions = YAML.load_file(File.expand_path("#{locale}.yml", @question_base_path))
|
35
|
+
@compiled[locale] = build(questions)
|
36
|
+
end
|
37
|
+
|
38
|
+
def question_base_path=(path)
|
39
|
+
raise Errno::ENOENT.new(path) unless Dir.exist?(path)
|
40
|
+
|
41
|
+
@compiled = {} # new dir, force a recompile
|
42
|
+
@question_base_path = path
|
47
43
|
end
|
48
44
|
|
49
45
|
private
|
50
46
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
end
|
62
|
-
question
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.build(questions, q = "")
|
66
|
-
ary = []
|
67
|
-
if questions.is_a? Hash
|
68
|
-
questions.each do |k, v|
|
69
|
-
ary << build(v, "#{q}#{k} ")
|
70
|
-
end
|
71
|
-
elsif questions.is_a? Array
|
72
|
-
questions.each do |v|
|
73
|
-
ary << build(v, q)
|
47
|
+
module_function
|
48
|
+
|
49
|
+
def build(questions, q = "")
|
50
|
+
ary = []
|
51
|
+
|
52
|
+
case questions
|
53
|
+
when Hash
|
54
|
+
questions.each do |k, v|
|
55
|
+
Array(k).each do |variant|
|
56
|
+
ary << build(v, "#{q}#{variant} ")
|
74
57
|
end
|
75
|
-
elsif questions.is_a? String
|
76
|
-
return "#{q}#{questions}".strip
|
77
58
|
end
|
78
|
-
|
59
|
+
when Array
|
60
|
+
questions.each do |v|
|
61
|
+
ary << build(v, q)
|
62
|
+
end
|
63
|
+
when String
|
64
|
+
return "#{q}#{questions}".strip
|
79
65
|
end
|
80
66
|
|
81
|
-
|
82
|
-
|
83
|
-
|
67
|
+
ary.flatten
|
68
|
+
end
|
69
|
+
|
70
|
+
@question_base_path = File.expand_path("./questions/", __dir__)
|
71
|
+
@default_locale = :en
|
72
|
+
@compiled = {}
|
84
73
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Was:
|
2
|
+
- machst du:
|
3
|
+
- am liebsten:
|
4
|
+
- mit deinen Freunden
|
5
|
+
- an einem freien Tag
|
6
|
+
- an einem gewöhnlichen Samstagabend
|
7
|
+
- in deinem nächsten Urlaub
|
8
|
+
- "machst du, wenn":
|
9
|
+
- du:
|
10
|
+
- dich entspannen willst
|
11
|
+
- nicht einschlafen kannst
|
12
|
+
- etwas Furchtbares passiert ist
|
13
|
+
|
14
|
+
- war:
|
15
|
+
- das:
|
16
|
+
- letzte,:
|
17
|
+
- das:
|
18
|
+
- du:
|
19
|
+
- gegessen hast
|
20
|
+
- gemacht hast
|
21
|
+
- würdest:
|
22
|
+
- du:
|
23
|
+
- tun,:
|
24
|
+
- wenn:
|
25
|
+
- du:
|
26
|
+
- nur noch einen Monat zu leben hättest
|
27
|
+
- im Lotto gewinnen würdest
|
28
|
+
- dich zwischen Reichtum in Einsamkeit oder Armut in Gesellschaft entscheiden müsstest
|
29
|
+
- deine Eltern dir sagen würden, dass du adoptiert bist
|
30
|
+
- jemand bei dir einbrechen würde, während du im Haus bist
|
31
|
+
- es:
|
32
|
+
- Drachen gäbe
|
33
|
+
- Weltuntergang wäre
|
34
|
+
- Geld regnen würde
|
35
|
+
- trinkst:
|
36
|
+
- du:
|
37
|
+
- gerne
|
38
|
+
- gerade
|
39
|
+
- hast:
|
40
|
+
- du:
|
41
|
+
- zuletzt:
|
42
|
+
- gegessen # REDUNDANZ FTW
|
43
|
+
- getrunken
|
44
|
+
- gekocht
|
45
|
+
- im Radio gehört
|
46
|
+
Glaubst:
|
47
|
+
- du an:
|
48
|
+
- Gott
|
49
|
+
- Jesus
|
50
|
+
- das fliegende Spaghettimonster
|
51
|
+
- dich
|
52
|
+
|
53
|
+
Möchtest:
|
54
|
+
- du:
|
55
|
+
- einmal:
|
56
|
+
- eine Weltreise machen
|
57
|
+
- berühmt werden
|
58
|
+
- ein Haus besitzen
|
59
|
+
- ein Kind kriegen
|
60
|
+
Fährst:
|
61
|
+
- du:
|
62
|
+
- häufig:
|
63
|
+
- Fahrrad
|
64
|
+
- Auto
|
65
|
+
- mit dem Bus
|
66
|
+
- mit der Bahn
|
67
|
+
- weg
|
68
|
+
- aus der Haut
|
69
|
+
- mit dem Schiff
|
70
|
+
Magst:
|
71
|
+
- du:
|
72
|
+
- Meeresfrüchte
|
73
|
+
- Hunde
|
74
|
+
- Kakadus
|
75
|
+
- das Flugzeugfliegen
|
76
|
+
- Reisen
|
77
|
+
- neue Bekanntschaften
|
78
|
+
- das Meer
|
79
|
+
- die italienische Küche
|
80
|
+
- die asiatische Küche
|
data/lib/questions/en.yml
CHANGED
@@ -47,26 +47,28 @@ Do:
|
|
47
47
|
- muffins
|
48
48
|
- video games
|
49
49
|
know:
|
50
|
-
too:
|
51
|
-
|
52
|
-
about: &friends_know_much
|
50
|
+
[much, too much]:
|
51
|
+
about:
|
53
52
|
- your:
|
54
53
|
- life
|
55
54
|
- hobbies
|
56
55
|
- family
|
57
56
|
- friends
|
58
57
|
- you
|
59
|
-
much:
|
60
|
-
about: *friends_know_much
|
61
58
|
What:
|
62
59
|
- was:
|
63
60
|
the:
|
61
|
+
best:
|
62
|
+
- day of your life like
|
64
63
|
last:
|
64
|
+
song:
|
65
|
+
- you listened on repeat
|
65
66
|
thing:
|
66
67
|
you:
|
67
68
|
have:
|
68
|
-
-
|
69
|
+
- bought
|
69
70
|
- done
|
71
|
+
- eaten
|
70
72
|
your:
|
71
73
|
favourite:
|
72
74
|
song:
|
@@ -90,30 +92,33 @@ What:
|
|
90
92
|
you:
|
91
93
|
do:
|
92
94
|
- for fun
|
93
|
-
- on:
|
95
|
+
- 'on':
|
94
96
|
- the:
|
95
97
|
- weekend
|
96
98
|
like:
|
97
|
-
more
|
99
|
+
more,:
|
98
100
|
- dogs or cats
|
99
101
|
- shower or bath
|
100
102
|
- tea or coffee
|
101
103
|
think:
|
102
104
|
about:
|
103
105
|
- the:
|
104
|
-
-
|
106
|
+
- Internet
|
105
107
|
- Bad Dragon
|
106
108
|
- dragons
|
107
109
|
- '"fact" accounts'
|
108
110
|
- society
|
109
111
|
- cats
|
110
112
|
- surveillance
|
111
|
-
-
|
112
|
-
|
113
|
+
- coyotes
|
114
|
+
- raccoons
|
115
|
+
- foxes
|
116
|
+
- dogs
|
117
|
+
- lizards
|
118
|
+
- [activity, activities]:
|
113
119
|
do:
|
114
120
|
you:
|
115
121
|
- enjoy the most
|
116
|
-
- activities: *activity
|
117
122
|
- kind:
|
118
123
|
of:
|
119
124
|
animals:
|
@@ -124,7 +129,7 @@ What:
|
|
124
129
|
really:
|
125
130
|
find:
|
126
131
|
cute:
|
127
|
-
- in a person
|
132
|
+
- in a person
|
128
133
|
- is:
|
129
134
|
your:
|
130
135
|
- first memory
|
@@ -136,32 +141,35 @@ What:
|
|
136
141
|
- sports team
|
137
142
|
- activity
|
138
143
|
- beverage
|
139
|
-
-
|
144
|
+
- Internet browser
|
140
145
|
- piece of music
|
141
146
|
- console
|
142
|
-
- retrospring developer
|
143
|
-
- retrospring moderator
|
144
147
|
- snack
|
145
148
|
- food
|
149
|
+
- animal
|
146
150
|
- programming language:
|
147
151
|
- ''
|
148
152
|
- and why is it:
|
149
153
|
- PHP
|
150
|
-
|
154
|
+
- Rust
|
155
|
+
- C++
|
156
|
+
- Lisp
|
157
|
+
- Pascal
|
158
|
+
- Swift
|
159
|
+
- Ruby
|
160
|
+
- website:
|
151
161
|
- ''
|
152
162
|
- and why is it:
|
153
|
-
- 4chan
|
154
|
-
- 9gag
|
155
163
|
- Reddit
|
156
164
|
- Twitter
|
157
165
|
- Facebook
|
158
166
|
- YouTube
|
159
167
|
the:
|
160
|
-
best:
|
168
|
+
[best, worst]:
|
161
169
|
thing:
|
162
170
|
- about:
|
163
171
|
the:
|
164
|
-
-
|
172
|
+
- Internet
|
165
173
|
your:
|
166
174
|
- favourite:
|
167
175
|
- series
|
@@ -176,7 +184,6 @@ What:
|
|
176
184
|
fast:
|
177
185
|
food:
|
178
186
|
- chain
|
179
|
-
worst: *is_the_best
|
180
187
|
one:
|
181
188
|
- thing you would like to become better at
|
182
189
|
- was:
|
@@ -187,11 +194,12 @@ What:
|
|
187
194
|
- did
|
188
195
|
- ate
|
189
196
|
- looked for
|
190
|
-
best:
|
197
|
+
[best, worst]:
|
191
198
|
thing:
|
192
199
|
- "you've eaten so far"
|
193
|
-
worst: *was_the_best
|
194
200
|
- languages do you know
|
201
|
+
- apps do you use daily
|
202
|
+
- 'is heavier: a kilogram of steel, or a kilogram of feathers'
|
195
203
|
Can:
|
196
204
|
you:
|
197
205
|
- swim
|
@@ -205,10 +213,13 @@ Can:
|
|
205
213
|
- piano
|
206
214
|
- guitar
|
207
215
|
- trumpet
|
216
|
+
- saxophone
|
208
217
|
- baseball
|
209
218
|
- ski
|
210
219
|
- cook
|
211
220
|
- dance
|
221
|
+
- yodel
|
222
|
+
- draw
|
212
223
|
Are:
|
213
224
|
you:
|
214
225
|
- religious
|
@@ -216,7 +227,7 @@ Have:
|
|
216
227
|
you:
|
217
228
|
ever:
|
218
229
|
- been:
|
219
|
-
-
|
230
|
+
- to:
|
220
231
|
- Austria
|
221
232
|
- Germany
|
222
233
|
- Japan
|
@@ -243,6 +254,7 @@ Have:
|
|
243
254
|
- "from the 80's"
|
244
255
|
- dubstep
|
245
256
|
- nightcore
|
257
|
+
- metal
|
246
258
|
- had:
|
247
259
|
- an:
|
248
260
|
- accident
|
@@ -258,10 +270,14 @@ How:
|
|
258
270
|
old:
|
259
271
|
are:
|
260
272
|
- you
|
273
|
+
many:
|
274
|
+
- open tabs do you currently have
|
275
|
+
- followers is too many
|
261
276
|
Where:
|
262
277
|
do:
|
263
278
|
you:
|
264
279
|
- work
|
280
|
+
- live
|
265
281
|
Which:
|
266
282
|
food:
|
267
283
|
do:
|
@@ -272,6 +288,16 @@ Who:
|
|
272
288
|
is:
|
273
289
|
the:
|
274
290
|
- most famous person you have met
|
291
|
+
your:
|
292
|
+
- favourite:
|
293
|
+
- Retrospring user
|
294
|
+
- actor
|
295
|
+
- artist
|
296
|
+
- comedian
|
297
|
+
- musician
|
298
|
+
Why:
|
299
|
+
do:
|
300
|
+
- they call it oven when you of in the cold food of out hot eat the food
|
275
301
|
Would:
|
276
302
|
you:
|
277
303
|
rather:
|
@@ -0,0 +1,161 @@
|
|
1
|
+
Que:
|
2
|
+
- "feriez-vous":
|
3
|
+
- si:
|
4
|
+
- vous:
|
5
|
+
- pouviez:
|
6
|
+
- voler
|
7
|
+
- "changer votre apparence pendant une journée"
|
8
|
+
- "devenir le Président de la République"
|
9
|
+
- aviez:
|
10
|
+
- "un million d'euros"
|
11
|
+
- "faites-vous":
|
12
|
+
- "le week-end"
|
13
|
+
- pour vous amuser
|
14
|
+
- "quand vous êtes en vacances"
|
15
|
+
- "pensez-vous":
|
16
|
+
- de:
|
17
|
+
- "l'internet"
|
18
|
+
- Bad Dragon
|
19
|
+
- la:
|
20
|
+
- "société"
|
21
|
+
- loi renseignement
|
22
|
+
- pornographie
|
23
|
+
- vie:
|
24
|
+
- en:
|
25
|
+
- France
|
26
|
+
- 2015
|
27
|
+
- aux:
|
28
|
+
- "États-Unis"
|
29
|
+
- des:
|
30
|
+
- dragons
|
31
|
+
- féministes
|
32
|
+
- chats
|
33
|
+
- "préférez-vous":
|
34
|
+
- entre:
|
35
|
+
- "le thé et le café"
|
36
|
+
- les chiens et les chats
|
37
|
+
- le bain et la douche
|
38
|
+
|
39
|
+
Quel:
|
40
|
+
- est:
|
41
|
+
- votre:
|
42
|
+
- premier souvenir
|
43
|
+
- "jeu vidéo préféré"
|
44
|
+
- "jeu de table préféré"
|
45
|
+
- "navigateur préféré"
|
46
|
+
- "plat préféré"
|
47
|
+
- "langage de programmation préféré":
|
48
|
+
- ''
|
49
|
+
- "et pourquoi est-ce":
|
50
|
+
- PHP
|
51
|
+
- "site préféré":
|
52
|
+
- ''
|
53
|
+
- "et pourquoi est-ce":
|
54
|
+
- 4chan
|
55
|
+
- 9gag
|
56
|
+
- Reddit
|
57
|
+
- Twitter
|
58
|
+
- Facebook
|
59
|
+
- YouTube
|
60
|
+
- Fanatic Game
|
61
|
+
- "modérateur Retrospring préféré"
|
62
|
+
- "développeur Retrospring préféré"
|
63
|
+
- le:
|
64
|
+
- "métier de vos rêves"
|
65
|
+
- "plus beau cadeau qu'on ait pu vous faire"
|
66
|
+
- "âge":
|
67
|
+
- "avez-vous"
|
68
|
+
|
69
|
+
Quelle:
|
70
|
+
- est:
|
71
|
+
- votre:
|
72
|
+
- "chanson préférée"
|
73
|
+
- "chiffre préféré"
|
74
|
+
- "couleur préférée"
|
75
|
+
- "saison préférée"
|
76
|
+
- "équipe de sport préférée"
|
77
|
+
- "musique préférée"
|
78
|
+
- "console préférée"
|
79
|
+
- "boisson préférée"
|
80
|
+
- "activité préférée"
|
81
|
+
- "série préférée"
|
82
|
+
- "série d'animation japonaise préférée"
|
83
|
+
- la:
|
84
|
+
- "personne la plus célèbre que vous avez rencontrée"
|
85
|
+
- "était":
|
86
|
+
- votre:
|
87
|
+
- chanson:
|
88
|
+
- "préférée":
|
89
|
+
- quand vous aviez 5 ans
|
90
|
+
- il y a quelques semaines
|
91
|
+
- la:
|
92
|
+
- "dernière":
|
93
|
+
- "chose que vous avez mangée"
|
94
|
+
|
95
|
+
"Êtes-vous":
|
96
|
+
- "déjà":
|
97
|
+
- "allé":
|
98
|
+
- en:
|
99
|
+
- Autriche
|
100
|
+
- Allemagne
|
101
|
+
- Suisse
|
102
|
+
- France
|
103
|
+
- "Suède"
|
104
|
+
- "Norvège"
|
105
|
+
- Finlande
|
106
|
+
- Australie
|
107
|
+
- Italie
|
108
|
+
- Russie
|
109
|
+
- Chine
|
110
|
+
- au:
|
111
|
+
- Japon
|
112
|
+
- "Royaume-Uni"
|
113
|
+
- aux:
|
114
|
+
- "États-Unis"
|
115
|
+
- une personne:
|
116
|
+
- religieuse
|
117
|
+
- courageuse
|
118
|
+
|
119
|
+
"Avez-vous":
|
120
|
+
- un:
|
121
|
+
- animal de compagnie
|
122
|
+
- surnom
|
123
|
+
- "frère ou une sœur"
|
124
|
+
- une:
|
125
|
+
- console de jeux
|
126
|
+
- "déjà":
|
127
|
+
- "écrit":
|
128
|
+
- "une lettre d'amour"
|
129
|
+
- en japonais
|
130
|
+
|
131
|
+
"Aimez-vous":
|
132
|
+
- les:
|
133
|
+
- "jeux vidéo"
|
134
|
+
- "réseaux sociaux"
|
135
|
+
- muffins
|
136
|
+
- frites
|
137
|
+
- la:
|
138
|
+
- "pêche"
|
139
|
+
- ville:
|
140
|
+
- "où vous":
|
141
|
+
- habitez
|
142
|
+
- "êtes né"
|
143
|
+
- voyager
|
144
|
+
- chanter
|
145
|
+
- "quand il n'y a personne chez vous"
|
146
|
+
- en japonais
|
147
|
+
- dans la rue
|
148
|
+
|
149
|
+
"Pouvez-vous":
|
150
|
+
- jouer:
|
151
|
+
- "d'un instrument"
|
152
|
+
- au baseball
|
153
|
+
- au football
|
154
|
+
- nager
|
155
|
+
- cuisiner
|
156
|
+
- parler:
|
157
|
+
- plusieurs:
|
158
|
+
- langues
|
159
|
+
|
160
|
+
Comment:
|
161
|
+
- "allez-vous"
|
data/questiongenerator.gemspec
CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "
|
21
|
+
spec.add_development_dependency "bundler", ">= 1.6", "< 3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
23
24
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe QuestionGenerator do
|
4
|
+
it 'applies a prefix to a question' do
|
5
|
+
prefix = "¿"
|
6
|
+
expect(QuestionGenerator.generate prefix: prefix).to start_with(prefix)
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'applies a suffix to a question' do
|
10
|
+
suffix = "!!!1"
|
11
|
+
expect(QuestionGenerator.generate suffix: suffix).to end_with(suffix)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'compiles all available locales' do
|
15
|
+
puts
|
16
|
+
available_locales = Dir[File.expand_path '../../lib/questions/*.yml', __FILE__].map { |l| File.basename(l).sub(/\.yml$/, '') }
|
17
|
+
available_locales.each do |locale|
|
18
|
+
print "compiling #{locale}"
|
19
|
+
compiled = QuestionGenerator.compile locale: locale.to_sym
|
20
|
+
puts " (#{compiled.length} questions)"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
18
|
+
# users commonly want.
|
19
|
+
#
|
20
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# rspec-expectations config goes here. You can use an alternate
|
23
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
24
|
+
# assertions if you prefer.
|
25
|
+
config.expect_with :rspec do |expectations|
|
26
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
27
|
+
# and `failure_message` of custom matchers include text for helper methods
|
28
|
+
# defined using `chain`, e.g.:
|
29
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
30
|
+
# # => "be bigger than 2 and smaller than 4"
|
31
|
+
# ...rather than:
|
32
|
+
# # => "be bigger than 2"
|
33
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
37
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
38
|
+
config.mock_with :rspec do |mocks|
|
39
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
40
|
+
# a real object. This is generally recommended, and will default to
|
41
|
+
# `true` in RSpec 4.
|
42
|
+
mocks.verify_partial_doubles = true
|
43
|
+
end
|
44
|
+
|
45
|
+
# The settings below are suggested to provide a good initial experience
|
46
|
+
# with RSpec, but feel free to customize to your heart's content.
|
47
|
+
=begin
|
48
|
+
# These two settings work together to allow you to limit a spec run
|
49
|
+
# to individual examples or groups you care about by tagging them with
|
50
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
51
|
+
# get run.
|
52
|
+
config.filter_run :focus
|
53
|
+
config.run_all_when_everything_filtered = true
|
54
|
+
|
55
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
56
|
+
# recommended. For more details, see:
|
57
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
58
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
59
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
60
|
+
config.disable_monkey_patching!
|
61
|
+
|
62
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
63
|
+
# be too noisy due to issues in dependencies.
|
64
|
+
config.warnings = true
|
65
|
+
|
66
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
67
|
+
# file, and it's useful to allow more verbose output when running an
|
68
|
+
# individual spec file.
|
69
|
+
if config.files_to_run.one?
|
70
|
+
# Use the documentation formatter for detailed output,
|
71
|
+
# unless a formatter has already been configured
|
72
|
+
# (e.g. via a command-line flag).
|
73
|
+
config.default_formatter = 'doc'
|
74
|
+
end
|
75
|
+
|
76
|
+
# Print the 10 slowest examples and example groups at the
|
77
|
+
# end of the spec run, to help surface which specs are running
|
78
|
+
# particularly slow.
|
79
|
+
config.profile_examples = 10
|
80
|
+
|
81
|
+
# Run specs in random order to surface order dependencies. If you find an
|
82
|
+
# order dependency and want to debug it, you can fix the order by providing
|
83
|
+
# the seed, which is printed after each run.
|
84
|
+
# --seed 1234
|
85
|
+
config.order = :random
|
86
|
+
|
87
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
88
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
89
|
+
# test failures related to randomization by passing the same `--seed` value
|
90
|
+
# as the one that triggered the failure.
|
91
|
+
Kernel.srand config.seed
|
92
|
+
=end
|
93
|
+
end
|
metadata
CHANGED
@@ -1,41 +1,61 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: questiongenerator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nilsding
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.6'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
32
52
|
- !ruby/object:Gem::Version
|
33
53
|
version: '0'
|
34
54
|
type: :development
|
35
55
|
prerelease: false
|
36
56
|
version_requirements: !ruby/object:Gem::Requirement
|
37
57
|
requirements:
|
38
|
-
- -
|
58
|
+
- - ">="
|
39
59
|
- !ruby/object:Gem::Version
|
40
60
|
version: '0'
|
41
61
|
description: A simple question generator, used by Retrospring.
|
@@ -45,37 +65,43 @@ executables: []
|
|
45
65
|
extensions: []
|
46
66
|
extra_rdoc_files: []
|
47
67
|
files:
|
48
|
-
- .gitignore
|
68
|
+
- ".gitignore"
|
69
|
+
- ".rspec"
|
70
|
+
- ".travis.yml"
|
49
71
|
- Gemfile
|
50
72
|
- LICENSE.txt
|
51
73
|
- README.md
|
52
74
|
- Rakefile
|
53
75
|
- lib/questiongenerator.rb
|
76
|
+
- lib/questions/de.yml
|
54
77
|
- lib/questions/en.yml
|
78
|
+
- lib/questions/fr.yml
|
55
79
|
- questiongenerator.gemspec
|
80
|
+
- spec/questiongenerator_spec.rb
|
81
|
+
- spec/spec_helper.rb
|
56
82
|
homepage: https://github.com/retrospring/questiongenerator
|
57
83
|
licenses:
|
58
84
|
- MIT
|
59
85
|
metadata: {}
|
60
|
-
post_install_message:
|
86
|
+
post_install_message:
|
61
87
|
rdoc_options: []
|
62
88
|
require_paths:
|
63
89
|
- lib
|
64
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
65
91
|
requirements:
|
66
|
-
- -
|
92
|
+
- - ">="
|
67
93
|
- !ruby/object:Gem::Version
|
68
94
|
version: '0'
|
69
95
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
96
|
requirements:
|
71
|
-
- -
|
97
|
+
- - ">="
|
72
98
|
- !ruby/object:Gem::Version
|
73
99
|
version: '0'
|
74
100
|
requirements: []
|
75
|
-
|
76
|
-
|
77
|
-
signing_key:
|
101
|
+
rubygems_version: 3.4.3
|
102
|
+
signing_key:
|
78
103
|
specification_version: 4
|
79
104
|
summary: A simple question generator.
|
80
|
-
test_files:
|
81
|
-
|
105
|
+
test_files:
|
106
|
+
- spec/questiongenerator_spec.rb
|
107
|
+
- spec/spec_helper.rb
|