soccer-quiz 0.1.4 → 0.1.8
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/Gemfile.lock +1 -1
- data/bin/bundle +114 -0
- data/bin/htmldiff +29 -0
- data/bin/ldiff +29 -0
- data/bin/nokogiri +29 -0
- data/bin/quiz +2 -2
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/lib/quiz/cli.rb +16 -5
- data/lib/quiz/scraper.rb +11 -8
- data/lib/quiz/version.rb +1 -1
- metadata +8 -3
- data/soccer-quiz-0.1.3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8451366700e6128a2d2a19f200ca3799d6026cfecd33d48c2e8b69131e273be
|
4
|
+
data.tar.gz: 108dac5404326f18046d22bace9d01f4b9b0f5de26fd993d2735f908267b0b8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1965c577e21ed64e69a9241d40710885221054622fffbf9c6d9935b6500615547bc78d0c176fa2fb49d7dfd53a43ca6eaf06d369ec76061f3f70d458d72fae7b
|
7
|
+
data.tar.gz: 2e2a39cc7f0b2ece8de8c04bc7c1ad431802f25c36f82d45a909dc774d35e340ed4f71a4c30b86ec5192cd2fc77e53b4295924166add6590ff97378edd4675b4
|
data/Gemfile.lock
CHANGED
data/bin/bundle
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
data/bin/htmldiff
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("diff-lcs", "htmldiff")
|
data/bin/ldiff
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'ldiff' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("diff-lcs", "ldiff")
|
data/bin/nokogiri
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'nokogiri' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("nokogiri", "nokogiri")
|
data/bin/quiz
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
Quiz::CLI.new.call
|
2
|
+
require_relative '../lib/quiz'
|
3
|
+
Quiz::CLI.new.call
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
data/bin/rspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/lib/quiz/cli.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
|
2
2
|
class Quiz::CLI
|
3
3
|
@@points = []
|
4
|
+
def initialize
|
5
|
+
end
|
4
6
|
def call
|
5
7
|
puts "Welcome to football soccer quiz."
|
6
8
|
start_quiz
|
@@ -58,11 +60,16 @@ class Quiz::CLI
|
|
58
60
|
runner_ups = objects.map{|item|item.runner_up}
|
59
61
|
random_year = years.sample
|
60
62
|
random_winner = winners.sample
|
61
|
-
|
63
|
+
|
64
|
+
instace_for_answers = objects.select{|item|item.year == random_year}
|
65
|
+
|
62
66
|
answer_for_how_many = objects.select{|item|item.winner == random_winner}.size
|
63
|
-
|
67
|
+
answer_for_how_many
|
68
|
+
winner = instace_for_answers[0].winner
|
69
|
+
|
64
70
|
host = instace_for_answers[0].host
|
65
71
|
runner_up = instace_for_answers[0].runner_up
|
72
|
+
|
66
73
|
if all_question("none",random_year)[question].include?("host")
|
67
74
|
puts all_question(host,random_year)[question]
|
68
75
|
multiple_choice(host,hosts)
|
@@ -77,7 +84,7 @@ class Quiz::CLI
|
|
77
84
|
while obtions.size < 13
|
78
85
|
obtions << counter
|
79
86
|
counter += 1
|
80
|
-
end
|
87
|
+
end
|
81
88
|
multiple_choice(answer_for_how_many,obtions)
|
82
89
|
else
|
83
90
|
puts all_question(winner,random_year)[question]
|
@@ -90,8 +97,8 @@ class Quiz::CLI
|
|
90
97
|
"Who was the host in #{year} world cup?",
|
91
98
|
"#{team} won the World cup final in #{year}. Who was the runner-up?",
|
92
99
|
"How many world cup #{team} has won?",
|
93
|
-
"Who won the champion
|
94
|
-
"#{team} won the Champion
|
100
|
+
"Who won the champion league in #{year}?",
|
101
|
+
"#{team} won the Champion league final in #{year}. Who was the runner-up?",
|
95
102
|
"Who hosted champion league final in #{year}?",
|
96
103
|
"Who won the balon d'Or in #{year}?",
|
97
104
|
"How many balon de'or #{team} has won?",
|
@@ -130,6 +137,10 @@ class Quiz::CLI
|
|
130
137
|
else puts "Sorry you failed. you score #{points} of 10 points."
|
131
138
|
end
|
132
139
|
Quiz::CLI.clear
|
140
|
+
Quiz::CHAMPIONLEAGUE.all.clear
|
141
|
+
Quiz::Worldcup.all.clear
|
142
|
+
Quiz::BALONDOR.all.clear
|
143
|
+
|
133
144
|
end
|
134
145
|
|
135
146
|
|
data/lib/quiz/scraper.rb
CHANGED
@@ -18,8 +18,8 @@ class Quiz::Scraper
|
|
18
18
|
while counter < players[0].size
|
19
19
|
all_players << {:winner => players[0][counter],:year => players[0][counter + 1]}
|
20
20
|
counter += 2
|
21
|
-
end
|
22
|
-
|
21
|
+
end
|
22
|
+
all_players
|
23
23
|
end
|
24
24
|
|
25
25
|
|
@@ -32,25 +32,28 @@ class Quiz::Scraper
|
|
32
32
|
while counter < world_cup[0].size
|
33
33
|
all_countries << {:year => world_cup[0][counter], :host => world_cup[0][counter + 1], :winner => world_cup[0][counter + 2], :runner_up => world_cup[0][counter + 3], :thirth_place => world_cup[0][counter + 4]}
|
34
34
|
counter += 9
|
35
|
-
end
|
35
|
+
end
|
36
36
|
all_countries
|
37
37
|
end
|
38
38
|
|
39
39
|
def self.champion_league
|
40
40
|
champion_league_url = "https://en.wikipedia.org/wiki/List_of_European_Cup_and_UEFA_Champions_League_finals"
|
41
41
|
champion_league_file = "tbody"
|
42
|
-
|
43
|
-
|
42
|
+
|
43
|
+
champions = self.scraper(champion_league_url,champion_league_file).map{|l|l.text.split("\n").reject{|e|e.empty?}}
|
44
|
+
champions[0].shift
|
45
|
+
champions.shift
|
46
|
+
champions.shift
|
44
47
|
10.times{champions[0].shift}
|
45
|
-
23.times{champions[0].pop}
|
46
|
-
champions[0].
|
48
|
+
23.times{champions[0].pop}
|
49
|
+
7.times{champions[0].delete_at(145)}
|
47
50
|
counter = 0
|
48
51
|
all_teams = []
|
49
52
|
while counter < champions[0].size
|
50
53
|
all_teams << {:year => champions[0][counter], :winner => champions[0][counter + 2], :score => champions[0][counter + 3], :runner_up => champions[0][counter + 5], :host => champions[0][counter + 6]}
|
51
54
|
counter += 8
|
52
55
|
end
|
53
|
-
|
56
|
+
all_teams
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
data/lib/quiz/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soccer-quiz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yarvin Hernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,8 +81,14 @@ files:
|
|
81
81
|
- LICENSE.txt
|
82
82
|
- README.md
|
83
83
|
- Rakefile
|
84
|
+
- bin/bundle
|
84
85
|
- bin/console
|
86
|
+
- bin/htmldiff
|
87
|
+
- bin/ldiff
|
88
|
+
- bin/nokogiri
|
85
89
|
- bin/quiz
|
90
|
+
- bin/rake
|
91
|
+
- bin/rspec
|
86
92
|
- bin/setup
|
87
93
|
- config/environment.rb
|
88
94
|
- lib/quiz.rb
|
@@ -93,7 +99,6 @@ files:
|
|
93
99
|
- lib/quiz/version.rb
|
94
100
|
- lib/quiz/world_cup.rb
|
95
101
|
- quiz.gemspec
|
96
|
-
- soccer-quiz-0.1.3.gem
|
97
102
|
homepage: https://rubygems.org/gems/soccer_quiz
|
98
103
|
licenses:
|
99
104
|
- MIT
|
data/soccer-quiz-0.1.3.gem
DELETED
Binary file
|