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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66d9a528994c9da30791ef85f5b8351abe0375c1
4
- data.tar.gz: 198ea471eaa3e0367874fbdd1f8842a0a881b8b0
3
+ metadata.gz: 26ecfa4416543821e77400392111b8b48ca53c71
4
+ data.tar.gz: 1d8655923580c184ad5c41e8d85b79de239f0cdb
5
5
  SHA512:
6
- metadata.gz: 08b2f3dc3a5ad59d90300b47d76c954cd88cf531db5559f29db9fe87f6f31abf45211d68c201b548670d5f4eb56644d327a2b38deb8df53c0641a2bf214ca2f7
7
- data.tar.gz: 79475dca68da8bd34b6968339663f0be4d0e23f8c98750de6d5ffba2f1436f318dad2ff402e7e32234b98160d4c8a232401ba23d3525aa1d8140419ff73f02ff
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 ' ' + db[randarr[0]][1]
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[:prompt])
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[:great])
94
+ Color.set($config.color["great"])
93
95
  puts "great!\n"
94
96
  Color.set('reset')
95
97
  else
96
- Color.set($config.color[:miss])
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
- `cp lib/default_config $HOME/.whatisquiz/config`
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
@@ -5,7 +5,7 @@ class Reader
5
5
  def initialize
6
6
  @path = ["/bin"]
7
7
  @prompt = "$ "
8
- @color = {:prompt => 'white', :great => 'red', :miss => 'blue'}
8
+ @color = {"prompt" => 'white', "great" => 'red', "miss" => 'blue'}
9
9
  end
10
10
 
11
11
  def setpath(str)
@@ -1,3 +1,3 @@
1
1
  module Whatisquiz
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatisquiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - chakirin