whatisquiz 1.0.3 → 1.0.4
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 +4 -4
- data/bin/whatisquiz +10 -7
- data/lib/read_config.rb +1 -1
- data/lib/whatisquiz/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26ecfa4416543821e77400392111b8b48ca53c71
|
|
4
|
+
data.tar.gz: 1d8655923580c184ad5c41e8d85b79de239f0cdb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6352e7b2c82965635b820fa38ae8f27b725657fca749a97861eeaac8e46ac9d8c4bc3b69351f08f6ad5576578e87d3fb4b3625893c1691185ec2632734558de
|
|
7
|
+
data.tar.gz: 46e942e94dab065cdfe1dbf288406c8c96b29bb0efc3e8de8bfb8e80c02e99e728679c495621b24228f75af3d0784ae5ba23a53873ecf8984cf201d38b23dbd1
|
data/bin/whatisquiz
CHANGED
|
@@ -28,7 +28,6 @@ EOF
|
|
|
28
28
|
$design=<<EOF
|
|
29
29
|
###################################################################
|
|
30
30
|
EOF
|
|
31
|
-
|
|
32
31
|
$helpstr=<<EOF
|
|
33
32
|
.-----------------------------------.
|
|
34
33
|
| init: recreate database for quiz |
|
|
@@ -61,11 +60,11 @@ def repl
|
|
|
61
60
|
CSV.foreach($DB_PATH) do |row|
|
|
62
61
|
db << row
|
|
63
62
|
end
|
|
64
|
-
|
|
63
|
+
puts db.size
|
|
65
64
|
while true
|
|
66
65
|
randarr = (0..File.read($DB_PATH).count("\n")-1).to_a.shuffle!
|
|
67
66
|
puts $design
|
|
68
|
-
puts
|
|
67
|
+
puts db[randarr[0]][1]
|
|
69
68
|
puts $design
|
|
70
69
|
ans = db[randarr[0]][0]
|
|
71
70
|
nans1 = db[randarr[1]][0]
|
|
@@ -75,7 +74,7 @@ def repl
|
|
|
75
74
|
printf("%20s%20s\n", selecters[0], selecters[1])
|
|
76
75
|
printf("%20s%20s\n", selecters[2], selecters[3])
|
|
77
76
|
puts "input your answer"
|
|
78
|
-
Color.set($config.color[
|
|
77
|
+
Color.set($config.color["prompt"])
|
|
79
78
|
print $config.prompt
|
|
80
79
|
Color.set('reset')
|
|
81
80
|
input = gets.chomp
|
|
@@ -88,12 +87,15 @@ def repl
|
|
|
88
87
|
exit
|
|
89
88
|
when "init"
|
|
90
89
|
create_dict
|
|
90
|
+
CSV.foreach($DB_PATH) do |row|
|
|
91
|
+
db << row
|
|
92
|
+
end
|
|
91
93
|
when db[randarr[0]][0]
|
|
92
|
-
Color.set($config.color[
|
|
94
|
+
Color.set($config.color["great"])
|
|
93
95
|
puts "great!\n"
|
|
94
96
|
Color.set('reset')
|
|
95
97
|
else
|
|
96
|
-
Color.set($config.color[
|
|
98
|
+
Color.set($config.color["miss"])
|
|
97
99
|
puts "miss..."
|
|
98
100
|
puts "the answer is " + ans
|
|
99
101
|
Color.set('reset')
|
|
@@ -106,7 +108,8 @@ def conf_init
|
|
|
106
108
|
if Dir.glob($CONFIG_PATH).empty?
|
|
107
109
|
FileUtils.mkdir_p($HOME + '/.whatisquiz')
|
|
108
110
|
puts 'generating config file...'
|
|
109
|
-
|
|
111
|
+
#`cp lib/default_config $HOME/.whatisquiz/config`
|
|
112
|
+
FileUtils.cp "lib/default_config", $HOME + "/.whatisquiz/config"
|
|
110
113
|
else
|
|
111
114
|
$config.instance_eval File.read($CONFIG_PATH), $CONFIG_PATH
|
|
112
115
|
end
|
data/lib/read_config.rb
CHANGED
data/lib/whatisquiz/version.rb
CHANGED