football_cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +63 -0
- data/README.MD +47 -0
- data/Rakefile +13 -0
- data/bin/football_cli +63 -0
- data/config/leagues.json +176 -0
- data/config/teams.json +2252 -0
- data/football_cli.gemspec +31 -0
- data/lib/football_cli/format/base.rb +53 -0
- data/lib/football_cli/format/csv.rb +30 -0
- data/lib/football_cli/format/format_factory.rb +19 -0
- data/lib/football_cli/format/json.rb +30 -0
- data/lib/football_cli/format/table.rb +34 -0
- data/lib/football_cli/handler.rb +128 -0
- data/lib/football_cli/mapper.rb +39 -0
- data/lib/football_cli/version.rb +3 -0
- data/lib/football_cli.rb +2 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 58219e8aab1ab9688cbf93a1083c4737c156b3b3
|
4
|
+
data.tar.gz: 23ab61c8f5d6a993413a02d1cce0af3bc1b262df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 79ef3aec153d5795925794e4463d99aab7571621c0077505df91b53f10834fd5657ed60204ca7b71aa8c511ce5f468413b9cf6a92c047cd4b3607c34fcb95b4f
|
7
|
+
data.tar.gz: 3f7c08195245180b9d6a0a49dd26a37b7d15cd9ced9153ff7a689f3f94a8d5dcd8d04053f72b40f5c715482e47578c2df43e76139d448aa3059fbe459ec34823
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
tmp
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.0@football_cli
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
football_cli (0.0.1)
|
5
|
+
football_ruby (~> 0)
|
6
|
+
gli (= 2.16.0)
|
7
|
+
rainbow
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
aruba (0.14.2)
|
13
|
+
childprocess (~> 0.5.6)
|
14
|
+
contracts (~> 0.9)
|
15
|
+
cucumber (>= 1.3.19)
|
16
|
+
ffi (~> 1.9.10)
|
17
|
+
rspec-expectations (>= 2.99)
|
18
|
+
thor (~> 0.19)
|
19
|
+
builder (3.2.3)
|
20
|
+
childprocess (0.5.9)
|
21
|
+
ffi (~> 1.0, >= 1.0.11)
|
22
|
+
contracts (0.16.0)
|
23
|
+
cucumber (2.4.0)
|
24
|
+
builder (>= 2.1.2)
|
25
|
+
cucumber-core (~> 1.5.0)
|
26
|
+
cucumber-wire (~> 0.0.1)
|
27
|
+
diff-lcs (>= 1.1.3)
|
28
|
+
gherkin (~> 4.0)
|
29
|
+
multi_json (>= 1.7.5, < 2.0)
|
30
|
+
multi_test (>= 0.1.2)
|
31
|
+
cucumber-core (1.5.0)
|
32
|
+
gherkin (~> 4.0)
|
33
|
+
cucumber-wire (0.0.1)
|
34
|
+
diff-lcs (1.3)
|
35
|
+
ffi (1.9.18)
|
36
|
+
football_ruby (0.1.0)
|
37
|
+
gherkin (4.1.1)
|
38
|
+
gli (2.16.0)
|
39
|
+
multi_json (1.12.1)
|
40
|
+
multi_test (0.1.2)
|
41
|
+
rainbow (2.2.2)
|
42
|
+
rake
|
43
|
+
rake (12.0.0)
|
44
|
+
rspec-expectations (3.5.0)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.5.0)
|
47
|
+
rspec-support (3.5.0)
|
48
|
+
terminal-table (1.7.3)
|
49
|
+
unicode-display_width (~> 1.1.1)
|
50
|
+
thor (0.19.4)
|
51
|
+
unicode-display_width (1.1.3)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
aruba
|
58
|
+
football_cli!
|
59
|
+
rake
|
60
|
+
terminal-table
|
61
|
+
|
62
|
+
BUNDLED WITH
|
63
|
+
1.14.6
|
data/README.MD
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
![](http://i.imgur.com/FLITgqs.jpg)
|
2
|
+
|
3
|
+
# Fottball CLI
|
4
|
+
|
5
|
+
A command line interface for all the football data feeds in Ruby Edit
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
$ gem install football_ruby
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Help
|
14
|
+
$ bundle exec bin/football_cli help
|
15
|
+
### Show league table
|
16
|
+
$ bundle exec bin/football_cli show --league=PD
|
17
|
+
### Show league table for a given day
|
18
|
+
$ bundle exec bin/football_cli show --league=PD --match_day=1
|
19
|
+
### Show team players
|
20
|
+
$ bundle exec bin/football_cli show --team=FCB --players
|
21
|
+
### Show team fixtures
|
22
|
+
$ bundle exec bin/football_cli show --team=FCB --fixtures
|
23
|
+
### Show the output in csv or json
|
24
|
+
$ bundle exec bin/football_cli show --league=PD --format=json
|
25
|
+
$ bundle exec bin/football_cli show --league=PD --format=csv
|
26
|
+
### Save the output in a file
|
27
|
+
$ bundle exec bin/football_cli show --league=PD --format=json --file=leagues.json
|
28
|
+
$ bundle exec bin/football_cli show --league=PD --format=csv --file=leagues.csv
|
29
|
+
### Show live scores
|
30
|
+
$ bundle exec bin/football_cli live
|
31
|
+
|
32
|
+
## Demo
|
33
|
+
|
34
|
+
### League table
|
35
|
+
![](http://i.imgur.com/lsxa1Zw.png)
|
36
|
+
### League table for a given day
|
37
|
+
![](http://i.imgur.com/PnMVy1o.png)
|
38
|
+
### Team players
|
39
|
+
![](http://i.imgur.com/SUthQEx.png)
|
40
|
+
|
41
|
+
## Todo
|
42
|
+
|
43
|
+
1. Make api_token configurable
|
44
|
+
2. Improve error handling
|
45
|
+
3. Add more cucumber features
|
46
|
+
4. And more ...
|
47
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake/task'
|
6
|
+
|
7
|
+
spec = eval(File.read('football_cli.gemspec'))
|
8
|
+
|
9
|
+
Gem::PackageTask.new(spec) do |pkg|
|
10
|
+
end
|
11
|
+
|
12
|
+
task :cucumber => :features
|
13
|
+
task :default => [:features]
|
data/bin/football_cli
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'football_cli'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
|
7
|
+
program_desc 'Football scores for geeks.'
|
8
|
+
|
9
|
+
version FootballCli::VERSION
|
10
|
+
|
11
|
+
subcommand_option_handling :normal
|
12
|
+
arguments :strict
|
13
|
+
|
14
|
+
desc 'Show leagues, team players, fixtures and more'
|
15
|
+
command :show do |c|
|
16
|
+
c.desc 'Specify league code'
|
17
|
+
c.flag [:l, :league]
|
18
|
+
|
19
|
+
c.desc 'Specify match day'
|
20
|
+
c.flag [:md, :match_day]
|
21
|
+
|
22
|
+
c.desc 'Specify team code'
|
23
|
+
c.flag [:t, :team]
|
24
|
+
|
25
|
+
c.desc 'Specify format'
|
26
|
+
c.flag [:ft, :format]
|
27
|
+
|
28
|
+
c.desc 'Specify file name to save output'
|
29
|
+
c.flag [:fl, :file]
|
30
|
+
|
31
|
+
c.switch [:p, :players]
|
32
|
+
c.switch [:fs, :fixtures]
|
33
|
+
|
34
|
+
c.action do |global_options, options, args|
|
35
|
+
@handler.run
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'Display live scores'
|
40
|
+
command :live do |c|
|
41
|
+
c.action do |global_options,options,args|
|
42
|
+
@handler.run
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
pre do |global,command,options,args|
|
47
|
+
@handler = FootballCli::Handler.new(command.name, options)
|
48
|
+
end
|
49
|
+
|
50
|
+
post do |global,command,options,args|
|
51
|
+
# Post logic here
|
52
|
+
# Use skips_post before a command to skip this
|
53
|
+
# block on that command only
|
54
|
+
end
|
55
|
+
|
56
|
+
on_error do |exception|
|
57
|
+
# Error logic here
|
58
|
+
# return false to skip default error handling
|
59
|
+
puts "----- backtrace: #{exception.backtrace}"
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
exit run(ARGV)
|
data/config/leagues.json
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 424,
|
4
|
+
"caption": "European Championships France 2016",
|
5
|
+
"league": "EC",
|
6
|
+
"year": "2016"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
"id": 426,
|
10
|
+
"caption": "Premier League 2016/17",
|
11
|
+
"league": "PL",
|
12
|
+
"year": "2016",
|
13
|
+
"qualification": {
|
14
|
+
"cl": [1, 4],
|
15
|
+
"el": [5, 6],
|
16
|
+
"rl": [18, 20]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"id": 427,
|
21
|
+
"caption": "Championship 2016/17",
|
22
|
+
"league": "ELC",
|
23
|
+
"year": "2016",
|
24
|
+
"qualification": {
|
25
|
+
"cl": [1, 2],
|
26
|
+
"el": [3, 6],
|
27
|
+
"rl": [22, 24]
|
28
|
+
}
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": 428,
|
32
|
+
"caption": "League One 2016/17",
|
33
|
+
"league": "EL1",
|
34
|
+
"year": "2016",
|
35
|
+
"qualification": {
|
36
|
+
"cl": [1, 2],
|
37
|
+
"el": [3, 6],
|
38
|
+
"rl": [21, 24]
|
39
|
+
}
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"id": 429,
|
43
|
+
"caption": "FA-Cup 2016/17",
|
44
|
+
"league": "FAC",
|
45
|
+
"year": "2016"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"id": 430,
|
49
|
+
"caption": "1. Bundesliga 2016/17",
|
50
|
+
"league": "BL1",
|
51
|
+
"year": "2016",
|
52
|
+
"qualification": {
|
53
|
+
"cl": [1, 4],
|
54
|
+
"el": [5, 6],
|
55
|
+
"rl": [17, 18]
|
56
|
+
}
|
57
|
+
},
|
58
|
+
{
|
59
|
+
"id": 431,
|
60
|
+
"caption": "2. Bundesliga 2016/17",
|
61
|
+
"league": "BL2",
|
62
|
+
"year": "2016",
|
63
|
+
"qualification": {
|
64
|
+
"cl": [1, 2],
|
65
|
+
"el": [3, 3],
|
66
|
+
"rl": [16, 18]
|
67
|
+
}
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"id": 432,
|
71
|
+
"caption": "DFB-Pokal 2016/17",
|
72
|
+
"league": "DFB",
|
73
|
+
"year": "2016"
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"id": 433,
|
77
|
+
"caption": "Eredivisie 2016/17",
|
78
|
+
"league": "DED",
|
79
|
+
"year": "2016",
|
80
|
+
"qualification": {
|
81
|
+
"cl": [1, 2],
|
82
|
+
"el": [3, 5],
|
83
|
+
"rl": [16, 18]
|
84
|
+
}
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"id": 434,
|
88
|
+
"caption": "Ligue 1 2016/17",
|
89
|
+
"league": "FL1",
|
90
|
+
"year": "2016",
|
91
|
+
"qualification": {
|
92
|
+
"cl": [1, 3],
|
93
|
+
"el": [4, 5],
|
94
|
+
"rl": [18, 20]
|
95
|
+
}
|
96
|
+
},
|
97
|
+
{
|
98
|
+
"id": 435,
|
99
|
+
"caption": "Ligue 2 2016/17",
|
100
|
+
"league": "FL2",
|
101
|
+
"year": "2016",
|
102
|
+
"qualification": {
|
103
|
+
"cl": [1, 3],
|
104
|
+
"el": [0, 0],
|
105
|
+
"rl": [18, 20]
|
106
|
+
}
|
107
|
+
},
|
108
|
+
{
|
109
|
+
"id": 436,
|
110
|
+
"caption": "Primera Division 2016/17",
|
111
|
+
"league": "PD",
|
112
|
+
"year": "2016",
|
113
|
+
"qualification": {
|
114
|
+
"cl": [1, 4],
|
115
|
+
"el": [5, 6],
|
116
|
+
"rl": [18, 20]
|
117
|
+
}
|
118
|
+
},
|
119
|
+
{
|
120
|
+
"id": 437,
|
121
|
+
"caption": "Liga Adelante 2016/17",
|
122
|
+
"league": "SD",
|
123
|
+
"year": "2016",
|
124
|
+
"qualification": {
|
125
|
+
"cl": [1, 2],
|
126
|
+
"el": [3, 6],
|
127
|
+
"rl": [19, 22]
|
128
|
+
}
|
129
|
+
},
|
130
|
+
{
|
131
|
+
"id": 438,
|
132
|
+
"caption": "Serie A 2016/17",
|
133
|
+
"league": "SA",
|
134
|
+
"year": "2016",
|
135
|
+
"qualification": {
|
136
|
+
"cl": [1, 3],
|
137
|
+
"el": [4, 5],
|
138
|
+
"rl": [18, 20]
|
139
|
+
}
|
140
|
+
},
|
141
|
+
{
|
142
|
+
"id": 439,
|
143
|
+
"caption": "Primeira Liga 2016/17",
|
144
|
+
"league": "PPL",
|
145
|
+
"year": "2016",
|
146
|
+
"qualification": {
|
147
|
+
"cl": [1, 3],
|
148
|
+
"el": [4, 5],
|
149
|
+
"rl": [15, 18]
|
150
|
+
}
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"id": 440,
|
154
|
+
"caption": "Champions League 2016/17",
|
155
|
+
"league": "CL",
|
156
|
+
"year": "2016"
|
157
|
+
},
|
158
|
+
{
|
159
|
+
"id": 441,
|
160
|
+
"caption": "Serie B",
|
161
|
+
"league": "SB",
|
162
|
+
"year": "2016"
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"id": 442,
|
166
|
+
"caption": "English National League",
|
167
|
+
"league": "ENL",
|
168
|
+
"year": "2016"
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"id": 443,
|
172
|
+
"caption": "League Two",
|
173
|
+
"league": "EL2",
|
174
|
+
"year": "2016"
|
175
|
+
}
|
176
|
+
]
|