nba_today_gem 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/.DS_Store +0 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/nba_today_gem +6 -0
- data/bin/setup +8 -0
- data/lib/nba_today_gem/commandline.rb +180 -0
- data/lib/nba_today_gem/game.rb +32 -0
- data/lib/nba_today_gem/nba_player.rb +7 -0
- data/lib/nba_today_gem/scraper.rb +86 -0
- data/lib/nba_today_gem/team.rb +20 -0
- data/lib/nba_today_gem/version.rb +3 -0
- data/lib/nba_today_gem.rb +12 -0
- data/nba_today_gem.gemspec +36 -0
- data/spec.md +6 -0
- metadata +106 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 808beadb9237e6bde68c368b6d0ce35e6df7124e
|
|
4
|
+
data.tar.gz: 71dd51fa36291d51e702fdc069f332c531148c43
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5d3ef5c21f8e7ca79029ec4ab6aa6c17854f683d977cb4cc731dd07aad3f5f8df10d4572f6ad5f2a6e981b7126aaf5053533c5ec21f7ab378c2e00b7414394c0
|
|
7
|
+
data.tar.gz: 1359014eb2f74a077888c00c74897eed8d4b0212cecf374478ef1f8ad5ff3bf7e6d6a3da5dab108416b1b2e91d2faa0178faf399596d2bfc80b2ba23915078b6
|
data/.DS_Store
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Sergio Mendoza
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# NBA Today Gem
|
|
2
|
+
|
|
3
|
+
The NBA Today Gem is a simple gem that allows you to get the latest NBA scores right through your terminal.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'nba_today_gem'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install nba_today_gem
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
TODO: Write usage instructions here
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
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).
|
|
30
|
+
|
|
31
|
+
## Contributing
|
|
32
|
+
|
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/smendoza787/scoreboard-cli-gem.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require_relative "../lib/nba_today_gem.rb"
|
|
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
|
data/bin/nba_today_gem
ADDED
data/bin/setup
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
class NbaTodayGem::CommandLine
|
|
2
|
+
include CommandLineReporter
|
|
3
|
+
|
|
4
|
+
attr_reader :games
|
|
5
|
+
|
|
6
|
+
def call
|
|
7
|
+
puts "Hello, Welcome to the NBA Today Gem!"
|
|
8
|
+
menu
|
|
9
|
+
goodbye
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def menu
|
|
13
|
+
input = nil
|
|
14
|
+
|
|
15
|
+
until input == "exit"
|
|
16
|
+
puts
|
|
17
|
+
puts "Type in 'nba today' for the latest NBA scores"
|
|
18
|
+
puts "or type 'exit' to quit!"
|
|
19
|
+
puts
|
|
20
|
+
print "> "
|
|
21
|
+
input = gets.strip.downcase
|
|
22
|
+
|
|
23
|
+
if input == "nba today"
|
|
24
|
+
list_games
|
|
25
|
+
pick_game_menu
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_games
|
|
31
|
+
if !self.games
|
|
32
|
+
@games = NbaTodayGem::Scraper.new.scrape_nba_scores
|
|
33
|
+
|
|
34
|
+
header :title => 'NBA SCORES', :width => 75, :align => 'center', :rule => true, :color => 'green', :bold => true, :timestamp => true
|
|
35
|
+
|
|
36
|
+
self.games.each.with_index(1) do |game, index|
|
|
37
|
+
table(:border => true) do
|
|
38
|
+
row do
|
|
39
|
+
column('GAME NUM.', :width => 10, :align => 'center')
|
|
40
|
+
column(game.date, :width => 30, :align => 'center')
|
|
41
|
+
column('SCORE', :width => 10, :align => 'center')
|
|
42
|
+
end
|
|
43
|
+
row do
|
|
44
|
+
column(index)
|
|
45
|
+
column(game.away_team.name)
|
|
46
|
+
column(game.away_team.score[0])
|
|
47
|
+
end
|
|
48
|
+
row do
|
|
49
|
+
column('')
|
|
50
|
+
column(game.home_team.name)
|
|
51
|
+
column(game.home_team.score[0])
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
else
|
|
56
|
+
header :title => 'NBA SCORES', :width => 50, :align => 'center', :rule => true, :color => 'green', :bold => true, :timestamp => true
|
|
57
|
+
|
|
58
|
+
self.games.each.with_index(1) do |game, index|
|
|
59
|
+
table(:border => true) do
|
|
60
|
+
row do
|
|
61
|
+
column('GAME NUM.', :width => 5)
|
|
62
|
+
column(game.date, :width => 30, :align => 'center')
|
|
63
|
+
column('SCORE', :width => 10, :align => 'right')
|
|
64
|
+
end
|
|
65
|
+
row do
|
|
66
|
+
column(index)
|
|
67
|
+
column(game.away_team.name)
|
|
68
|
+
column(game.away_team.score[0])
|
|
69
|
+
end
|
|
70
|
+
row do
|
|
71
|
+
column('')
|
|
72
|
+
column(game.home_team.name)
|
|
73
|
+
column(game.home_team.score[0])
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def pick_game_menu
|
|
81
|
+
game_no = nil
|
|
82
|
+
|
|
83
|
+
until game_no == 'back' || game_no == 'exit'
|
|
84
|
+
puts
|
|
85
|
+
puts "Type in a GAME NUM. to view more stats and info"
|
|
86
|
+
puts "Type 'list games' for a list of games"
|
|
87
|
+
puts "Type 'back' to go back to the main menu."
|
|
88
|
+
puts
|
|
89
|
+
print "> "
|
|
90
|
+
game_no = gets.strip.downcase
|
|
91
|
+
|
|
92
|
+
if game_no == "list games"
|
|
93
|
+
list_games
|
|
94
|
+
pick_game_menu
|
|
95
|
+
elsif game_no.to_i > 0 && game_no.to_i <= self.games.length
|
|
96
|
+
index = game_no.to_i - 1
|
|
97
|
+
show_game(index)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def show_game(index)
|
|
103
|
+
# header :title => self.games[index].date, :width => 100, :align => 'center', :rule => true, :color => 'blue', :bold => true
|
|
104
|
+
|
|
105
|
+
# puts
|
|
106
|
+
|
|
107
|
+
table(:border => true) do
|
|
108
|
+
row do
|
|
109
|
+
column(self.games[index].date, :width => 30, :align => 'center')
|
|
110
|
+
column(self.games[index].venue, :width => 50, :align => 'center')
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
puts
|
|
115
|
+
|
|
116
|
+
if self.games[index].recap != ""
|
|
117
|
+
table(:border => true) do
|
|
118
|
+
row do
|
|
119
|
+
column(self.games[index].recap, :width => 80, :align => 'center')
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
puts
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
header :title => 'BOX SCORE', :width => 100, :align => 'center', :rule => true, :color => 'red', :bold => true
|
|
127
|
+
|
|
128
|
+
table(:border => true) do
|
|
129
|
+
row do
|
|
130
|
+
column('TEAM', :width => 25, :align => 'center')
|
|
131
|
+
column('QTR 1', :align => 'center')
|
|
132
|
+
column('QTR 2', :align => 'center')
|
|
133
|
+
column('QTR 3', :align => 'center')
|
|
134
|
+
column('QTR 4', :align => 'center')
|
|
135
|
+
column(self.games[index].status, :align => 'center')
|
|
136
|
+
end
|
|
137
|
+
row do
|
|
138
|
+
column(self.games[index].away_team.name)
|
|
139
|
+
column(self.games[index].away_team.score[1])
|
|
140
|
+
column(self.games[index].away_team.score[2])
|
|
141
|
+
column(self.games[index].away_team.score[3])
|
|
142
|
+
column(self.games[index].away_team.score[4])
|
|
143
|
+
column(self.games[index].away_team.score[0])
|
|
144
|
+
end
|
|
145
|
+
row do
|
|
146
|
+
column(self.games[index].home_team.name)
|
|
147
|
+
column(self.games[index].home_team.score[1])
|
|
148
|
+
column(self.games[index].home_team.score[2])
|
|
149
|
+
column(self.games[index].home_team.score[3])
|
|
150
|
+
column(self.games[index].home_team.score[4])
|
|
151
|
+
column(self.games[index].home_team.score[0])
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
puts
|
|
156
|
+
header :title => 'TOP PERFORMERS', :width => 100, :align => 'center', :rule => true, :color => 'green', :bold => true
|
|
157
|
+
|
|
158
|
+
table(:border => true) do
|
|
159
|
+
row do
|
|
160
|
+
column("#{self.games[index].top_peformers[:points][0].name}: #{self.games[index].top_peformers[:points][0].points}", :width => 35, :align => 'center')
|
|
161
|
+
column('POINTS', :align => 'center')
|
|
162
|
+
column("#{self.games[index].top_peformers[:points][1].name}: #{self.games[index].top_peformers[:points][1].points}", :width => 35, :align => 'center')
|
|
163
|
+
end
|
|
164
|
+
row do
|
|
165
|
+
column("#{self.games[index].top_peformers[:rebounds][0].name}: #{self.games[index].top_peformers[:rebounds][0].rebounds}", :width => 35, :align => 'center')
|
|
166
|
+
column('REBOUNDS', :align => 'center')
|
|
167
|
+
column("#{self.games[index].top_peformers[:rebounds][1].name}: #{self.games[index].top_peformers[:rebounds][1].rebounds}", :width => 35, :align => 'center')
|
|
168
|
+
end
|
|
169
|
+
row do
|
|
170
|
+
column("#{self.games[index].top_peformers[:assists][0].name}: #{self.games[index].top_peformers[:assists][0].assists}", :width => 35, :align => 'center')
|
|
171
|
+
column('ASSISTS', :align => 'center')
|
|
172
|
+
column("#{self.games[index].top_peformers[:assists][1].name}: #{self.games[index].top_peformers[:assists][1].assists}", :width => 35, :align => 'center')
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def goodbye
|
|
178
|
+
puts "Thanks for using the NBA Today Gem!"
|
|
179
|
+
end
|
|
180
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class Game
|
|
2
|
+
attr_accessor :status, :score, :venue, :top_peformers, :league, :home_team, :away_team, :url, :recap, :date
|
|
3
|
+
|
|
4
|
+
@@all = []
|
|
5
|
+
|
|
6
|
+
def initialize(league)
|
|
7
|
+
@league = league
|
|
8
|
+
@top_peformers = {}
|
|
9
|
+
@@all << self
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def away_team=(away_team)
|
|
13
|
+
if !away_team.is_a?(Team)
|
|
14
|
+
raise TypeError, "must be a Team object"
|
|
15
|
+
else
|
|
16
|
+
@away_team = away_team
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def home_team=(home_team)
|
|
21
|
+
if !home_team.is_a?(Team)
|
|
22
|
+
raise TypeError, "must be a Team object"
|
|
23
|
+
else
|
|
24
|
+
@home_team = home_team
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.all
|
|
29
|
+
@@all
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
class NbaTodayGem::Scraper
|
|
2
|
+
include CommandLineReporter
|
|
3
|
+
|
|
4
|
+
attr_accessor :doc
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
# CommandLineReporter progress
|
|
8
|
+
self.formatter = 'progress'
|
|
9
|
+
|
|
10
|
+
@doc = Nokogiri::HTML(open("https://www.msn.com/en-us/sports/nba/scores")).css("div.sectionsgroup div.section")[0..1]
|
|
11
|
+
@games = []
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def games
|
|
15
|
+
@games
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def scrape_nba_scores
|
|
19
|
+
|
|
20
|
+
report do
|
|
21
|
+
self.doc.css("table tbody").each do |game|
|
|
22
|
+
new_nba_game = Game.new("nba")
|
|
23
|
+
|
|
24
|
+
new_nba_game.status = game.css("td.matchstatus.orangeText.hidedownlevel.size4.alignleft div").text
|
|
25
|
+
new_nba_game.venue = game.css("td.venue.size4").text
|
|
26
|
+
new_nba_game.url = "https://www.msn.com/#{game.attribute("data-link").value}"
|
|
27
|
+
|
|
28
|
+
new_nba_game.away_team = Team.new(game.css("td.teamname.teamlineup.alignright.size234").text, "nba")
|
|
29
|
+
new_nba_game.away_team.score[0] = game.css("td.totalscore.teamlineup").text.gsub(/[\n _]/, "") # Total score
|
|
30
|
+
new_nba_game.away_team.score[1] = game.css("tr:nth-child(1) td:nth-child(7)").text.gsub(/[\n _]/, "") # Quarter 1 score
|
|
31
|
+
new_nba_game.away_team.score[2] = game.css("tr:nth-child(1) td:nth-child(8)").text.gsub(/[\n _]/, "") # Quarter 2 score
|
|
32
|
+
new_nba_game.away_team.score[3] = game.css("tr:nth-child(1) td:nth-child(9)").text.gsub(/[\n _]/, "") # Quarter 3 score
|
|
33
|
+
new_nba_game.away_team.score[4] = game.css("tr:nth-child(1) td:nth-child(10)").text.gsub(/[\n _]/, "") # Quarter 4 score
|
|
34
|
+
|
|
35
|
+
new_nba_game.home_team = Team.new(game.css("td.teamname.teamlinedown.alignright.size234").text, "nba")
|
|
36
|
+
new_nba_game.home_team.score[0] = game.css("td.totalscore.teamlinedown").text.gsub(/[\n _]/, "") # Total score
|
|
37
|
+
new_nba_game.home_team.score[1] = game.css("tr:nth-child(2) td:nth-child(5)").text.gsub(/[\n _]/, "") # Quarter 1 score
|
|
38
|
+
new_nba_game.home_team.score[2] = game.css("tr:nth-child(2) td:nth-child(6)").text.gsub(/[\n _]/, "") # Quarter 2 score
|
|
39
|
+
new_nba_game.home_team.score[3] = game.css("tr:nth-child(2) td:nth-child(7)").text.gsub(/[\n _]/, "") # Quarter 3 score
|
|
40
|
+
new_nba_game.home_team.score[4] = game.css("tr:nth-child(2) td:nth-child(8)").text.gsub(/[\n _]/, "") # Quarter 4 score
|
|
41
|
+
|
|
42
|
+
scrape_nba_game_info(new_nba_game)
|
|
43
|
+
|
|
44
|
+
games << new_nba_game
|
|
45
|
+
# CommandLineReporter progress
|
|
46
|
+
progress
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
games
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def scrape_nba_game_info(game)
|
|
53
|
+
get_game_info = Nokogiri::HTML(open(game.url))
|
|
54
|
+
|
|
55
|
+
game.date = get_game_info.css("#gamematchupsummary div.basicinfo div.datetime.hide1").text
|
|
56
|
+
game.recap = get_game_info.css("#matchuprecapmodule header h1").text
|
|
57
|
+
|
|
58
|
+
point_leaders = [
|
|
59
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.points a:nth-child(3) div div.board span div.playername span").text),
|
|
60
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.points a:nth-child(5) div div.board span div.playername span").text)
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
point_leaders[0].points = get_game_info.css("div.leaders div.points a:nth-child(3) div div.board span div.stats span").text
|
|
64
|
+
point_leaders[1].points = get_game_info.css("div.leaders div.points a:nth-child(5) div div.board span div.stats span").text
|
|
65
|
+
|
|
66
|
+
rebound_leaders = [
|
|
67
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.rebounds a:nth-child(3) div div.board span div.playername span").text),
|
|
68
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.rebounds a:nth-child(5) div div.board span div.playername span").text)
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
rebound_leaders[0].rebounds = get_game_info.css("div.leaders div.rebounds a:nth-child(3) div div.board span div.stats span").text
|
|
72
|
+
rebound_leaders[1].rebounds = get_game_info.css("div.leaders div.rebounds a:nth-child(5) div div.board span div.stats span").text
|
|
73
|
+
|
|
74
|
+
assist_leaders = [
|
|
75
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.assists a:nth-child(3) div div.board span div.playername span").text),
|
|
76
|
+
NbaPlayer.new(get_game_info.css("div.leaders div.assists a:nth-child(5) div div.board span div.playername span").text)
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
assist_leaders[0].assists = get_game_info.css("div.leaders div.assists a:nth-child(3) div div.board span div.stats span").text
|
|
80
|
+
assist_leaders[1].assists = get_game_info.css("div.leaders div.assists a:nth-child(5) div div.board span div.stats span").text
|
|
81
|
+
|
|
82
|
+
game.top_peformers[:points] = point_leaders
|
|
83
|
+
game.top_peformers[:rebounds] = rebound_leaders
|
|
84
|
+
game.top_peformers[:assists] = assist_leaders
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
class Team
|
|
2
|
+
attr_accessor :name, :score, :league
|
|
3
|
+
|
|
4
|
+
def initialize(name, league)
|
|
5
|
+
@name = name
|
|
6
|
+
@league = league
|
|
7
|
+
|
|
8
|
+
# score is equal to an array of innings/periods/quarters
|
|
9
|
+
# the first element (@score[0]) is the TOTAL/FINAL score
|
|
10
|
+
# subsequent elements are the inning/period/quarter totals
|
|
11
|
+
case @league
|
|
12
|
+
when "mlb"
|
|
13
|
+
@score = [0,0,0,0,0,0,0,0,0,0]
|
|
14
|
+
when "nhl"
|
|
15
|
+
@score = [0,0,0,0]
|
|
16
|
+
else
|
|
17
|
+
@score = [0,0,0,0,0]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'Date'
|
|
2
|
+
require 'open-uri'
|
|
3
|
+
require 'nokogiri'
|
|
4
|
+
require 'command_line_reporter'
|
|
5
|
+
require 'pry'
|
|
6
|
+
|
|
7
|
+
require_relative './nba_today_gem/version.rb'
|
|
8
|
+
require_relative './nba_today_gem/scraper.rb'
|
|
9
|
+
require_relative './nba_today_gem/commandline.rb'
|
|
10
|
+
require_relative './nba_today_gem/game.rb'
|
|
11
|
+
require_relative './nba_today_gem/team.rb'
|
|
12
|
+
require_relative './nba_today_gem/nba_player.rb'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'nba_today_gem/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "nba_today_gem"
|
|
8
|
+
spec.version = NbaTodayGem::VERSION
|
|
9
|
+
spec.authors = ["Sergio Mendoza"]
|
|
10
|
+
spec.email = ["smendoza787@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "A gem for finding the latest NBA scores."
|
|
13
|
+
spec.description = "Get the latest NBA scores right through your terminal!"
|
|
14
|
+
spec.homepage = "https://github.com/smendoza787/nba-today-gem"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
|
19
|
+
# if spec.respond_to?(:metadata)
|
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
|
21
|
+
# else
|
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
|
23
|
+
# "public gem pushes."
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
|
28
|
+
end
|
|
29
|
+
spec.bindir = "exe"
|
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
31
|
+
spec.require_paths = ["lib"]
|
|
32
|
+
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
36
|
+
end
|
data/spec.md
ADDED
metadata
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: nba_today_gem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Sergio Mendoza
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.13'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.13'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '3.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '3.0'
|
|
55
|
+
description: Get the latest NBA scores right through your terminal!
|
|
56
|
+
email:
|
|
57
|
+
- smendoza787@gmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".DS_Store"
|
|
63
|
+
- ".gitignore"
|
|
64
|
+
- ".rspec"
|
|
65
|
+
- ".travis.yml"
|
|
66
|
+
- Gemfile
|
|
67
|
+
- LICENSE.txt
|
|
68
|
+
- README.md
|
|
69
|
+
- Rakefile
|
|
70
|
+
- bin/console
|
|
71
|
+
- bin/nba_today_gem
|
|
72
|
+
- bin/setup
|
|
73
|
+
- lib/nba_today_gem.rb
|
|
74
|
+
- lib/nba_today_gem/commandline.rb
|
|
75
|
+
- lib/nba_today_gem/game.rb
|
|
76
|
+
- lib/nba_today_gem/nba_player.rb
|
|
77
|
+
- lib/nba_today_gem/scraper.rb
|
|
78
|
+
- lib/nba_today_gem/team.rb
|
|
79
|
+
- lib/nba_today_gem/version.rb
|
|
80
|
+
- nba_today_gem.gemspec
|
|
81
|
+
- spec.md
|
|
82
|
+
homepage: https://github.com/smendoza787/nba-today-gem
|
|
83
|
+
licenses:
|
|
84
|
+
- MIT
|
|
85
|
+
metadata: {}
|
|
86
|
+
post_install_message:
|
|
87
|
+
rdoc_options: []
|
|
88
|
+
require_paths:
|
|
89
|
+
- lib
|
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - ">="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '0'
|
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
|
+
requirements:
|
|
97
|
+
- - ">="
|
|
98
|
+
- !ruby/object:Gem::Version
|
|
99
|
+
version: '0'
|
|
100
|
+
requirements: []
|
|
101
|
+
rubyforge_project:
|
|
102
|
+
rubygems_version: 2.6.11
|
|
103
|
+
signing_key:
|
|
104
|
+
specification_version: 4
|
|
105
|
+
summary: A gem for finding the latest NBA scores.
|
|
106
|
+
test_files: []
|