sportdb-writers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0bf61e140b088804628afc2351b7b9a32975cd75
4
+ data.tar.gz: cefaf1da69870273c3eeb7130e96c943ddf29d05
5
+ SHA512:
6
+ metadata.gz: 6102adb9c492d1cfe1d4d112bd4385524d78a9feaaed47cb058ca45f1db25d94d2c97e2806f75e4531a845cb6b1aba963e3f491b7465f13d2a2efc06bba8b63f
7
+ data.tar.gz: de627bc67581498ccb674e23f9c68977cfd20363d8118788ab9554531cc77f158c3e949ede70c2f6f25e3f60a387710ea4572c70382d7c67c985cfdb40aefd1c
@@ -0,0 +1,4 @@
1
+ ### 0.0.1 / 2020-11-15
2
+
3
+ * Everything is new. First release.
4
+
@@ -0,0 +1,21 @@
1
+ CHANGELOG.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ lib/sportdb/leagues/leagues_at.rb
6
+ lib/sportdb/leagues/leagues_de.rb
7
+ lib/sportdb/leagues/leagues_eng.rb
8
+ lib/sportdb/leagues/leagues_es.rb
9
+ lib/sportdb/leagues/leagues_europe.rb
10
+ lib/sportdb/leagues/leagues_it.rb
11
+ lib/sportdb/leagues/leagues_mx.rb
12
+ lib/sportdb/leagues/leagues_south_america.rb
13
+ lib/sportdb/leagues/leagues_world.rb
14
+ lib/sportdb/writers.rb
15
+ lib/sportdb/writers/config.rb
16
+ lib/sportdb/writers/txt_writer.rb
17
+ lib/sportdb/writers/version.rb
18
+ lib/sportdb/writers/write.rb
19
+ test/helper.rb
20
+ test/test_txt_writer.rb
21
+ test/test_version.rb
@@ -0,0 +1,28 @@
1
+ # sportdb-writers - sport.db writers for match schedules and results, and more
2
+
3
+ * home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
4
+ * bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
5
+ * gem :: [rubygems.org/gems/sportdb-writers](https://rubygems.org/gems/sportdb-writers)
6
+ * rdoc :: [rubydoc.info/gems/sportdb-writers](http://rubydoc.info/gems/sportdb-writers)
7
+ * forum :: [groups.google.com/group/opensport](https://groups.google.com/group/opensport)
8
+
9
+
10
+
11
+ ## Usage
12
+
13
+ To be done
14
+
15
+
16
+ ## License
17
+
18
+ ![](https://publicdomainworks.github.io/buttons/zero88x31.png)
19
+
20
+ The `sportdb-writers` scripts are dedicated to the public domain.
21
+ Use it as you please with no restrictions whatsoever.
22
+
23
+
24
+ ## Questions? Comments?
25
+
26
+ Send them along to the
27
+ [Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
28
+ Thanks!
@@ -0,0 +1,30 @@
1
+ require 'hoe'
2
+ require './lib/sportdb/writers/version.rb'
3
+
4
+ Hoe.spec 'sportdb-writers' do
5
+
6
+ self.version = SportDb::Module::Writers::VERSION
7
+
8
+ self.summary = 'sportdb-writers - sport.db writers for match schedules and results, and more'
9
+ self.description = summary
10
+
11
+ self.urls = { home: 'https://github.com/sportdb/sport.db' }
12
+
13
+ self.author = 'Gerald Bauer'
14
+ self.email = 'opensport@googlegroups.com'
15
+
16
+ # switch extension to .markdown for gihub formatting
17
+ self.readme_file = 'README.md'
18
+ self.history_file = 'CHANGELOG.md'
19
+
20
+ self.extra_deps = [
21
+ ['sportdb-catalogs', '>= 1.0.0'],
22
+ ]
23
+
24
+ self.licenses = ['Public Domain']
25
+
26
+ self.spec_extras = {
27
+ required_ruby_version: '>= 2.2.2'
28
+ }
29
+
30
+ end
@@ -0,0 +1,39 @@
1
+ module Writer
2
+
3
+ ########################
4
+ # Austria
5
+
6
+ LEAGUES.merge!(
7
+ 'at.1' => { name: 'Österr. Bundesliga',
8
+ basename: '1-bundesliga',
9
+ path: 'austria',
10
+ lang: 'de_AT',
11
+ stages: ->(season) {
12
+ if season.start_year >= 2018
13
+ [['Grunddurchgang'],
14
+ ['Finaldurchgang - Meister',
15
+ 'Finaldurchgang - Qualifikation',
16
+ 'Europa League Play-off']]
17
+ else
18
+ nil
19
+ end
20
+ },
21
+ },
22
+ 'at.2' => { name: ->(season) { season.start_year >= 2018 ? 'Österr. 2. Liga' : 'Österr. Erste Liga' },
23
+ basename: ->(season) { season.start_year >= 2018 ? '2-liga2' : '2-liga1' },
24
+ path: 'austria',
25
+ lang: 'de_AT',
26
+ },
27
+ 'at.3.o' => { name: 'Österr. Regionalliga Ost',
28
+ basename: '3-regionalliga-ost',
29
+ path: 'austria',
30
+ lang: 'de_AT',
31
+ },
32
+ 'at.cup' => { name: 'ÖFB Cup',
33
+ basename: 'cup',
34
+ path: 'austria',
35
+ lang: 'de_AT',
36
+ }
37
+ )
38
+
39
+ end # module Writer
@@ -0,0 +1,29 @@
1
+ module Writer
2
+
3
+ ############################
4
+ # Germany / Deutschland
5
+
6
+ LEAGUES.merge!(
7
+ 'de.1' => { name: 'Deutsche Bundesliga',
8
+ basename: '1-bundesliga',
9
+ path: 'deutschland',
10
+ lang: 'de_DE',
11
+ },
12
+ 'de.2' => { name: 'Deutsche 2. Bundesliga',
13
+ basename: '2-bundesliga2',
14
+ path: 'deutschland',
15
+ lang: 'de_DE',
16
+ },
17
+ 'de.3' => { name: 'Deutsche 3. Liga',
18
+ basename: '3-liga3',
19
+ path: 'deutschland',
20
+ lang: 'de_DE',
21
+ },
22
+ 'de.cup' => { name: 'DFB Pokal',
23
+ basename: 'cup',
24
+ path: 'deutschland',
25
+ lang: 'de_DE',
26
+ }
27
+ )
28
+
29
+ end # module Writer
@@ -0,0 +1,70 @@
1
+ module Writer
2
+
3
+ ####################
4
+ # England
5
+
6
+
7
+ def self.eng1( season )
8
+ case season ## todo/fix: - use cast e.g. Season(season) - make sure it's a season obj
9
+ when Season('1888/89')..Season('1891/92') ## single league (no divisions)
10
+ {name: 'English Football League',
11
+ basename: '1-footballleague'}
12
+ when Season('1892/93')..Season('1991/92') ## start of division 1 & 2
13
+ {name: 'English Division One',
14
+ basename: '1-division1'}
15
+ else ## starts in season 1992/93
16
+ {name: 'English Premier League',
17
+ basename: '1-premierleague'}
18
+ end
19
+ end
20
+
21
+ def self.eng2( season )
22
+ case season
23
+ when Season('1892/93')..Season('1991/92')
24
+ {name: 'English Division Two', ## or use English Football League Second Division ???
25
+ basename: '2-division2'}
26
+ when Season('1992/93')..Season('2003/04') ## start of premier league
27
+ {name: 'English Division One',
28
+ basename: '2-division1'}
29
+ else # starts in 2004/05
30
+ {name: 'English Championship', ## rebranding divsion 1 => championship
31
+ basename: '2-championship'}
32
+ end
33
+ end
34
+
35
+
36
+ LEAGUES.merge!(
37
+ 'eng.1' => { name: ->(season) { eng1( season )[ :name ] },
38
+ basename: ->(season) { eng1( season )[ :basename ] },
39
+ path: 'england',
40
+ lang: 'en',
41
+ },
42
+ 'eng.2' => { name: ->(season) { eng2( season )[ :name ] },
43
+ basename: ->(season) { eng2( season )[ :basename ] },
44
+ path: 'england',
45
+ lang: 'en',
46
+ },
47
+ 'eng.3' => { name: 'English League One',
48
+ basename: '3-league1',
49
+ path: 'england',
50
+ lang: 'en',
51
+ },
52
+ 'eng.4' => { name: 'English League Two',
53
+ basename: '4-league2',
54
+ path: 'england',
55
+ lang: 'en',
56
+ },
57
+ 'eng.5' => { name: 'English National League',
58
+ basename: '5-nationalleague',
59
+ path: 'england',
60
+ lang: 'en',
61
+ },
62
+ 'eng.cup' => { name: 'English FA Cup',
63
+ basename: 'facup',
64
+ path: 'england',
65
+ lang: 'en',
66
+ }
67
+ )
68
+
69
+ end # module Writer
70
+
@@ -0,0 +1,19 @@
1
+ module Writer
2
+
3
+ LEAGUES.merge!(
4
+ ###################
5
+ # Spain / Espana
6
+ 'es.1' => { name: 'Primera División de España',
7
+ basename: '1-liga',
8
+ path: 'espana',
9
+ lang: 'es',
10
+ },
11
+ 'es.2' => { name: 'Segunda División de España',
12
+ basename: '2-liga2',
13
+ path: 'espana',
14
+ lang: 'es',
15
+ },
16
+ )
17
+
18
+ end # module Writer
19
+
@@ -0,0 +1,213 @@
1
+ module Writer
2
+
3
+ LEAGUES.merge!(
4
+
5
+ ########################
6
+ # France
7
+ 'fr.1' => { name: 'French Ligue 1',
8
+ basename: '1-ligue1',
9
+ path: 'europe/france',
10
+ lang: 'fr',
11
+ },
12
+ 'fr.2' => { name: 'French Ligue 2',
13
+ basename: '2-ligue2',
14
+ path: 'europe/france',
15
+ lang: 'fr',
16
+ },
17
+
18
+ 'hu.1' => { name: 'Hungarian NB I',
19
+ basename: '1-nbi',
20
+ path: 'europe/hungary',
21
+ },
22
+ 'gr.1' => { name: 'Super League Greece',
23
+ basename: '1-superleague',
24
+ path: 'europe/greece',
25
+ stages: ->(season) {
26
+ if season.start_year >= 2019 # new league system starting with 2015/16 season
27
+ [['Regular Season'],
28
+ ['Playoffs - Championship',
29
+ 'Playoffs - Relegation']]
30
+ elsif [2017,2018].include?( season.start_year ) ## 2017/18, 2018/19
31
+ nil
32
+ elsif [2013,2014,2015,2016].include?( season.start_year )
33
+ [['Regular Season'],
34
+ ['Playoffs']]
35
+ elsif season.start_year == 2012
36
+ [['Regular Season'],
37
+ ['Playoffs',
38
+ 'Match 6th Place']]
39
+ elsif [2010,2011].include?( season.start_year )
40
+ [['Regular Season'],
41
+ ['Playoffs']]
42
+ else
43
+ nil
44
+ end
45
+ },
46
+ },
47
+
48
+ 'pt.1' => { name: 'Portuguese Primeira Liga',
49
+ basename: '1-primeiraliga',
50
+ path: 'europe/portugal',
51
+ lang: 'pt_PT',
52
+ },
53
+ 'pt.2' => { name: 'Portuguese Segunda Liga',
54
+ basename: '2-segundaliga',
55
+ path: 'europe/portugal',
56
+ lang: 'pt_PT',
57
+ },
58
+
59
+ 'ch.1' => { name: 'Swiss Super League',
60
+ basename: '1-superleague',
61
+ path: 'europe/switzerland',
62
+ lang: 'de_CH',
63
+ },
64
+ 'ch.2' => { name: 'Swiss Challenge League',
65
+ basename: '2-challengeleague',
66
+ path: 'europe/switzerland',
67
+ lang: 'de_CH',
68
+ },
69
+ 'tr.1' => { name: 'Turkish Süper Lig',
70
+ basename: '1-superlig',
71
+ path: 'europe/turkey',
72
+ },
73
+ 'tr.2' => { name: 'Turkish 1. Lig',
74
+ basename: '2-lig1',
75
+ path: 'europe/turkey',
76
+ },
77
+
78
+
79
+ 'is.1' => { name: 'Iceland Urvalsdeild',
80
+ basename: '1-urvalsdeild',
81
+ path: 'europe/iceland',
82
+ },
83
+ 'sco.1' => { name: 'Scottish Premiership',
84
+ basename: '1-premiership',
85
+ path: 'europe/scotland',
86
+ stages: [['Regular Season'],
87
+ ['Playoffs - Championship',
88
+ 'Playoffs - Relegation' ]]
89
+ },
90
+ 'ie.1' => { name: 'Irish Premier Division',
91
+ basename: '1-premierdivision',
92
+ path: 'europe/ireland',
93
+ },
94
+
95
+ 'fi.1' => { name: 'Finland Veikkausliiga', ## note: make optional!!! override here (otherwise (re)use "regular" lookup "canonical" name from league!!!)
96
+ basename: '1-veikkausliiga',
97
+ path: 'europe/finland',
98
+ stages: [['Regular Season'],
99
+ ['Playoffs - Championship',
100
+ 'Playoffs - Challenger',
101
+ 'Europa League Finals' ]]
102
+ },
103
+ 'se.1' => { name: 'Sweden Allsvenskan',
104
+ basename: '1-allsvenskan',
105
+ path: 'europe/sweden',
106
+ },
107
+ 'se.2' => { name: 'Sweden Superettan',
108
+ basename: '2-superettan',
109
+ path: 'europe/sweden',
110
+ },
111
+ 'no.1' => { name: 'Norwegian Eliteserien',
112
+ basename: '1-eliteserien',
113
+ path: 'europe/norway'
114
+ },
115
+ 'dk.1' => { name: 'Denmark Superligaen',
116
+ basename: '1-superligaen',
117
+ path: 'europe/denmark',
118
+ stages: [['Regular Season'],
119
+ ['Playoffs - Championship',
120
+ 'Playoffs - Relegation',
121
+ 'Europa League Finals']]
122
+ },
123
+
124
+ 'lu.1' => { name: 'Luxembourger First Division',
125
+ basename: '1-nationaldivision',
126
+ path: 'europe/luxembourg',
127
+ },
128
+ 'be.1' => { name: 'Belgian First Division A',
129
+ basename: '1-firstdivisiona',
130
+ path: 'europe/belgium',
131
+ stages: [['Regular Season'],
132
+ ['Playoffs - Championship',
133
+ 'Playoffs - Europa League',
134
+ 'Playoffs - Europa League - Finals']]
135
+ },
136
+ 'nl.1' => { name: 'Dutch Eredivisie',
137
+ basename: '1-eredivisie',
138
+ path: 'europe/netherlands',
139
+ },
140
+ 'cz.1' => { name: 'Czech First League',
141
+ basename: '1-firstleague',
142
+ path: 'europe/czech-republic',
143
+ stages: [['Regular Season'],
144
+ ['Playoffs - Championship',
145
+ 'Europa League Play-off',
146
+ 'Playoffs - Relegation'
147
+ ]]
148
+ },
149
+ 'sk.1' => { name: 'Slovakia First League',
150
+ basename: '1-superliga',
151
+ path: 'europe/slovakia',
152
+ stages: [['Regular Season'],
153
+ ['Playoffs - Championship',
154
+ 'Playoffs - Relegation',
155
+ 'Europa League Finals']]
156
+ },
157
+ 'hr.1' => { name: 'Croatia 1. HNL',
158
+ basename: '1-hnl',
159
+ path: 'europe/croatia',
160
+ },
161
+ 'pl.1' => { name: 'Poland Ekstraklasa',
162
+ basename: '1-ekstraklasa',
163
+ path: 'europe/poland',
164
+ stages: [['Regular Season'],
165
+ ['Playoffs - Championship',
166
+ 'Playoffs - Relegation']]
167
+ },
168
+
169
+ 'ro.1' => { name: 'Romanian Liga 1',
170
+ basename: '1-liga1',
171
+ path: 'europe/romania',
172
+ stages: ->(season) {
173
+ if season.start_year >= 2015 # new league system starting with 2015/16 season
174
+ [['Regular Season'],
175
+ ['Playoffs - Championship',
176
+ 'Playoffs - Relegation']]
177
+ else
178
+ nil
179
+ end
180
+ },
181
+ },
182
+
183
+ 'ua.1' => { name: 'Ukraine Premier League',
184
+ basename: '1-premierleague',
185
+ path: 'europe/ukraine',
186
+ stages: [['Regular Season'],
187
+ ['Playoffs - Championship',
188
+ 'Playoffs - Relegation',
189
+ 'Europa League Finals']]
190
+ },
191
+
192
+
193
+ 'ru.1' => { name: 'Russian Premier League',
194
+ basename: '1-premierliga',
195
+ path: 'europe/russia',
196
+ stages: ->(season) {
197
+ if season.start_year == 2011 # 2011/12 - new (transition) league system during season switch from calendar year to academic
198
+ [['Regular Season'],
199
+ ['Playoffs - Championship',
200
+ 'Playoffs - Relegation']]
201
+ else
202
+ nil
203
+ end
204
+ },
205
+ },
206
+ 'ru.2' => { name: 'Russian 1. Division',
207
+ basename: '2-division1',
208
+ path: 'europe/russia',
209
+ },
210
+ )
211
+
212
+
213
+ end # module Writer