cli_epl_table 0.1.0 → 1.0.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/.vs/VSWorkspaceState.json +6 -0
- data/.vs/cli_epl_table/v15/.suo +0 -0
- data/.vs/slnx.sqlite +0 -0
- data/.vs/slnx.sqlite-journal +0 -0
- data/Gemfile.lock +4 -1
- data/NOTES.md +42 -0
- data/README.md +6 -18
- data/bin/epl +11 -0
- data/cli_epl_table.gemspec +1 -1
- data/lib/cli_epl_table.rb +2 -1
- data/lib/cli_epl_table/cli.rb +1 -1
- data/lib/cli_epl_table/sorter.rb +9 -0
- data/lib/cli_epl_table/team.rb +24 -0
- data/lib/cli_epl_table/version.rb +1 -1
- metadata +12 -6
- data/exe/epl +0 -7
- data/lib/cli_epl_table/teams.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b88a03bbfdbd7b86283a764037cb01edc29c044e6f7ad7374ad104b0f1a82948
|
4
|
+
data.tar.gz: ca0ae3e2a7b4bc9f5dcc23a4f4f335e17496a4a41d6d5fea281855de365e2fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2164eee66dda34db949a53dfc283f3855c6a995e80e007eaeeae784471643c59ca197b6b63c7446d09f3988caba35986e45348d5030e3726883d4c2b2b7d8cf
|
7
|
+
data.tar.gz: 1eaa36a5c5faa87680da114e6a143c6aeac9f169e9e67fbf3bbeeb93fa686a1a43f4e90b2ddb39856e296b569d64b433b3855b0a1320974e4f3f133c6c11f41c
|
Binary file
|
data/.vs/slnx.sqlite
ADDED
Binary file
|
Binary file
|
data/Gemfile.lock
CHANGED
@@ -15,6 +15,8 @@ GEM
|
|
15
15
|
diff-lcs (1.3)
|
16
16
|
method_source (0.9.2)
|
17
17
|
mini_portile2 (2.4.0)
|
18
|
+
nokogiri (1.10.3-x64-mingw32)
|
19
|
+
mini_portile2 (~> 2.4.0)
|
18
20
|
nokogiri (1.10.3-x86-mingw32)
|
19
21
|
mini_portile2 (~> 2.4.0)
|
20
22
|
pry (0.12.2)
|
@@ -36,6 +38,7 @@ GEM
|
|
36
38
|
rspec-support (3.8.2)
|
37
39
|
|
38
40
|
PLATFORMS
|
41
|
+
x64-mingw32
|
39
42
|
x86-mingw32
|
40
43
|
|
41
44
|
DEPENDENCIES
|
@@ -46,4 +49,4 @@ DEPENDENCIES
|
|
46
49
|
rspec (~> 3.0)
|
47
50
|
|
48
51
|
BUNDLED WITH
|
49
|
-
2.0.
|
52
|
+
2.0.2
|
data/NOTES.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
<!-- NOTES.md -->
|
2
|
+
|
3
|
+
TODO:
|
4
|
+
|
5
|
+
1. Scrape premierleague.com/table - Scraper
|
6
|
+
2. Take data from scrape and save them as teams - Team builder
|
7
|
+
3. Create CLI using teams data - CLI
|
8
|
+
|
9
|
+
Scraper:
|
10
|
+
|
11
|
+
1. Scrape the website
|
12
|
+
2. Make sure it doesn't have to scrape more than once
|
13
|
+
|
14
|
+
Teams:
|
15
|
+
|
16
|
+
1. Get the scraped data from Scraper
|
17
|
+
2. Create the teams, with attributes, using the scraped data
|
18
|
+
3. Take the teams and put them in an easy to use list
|
19
|
+
|
20
|
+
CLI:
|
21
|
+
|
22
|
+
1. Greet the user and display the table
|
23
|
+
2. Tell user what options they have for input:
|
24
|
+
table, team number, exit
|
25
|
+
3. When user types table, show table again
|
26
|
+
4. When user types a team number, display information about that team only
|
27
|
+
5. When user types exit, show a thank you message and exit
|
28
|
+
|
29
|
+
Table Layout:
|
30
|
+
|
31
|
+
English Premier League Table:
|
32
|
+
1. Manchester City - 50 points
|
33
|
+
2. Manchester United - 48 points
|
34
|
+
3. Arsenal - 46 points
|
35
|
+
4. etc
|
36
|
+
|
37
|
+
Team Layout:
|
38
|
+
|
39
|
+
Team Name: Manchester City
|
40
|
+
Position: 1st place
|
41
|
+
Points: 50
|
42
|
+
etc
|
data/README.md
CHANGED
@@ -1,34 +1,22 @@
|
|
1
|
-
#
|
1
|
+
# epl
|
2
2
|
|
3
3
|
Hey there!
|
4
4
|
|
5
|
-
`epl` (short for cli_epl_gem) is a gem to view the current English Premier League table in your terminal. You can view the full table or check individual teams for more statistics.
|
5
|
+
`epl` (short for cli_epl_gem) is a ruby gem to view the current English Premier League (EPL) table in your terminal. You can view the full table or check individual teams for more statistics.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'cli_epl_table'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
9
|
+
Install this gem yourself as:
|
20
10
|
|
21
11
|
$ gem install cli_epl_table
|
22
12
|
|
23
13
|
## Usage
|
24
14
|
|
25
|
-
Once `cli_epl_table` is installed, all you have to do is
|
26
|
-
|
27
|
-
<!-- ## Development
|
15
|
+
Once `cli_epl_table` is installed, all you have to do is run the command:
|
28
16
|
|
29
|
-
|
17
|
+
$ epl
|
30
18
|
|
31
|
-
|
19
|
+
It will load up the current EPL table and you can explore from there.
|
32
20
|
|
33
21
|
## Contributing
|
34
22
|
|
data/bin/epl
ADDED
data/cli_epl_table.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
33
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
34
|
end
|
35
|
-
spec.bindir = "
|
35
|
+
spec.bindir = "bin"
|
36
36
|
spec.executables = "epl"
|
37
37
|
spec.require_paths = ["lib"]
|
38
38
|
|
data/lib/cli_epl_table.rb
CHANGED
data/lib/cli_epl_table/cli.rb
CHANGED
@@ -12,7 +12,7 @@ class CliEplTable::CLI
|
|
12
12
|
puts "English Premier League Table:".blue
|
13
13
|
# puts "1. Man City - points"
|
14
14
|
# puts "2. Man U - points"
|
15
|
-
@teams = CliEplTable::
|
15
|
+
@teams = CliEplTable::Team.all
|
16
16
|
@teams.each do |team|
|
17
17
|
puts "#{team.position}. ".yellow + "#{team.name}".blue + " - " + "#{team.points} points".red
|
18
18
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CliEplTable::Team
|
2
|
+
attr_accessor :position, :name, :points, :games_played, :games_won, :games_drawn, :games_lost, :goals_for, :goals_against, :goal_differential
|
3
|
+
@@all = []
|
4
|
+
|
5
|
+
# define all
|
6
|
+
def self.all
|
7
|
+
@@all
|
8
|
+
end
|
9
|
+
|
10
|
+
# init all teams with corresponding attributes from the scraped data
|
11
|
+
def initialize(data)
|
12
|
+
@position = data.css("span.value").text
|
13
|
+
@name = data.css("td.team span.long").text
|
14
|
+
@points = data.css("td.points").text
|
15
|
+
@games_played = data.css("td")[3].text
|
16
|
+
@games_won = data.css("td")[4].text
|
17
|
+
@games_drawn = data.css("td")[5].text
|
18
|
+
@games_lost = data.css("td")[6].text
|
19
|
+
@goals_for = data.css("td")[7].text
|
20
|
+
@goals_against = data.css("td")[8].text
|
21
|
+
@goal_differential = data.css("td")[9].text.strip
|
22
|
+
@@all << self
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cli_epl_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Cardle
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,20 +121,26 @@ files:
|
|
121
121
|
- ".gitignore"
|
122
122
|
- ".rspec"
|
123
123
|
- ".travis.yml"
|
124
|
+
- ".vs/VSWorkspaceState.json"
|
125
|
+
- ".vs/cli_epl_table/v15/.suo"
|
126
|
+
- ".vs/slnx.sqlite"
|
127
|
+
- ".vs/slnx.sqlite-journal"
|
124
128
|
- CODE_OF_CONDUCT.md
|
125
129
|
- Gemfile
|
126
130
|
- Gemfile.lock
|
127
131
|
- LICENSE.txt
|
132
|
+
- NOTES.md
|
128
133
|
- README.md
|
129
134
|
- Rakefile
|
130
135
|
- bin/console
|
136
|
+
- bin/epl
|
131
137
|
- bin/setup
|
132
138
|
- cli_epl_table.gemspec
|
133
|
-
- exe/epl
|
134
139
|
- lib/cli_epl_table.rb
|
135
140
|
- lib/cli_epl_table/cli.rb
|
136
141
|
- lib/cli_epl_table/scraper.rb
|
137
|
-
- lib/cli_epl_table/
|
142
|
+
- lib/cli_epl_table/sorter.rb
|
143
|
+
- lib/cli_epl_table/team.rb
|
138
144
|
- lib/cli_epl_table/version.rb
|
139
145
|
homepage: https://github.com/cdcardle/cli_epl_table
|
140
146
|
licenses:
|
@@ -158,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
164
|
version: '0'
|
159
165
|
requirements: []
|
160
166
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.7.6.2
|
162
168
|
signing_key:
|
163
169
|
specification_version: 4
|
164
170
|
summary: CLI Premier League table in your terminal!
|
data/exe/epl
DELETED
data/lib/cli_epl_table/teams.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
class CliEplTable::Teams
|
2
|
-
attr_accessor :name, :position, :games_played, :games_won, :games_drawn, :games_lost, :goals_for, :goals_against, :goal_differential, :points
|
3
|
-
@@all = []
|
4
|
-
|
5
|
-
# define all
|
6
|
-
def self.all
|
7
|
-
@@all
|
8
|
-
end
|
9
|
-
|
10
|
-
# list of teams created by scraping only once
|
11
|
-
def self.list
|
12
|
-
self.teams unless self.all.length > 0
|
13
|
-
self.all
|
14
|
-
end
|
15
|
-
|
16
|
-
# get data from CliEplTable::Scraper
|
17
|
-
def self.data
|
18
|
-
CliEplTable::Scraper.scrape_site
|
19
|
-
end
|
20
|
-
|
21
|
-
# use data to create an array of teams with their attributes
|
22
|
-
def self.teams
|
23
|
-
teams = self.data.search('tbody tr[data-compseason="274"]')
|
24
|
-
|
25
|
-
team_array = []
|
26
|
-
teams.each {|team| team_array << team}
|
27
|
-
team_array.each do |team|
|
28
|
-
new_team = self.new
|
29
|
-
new_team.position = team.css("span.value").text
|
30
|
-
new_team.name = team.css("td.team span.long").text
|
31
|
-
new_team.points = team.css("td.points").text
|
32
|
-
new_team.games_played = team.css("td")[3].text
|
33
|
-
new_team.games_won = team.css("td")[4].text
|
34
|
-
new_team.games_drawn = team.css("td")[5].text
|
35
|
-
new_team.games_lost = team.css("td")[6].text
|
36
|
-
new_team.goals_for = team.css("td")[7].text
|
37
|
-
new_team.goals_against = team.css("td")[8].text
|
38
|
-
new_team.goal_differential = team.css("td")[9].text.strip
|
39
|
-
self.all << new_team
|
40
|
-
new_team
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|