footty 0.3.0 → 0.4.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 +4 -4
- data/Manifest.txt +10 -10
- data/README.md +9 -8
- data/lib/footty.rb +47 -13
- data/lib/footty/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9e350f6c69753563babe7b6313e990333d20f8a
|
4
|
+
data.tar.gz: 9abbd3a090529c2d6dceb8f5cb4a30c09032885a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb986e01c99f9ce33b1ebb04e321af30c85570967c42a046029c3c70726a57e38a56a8f217792959cebe9d59313962407af8ca54a07c4a2af07f422812751ad
|
7
|
+
data.tar.gz: dae5fdad18c6f894f01e991d5bc0db5f9345fbde968edf3d42b4f3407c79a31e2678af30269d2b24d67b419e1d8f1602d6a856bad70828aa0c08b87f93d31979
|
data/Manifest.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
HISTORY.md
|
2
|
-
Manifest.txt
|
3
|
-
README.md
|
4
|
-
Rakefile
|
5
|
-
bin/footty
|
6
|
-
lib/footty.rb
|
7
|
-
lib/footty/client.rb
|
8
|
-
lib/footty/version.rb
|
9
|
-
test/helper.rb
|
10
|
-
test/test_client.rb
|
1
|
+
HISTORY.md
|
2
|
+
Manifest.txt
|
3
|
+
README.md
|
4
|
+
Rakefile
|
5
|
+
bin/footty
|
6
|
+
lib/footty.rb
|
7
|
+
lib/footty/client.rb
|
8
|
+
lib/footty/version.rb
|
9
|
+
test/helper.rb
|
10
|
+
test/test_client.rb
|
data/README.md
CHANGED
@@ -19,20 +19,21 @@ for upcoming or past matches. For example:
|
|
19
19
|
|
20
20
|
prints on Jun/14 2018:
|
21
21
|
|
22
|
-
#1 Thu Jun/14 Russia (RUS)
|
22
|
+
#1 Thu Jun/14 Russia (RUS) 5-0 Saudi Arabia (KSA) Group A @ Luzhniki Stadium, Moscow
|
23
|
+
[Gazinsky 12' Cheryshev 43' Dzyuba 71' Cheryshev 90+1' Golovin 90+4']
|
23
24
|
|
24
25
|
prints on Jun/15 2018:
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
#2 Fri Jun/15 Egypt (EGY) vs Uruguay (URU) Group A @ Ekaterinburg Arena, Ekaterinburg
|
28
|
+
#3 Fri Jun/15 Portugal (POR) vs Spain (ESP) Group B @ Fisht Stadium, Sochi
|
29
|
+
#4 Fri Jun/15 Morocco (MAR) vs Iran (IRN) Group B @ Saint Petersburg Stadium, Saint Petersburg
|
29
30
|
|
30
31
|
prints on Jun/16:
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
#5 Sat Jun/16 France (FRA) vs Australia (AUS) Group C @ Kazan Arena, Kazan
|
34
|
+
#6 Sat Jun/16 Peru (PER) vs Denmark (DEN) Group C @ Mordovia Arena, Saransk
|
35
|
+
#7 Sat Jun/16 Argentina (ARG) vs Iceland (ISL) Group D @ Spartak Stadium, Moscow
|
36
|
+
#8 Sat Jun/16 Croatia (CRO) vs Nigeria (NGA) Group D @ Kaliningrad Stadium, Kaliningrad
|
36
37
|
|
37
38
|
and so on.
|
38
39
|
Use `tomorrow` or `t` or `+1` to print tomorrow's matches e.g.:
|
data/lib/footty.rb
CHANGED
@@ -39,27 +39,27 @@ module Footty
|
|
39
39
|
today = Date.today
|
40
40
|
|
41
41
|
if ['yesterday', 'y', '-1'].include? what
|
42
|
-
matches = client.
|
42
|
+
matches = client.get_yesterdays_matches
|
43
43
|
if matches.empty?
|
44
44
|
puts "** No matches played yesterday.\n"
|
45
45
|
end
|
46
46
|
elsif ['tomorrow', 't', '+1', '1'].include? what
|
47
|
-
matches = client.get_tomorrows_matches
|
47
|
+
matches = client.get_tomorrows_matches
|
48
48
|
if matches.empty?
|
49
49
|
puts "** No matches scheduled tomorrow.\n"
|
50
50
|
end
|
51
51
|
elsif ['past', 'p', 'prev'].include? what
|
52
|
-
matches = client.get_past_matches
|
52
|
+
matches = client.get_past_matches
|
53
53
|
if matches.empty?
|
54
54
|
puts "** No matches played yet.\n"
|
55
55
|
end
|
56
56
|
elsif ['upcoming', 'up', 'u', 'next', 'n'].include? what
|
57
|
-
matches = client.get_upcoming_matches
|
57
|
+
matches = client.get_upcoming_matches
|
58
58
|
if matches.empty?
|
59
59
|
puts "** No more matches scheduled.\n"
|
60
60
|
end
|
61
61
|
else
|
62
|
-
matches = client.get_todays_matches
|
62
|
+
matches = client.get_todays_matches
|
63
63
|
|
64
64
|
## no matches today
|
65
65
|
if matches.empty?
|
@@ -67,10 +67,10 @@ module Footty
|
|
67
67
|
|
68
68
|
if Date.today > Date.new( 2018, 7, 11 ) ## world cup is over, look back
|
69
69
|
puts "Past matches:"
|
70
|
-
matches = client.get_past_matches
|
70
|
+
matches = client.get_past_matches
|
71
71
|
else ## world cup is upcoming /in-progress,look forward
|
72
72
|
puts "Upcoming matches:"
|
73
|
-
matches = client.get_upcoming_matches
|
73
|
+
matches = client.get_upcoming_matches
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -86,19 +86,24 @@ module Footty
|
|
86
86
|
today = Date.today
|
87
87
|
|
88
88
|
matches.each do |match|
|
89
|
-
print " "
|
90
|
-
print "\##{match['num']} "
|
89
|
+
print " %5s" % "\##{match['num']} "
|
91
90
|
|
92
91
|
date = Date.parse( match['date'] )
|
93
92
|
print "#{date.strftime('%a %b/%d')} " ## e.g. Thu Jun/14
|
94
93
|
if date > today
|
95
94
|
diff = (date - today).to_i
|
96
|
-
print "(in #{diff}d) "
|
95
|
+
print "%10s" % "(in #{diff}d) "
|
97
96
|
end
|
98
97
|
|
99
|
-
print "%
|
100
|
-
|
101
|
-
|
98
|
+
print "%20s" % "#{match['team1']['name']} (#{match['team1']['code']})"
|
99
|
+
|
100
|
+
if match['score1'] && match['score2']
|
101
|
+
print " #{match['score1']}-#{match['score2']} "
|
102
|
+
else
|
103
|
+
print " vs "
|
104
|
+
end
|
105
|
+
|
106
|
+
print "%20s" % "#{match['team2']['name']} (#{match['team2']['code']})"
|
102
107
|
|
103
108
|
if match['group']
|
104
109
|
print " #{match['group']} " ## group phase/stage
|
@@ -108,6 +113,35 @@ module Footty
|
|
108
113
|
|
109
114
|
print " @ #{match['stadium']['name']}, #{match['city']}"
|
110
115
|
print "\n"
|
116
|
+
|
117
|
+
if match['goals1'] && match['goals2']
|
118
|
+
print " ["
|
119
|
+
match['goals1'].each_with_index do |goal,i|
|
120
|
+
print " " if i > 0
|
121
|
+
print "#{goal['name']}"
|
122
|
+
print " #{goal['minute']}"
|
123
|
+
print "+#{goal['offset']}" if goal['offset']
|
124
|
+
print "'"
|
125
|
+
print " (o.g.)" if goal['owngoal']
|
126
|
+
print " (pen.)" if goal['penalty']
|
127
|
+
end
|
128
|
+
match['goals2'].each_with_index do |goal,i|
|
129
|
+
if i == 0
|
130
|
+
print "; "
|
131
|
+
else
|
132
|
+
print " "
|
133
|
+
end
|
134
|
+
print "#{goal['name']}"
|
135
|
+
print " #{goal['minute']}"
|
136
|
+
print "+#{goal['offset']}" if goal['offset']
|
137
|
+
print "'"
|
138
|
+
print " (o.g.)" if goal['owngoal']
|
139
|
+
print " (pen.)" if goal['penalty']
|
140
|
+
end
|
141
|
+
print "]\n"
|
142
|
+
end
|
143
|
+
|
144
|
+
|
111
145
|
end
|
112
146
|
end
|
113
147
|
|
data/lib/footty/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: footty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logutils
|