worldfootball 0.2.2 → 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: 2e871cd1caa08e419ec61ec216e95becce7c4d7523f189d72819c8caeac3d064
4
- data.tar.gz: e02aeb59551d0b67a3719fb770a4cbd66f0f0a8cefd707030e9c694c64e09920
3
+ metadata.gz: 0dfb778159b88ccab0c79abd75512a5751e148c96f5f2c1ecec6a1ea95b4eaa7
4
+ data.tar.gz: 907c8f61a222068bc591260c6928f08c5ab76fc3fa0f826b8a83e4aba673f6a3
5
5
  SHA512:
6
- metadata.gz: 2a87baa018202326f680a82a964a215e77d776dea8d49cd7d30909840b2309fc3b9f562c2ded0f27513e21df24b83c6c6aa4b2ccf8ecda3619594dedd4f6ca53
7
- data.tar.gz: 8c52cf35ac656cee3281921ce83fb0f947385bcf11d719c98ec8506f5b8b172fc574dacbce5dbc35864056cc313e7177f4118651e28cec303e5e0e53d0fe6e2a
6
+ metadata.gz: 3d008e4768814d2d290d71a73a82f7d8b83812e75dffc6a34fa3a32778634b7160b1642d1741ba84546e89f127965f9822db7c77c47ba2b3c01adb679523256a
7
+ data.tar.gz: '09605deda7a4431e396747d2b8cca60f1aaae662249999e0b585427d53721328cf2d74beb063f4423034c0bee3e6caf1c3037e87a5ad948836a6f8371c0bfaf6'
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.2.2
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",
@@ -83,7 +83,7 @@ if ['cache'].include?( args[0] )
83
83
  end
84
84
 
85
85
 
86
- if ['league', 'leagues', 'ls'].include?( args[0] || 'leagues' )
86
+ if ['league', 'leagues', 'ls'].include?( args[0] )
87
87
  keys = LEAGUES.keys
88
88
 
89
89
  pp keys
@@ -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 = 2
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.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer