worldfootball 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 795b62b085497648e27f552f4122df1b984d77ceca2ab21e82b76929476d3994
4
- data.tar.gz: f7d42b68d8914b9fbb57ebf12295b762d3cb05a6928e99701183b59051d597cc
3
+ metadata.gz: 0dfb778159b88ccab0c79abd75512a5751e148c96f5f2c1ecec6a1ea95b4eaa7
4
+ data.tar.gz: 907c8f61a222068bc591260c6928f08c5ab76fc3fa0f826b8a83e4aba673f6a3
5
5
  SHA512:
6
- metadata.gz: ecd1b91f7b9f4569d637b16a44844b9e2c46ef7b2c0b0b82bd1774d8962f847d525bf0aa1019a559e1b48faee271983eeb3d325d70b50cdb629cd1bc2aceb724
7
- data.tar.gz: 3566a25fac9a4ce695b92b6e924baa3c1d6db2dff19de2d1af35d48b1223cd960802eab0ca6b72ed9ebff1eb09e315d0621fc4930e4004f66a87af5ccc6d365a
6
+ metadata.gz: 3d008e4768814d2d290d71a73a82f7d8b83812e75dffc6a34fa3a32778634b7160b1642d1741ba84546e89f127965f9822db7c77c47ba2b3c01adb679523256a
7
+ data.tar.gz: '09605deda7a4431e396747d2b8cca60f1aaae662249999e0b585427d53721328cf2d74beb063f4423034c0bee3e6caf1c3037e87a5ad948836a6f8371c0bfaf6'
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.2.3
1
+ ### 0.2.4
2
2
 
3
3
  ### 0.0.1 / 2024-07-04
4
4
 
data/bin/wfb CHANGED
@@ -31,7 +31,6 @@ opts = {
31
31
  cached: false,
32
32
  convert: true,
33
33
  file: nil,
34
- dry: false,
35
34
  }
36
35
 
37
36
 
@@ -54,9 +53,10 @@ parser = OptionParser.new do |parser|
54
53
  opts[:convert] = convert
55
54
  end
56
55
 
57
- parser.on( "--dry",
58
- "dry run; do NOT write - default is (#{opts[:dry]})" ) do |dry|
59
- opts[:dry] = dry
56
+ parser.on( "--print", "--pp",
57
+ "pretty print cached data in #{Webcache.root}; no download & conversion") do |print|
58
+ opts[:cached] = true
59
+ opts[:convert] = false
60
60
  end
61
61
 
62
62
  parser.on( "-f FILE", "--file FILE",
@@ -107,21 +107,29 @@ datasets = if opts[:file]
107
107
  end
108
108
 
109
109
 
110
- datasets.each do |league_key, seasons|
110
+ ## step 0 - validate and fill-up seasons etc.
111
+ datasets.each do |dataset|
112
+ league_key, seasons = dataset
111
113
 
112
114
  league = find_league!( league_key ) ## league info lookup
113
115
 
114
- if opts[:dry]
115
- ## output more page meta info
116
- puts "league meta:"
117
- pp league
118
- end
116
+ ## output more page meta info
117
+ puts "league meta:"
118
+ pp league
119
119
 
120
120
  ## note - default to latest season of league
121
121
  ## might be 2024/25 or 2024 or
122
122
  # for world cup 2022 or such
123
- seasons = [Season(league.seasons.keys[0])] if seasons.empty?
123
+ if seasons.empty?
124
+ seasons = [Season(league.seasons.keys[0])]
125
+ dataset[1] = seasons
126
+ end
127
+ end
124
128
 
129
+
130
+ ## step 1 - download
131
+ datasets.each do |league_key, seasons|
132
+ league = find_league!( league_key ) ## league info lookup
125
133
  seasons.each do |season|
126
134
  pages = league.pages!( season: season )
127
135
  puts
@@ -129,9 +137,6 @@ datasets.each do |league_key, seasons|
129
137
  pp pages
130
138
  puts " #{pages.size} page(s)"
131
139
 
132
-
133
- next if opts[:dry] ## stop here if dry run
134
-
135
140
  if opts[:cached]
136
141
  # do nothing
137
142
  else ## download to cache
@@ -148,14 +153,21 @@ datasets.each do |league_key, seasons|
148
153
 
149
154
  puts " #{matches.size} match(es)"
150
155
  end
156
+ end # each seasons
157
+ end # each league
151
158
 
152
- if opts[:convert]
159
+
160
+ if opts[:convert]
161
+ ## step 2 - convert
162
+ datasets.each do |league_key, seasons|
163
+ seasons.each do |season|
153
164
  ## write out (export to) comma-separated values (.csv) datafile
154
165
  convert( league: league_key,
155
166
  season: season )
156
- end
157
- end # each seasons
158
- end # each league
167
+ end
168
+ end
169
+ end
170
+
159
171
 
160
172
  end # def self.main
161
173
  end # module Worldfootball
@@ -2,7 +2,7 @@
2
2
  module Worldfootball
3
3
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
4
4
  MINOR = 2
5
- PATCH = 3
5
+ PATCH = 4
6
6
  VERSION = [MAJOR,MINOR,PATCH].join('.')
7
7
 
8
8
  def self.version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worldfootball
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer