fbtok 0.5.0 → 0.5.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1df323dd41b041e34646d3df3fb90ded24707020ff8cddc90af689f2f3d33d8
4
- data.tar.gz: c023d5844a069b4c829390e80ea2b69503809d361357df27a0e87d4ee80e336a
3
+ metadata.gz: 9eef844f7c201c7ead0ccc9ed46324f32b17e33b837aa43d37cd0b6bbab6fc4b
4
+ data.tar.gz: 985a3e86686c326fa816db8fcef1385ccc8c5372ac740f46992a9a019685f451
5
5
  SHA512:
6
- metadata.gz: 7d7759e09847da4650bc008c12a5a9c52702eb30567495a2e7667a324388203db4f2a7bba6a4ed0eea8a72a2ab211b01ca70b12e6a421026dfcf09fc024b64b2
7
- data.tar.gz: fb1673e6b654fa8fa781844534de93c5ff913b0fd7c1c828c12319cf7b22de038b5e5f3a97a9b33a6a9d3a72fd8505c6c906e4a409aff23c140589f753f80123
6
+ metadata.gz: e0ac5582359acf8fe7c5fb3391c9970e4dcd93f7e2742d92b8b558b2f4c840a9589ed6c157d115f6a98170a5865aa50457078eea2266cfde526b5a8b97630c33
7
+ data.tar.gz: 6af6b00555bc59d5745eba085ce599782b08f6bb5e33982fcd07b260ce9ca1f3df062bc6ee05514f737ec24ebd9ad9b422c94839e76e07871fa75b206e476552
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.5.0
1
+ ### 0.5.2
2
2
  ### 0.0.1 / 2025-01-02
3
3
 
4
4
  * Everything is new. First release.
data/Manifest.txt CHANGED
@@ -2,16 +2,18 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/fbfind
5
6
  bin/fbquick
6
7
  bin/fbquik
7
8
  bin/fbtok
8
9
  bin/fbtree
9
10
  bin/fbx
10
11
  lib/fbtok.rb
11
- lib/fbtok/fbquick.rb
12
- lib/fbtok/fbtok.rb
13
- lib/fbtok/fbtree.rb
14
- lib/fbtok/fbx.rb
12
+ lib/fbtok/command-fbfind.rb
13
+ lib/fbtok/command-fbquick.rb
14
+ lib/fbtok/command-fbtok.rb
15
+ lib/fbtok/command-fbtree.rb
16
+ lib/fbtok/command-fbx.rb
15
17
  lib/fbtok/filepack.rb
16
18
  lib/fbtok/pathspec.rb
17
19
  lib/fbtok/pathspec_report.rb
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'hoe'
2
2
 
3
3
 
4
4
  Hoe.spec 'fbtok' do
5
- self.version = '0.5.0'
5
+ self.version = '0.5.2'
6
6
 
7
7
  self.summary = "fbtok - football.txt lint tools incl. tokenizer, parser & more"
8
8
  self.description = summary
data/bin/fbfind ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ## tip: to test run:
4
+ ## $ ruby -I ./lib bin/fbfind
5
+
6
+
7
+ require 'fbtok'
8
+
9
+
10
+ Fbfind.main
@@ -0,0 +1,105 @@
1
+
2
+
3
+ module Fbfind
4
+
5
+ def self.main( args=ARGV )
6
+
7
+ opts = {
8
+ debug: false,
9
+ file: nil,
10
+ seasons: [],
11
+ }
12
+
13
+
14
+ parser = OptionParser.new do |parser|
15
+ parser.banner = "Usage: #{$PROGRAM_NAME} [options] DATAFILE or DIR"
16
+
17
+
18
+ parser.on( "-q", "--quiet",
19
+ "less debug output/messages (default: #{!opts[:debug]})" ) do |debug|
20
+ opts[:debug] = false
21
+ end
22
+ parser.on( "--verbose", "--debug",
23
+ "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
24
+ opts[:debug] = true
25
+ end
26
+
27
+ parser.on( "--seasons SEASONS",
28
+ "filter by seasons (default: #{opts[:seasons]})") do |seasons|
29
+ opts[:seasons] = seasons
30
+ .split( /[,:]/ )
31
+ .map { |season| Season.parse(season.strip) }
32
+ end
33
+
34
+
35
+ parser.on( "-f FILE", "--file FILE",
36
+ "read datafiles (pathspecs) via .csv file") do |file|
37
+ opts[:file] = file
38
+ end
39
+ end
40
+ parser.parse!( args )
41
+
42
+
43
+
44
+ if opts[:debug]
45
+ puts "OPTS:"
46
+ p opts
47
+ puts "ARGV:"
48
+ p args
49
+ end
50
+
51
+
52
+ # SportDb::Parser::Linter.debug = opts[:debug]
53
+ # SportDb::Parser::Linter.warn = opts[:warn]
54
+
55
+
56
+
57
+ ## todo/check - use packs or projects or such
58
+ ## instead of specs - why? why not?
59
+ specs = if opts[:file]
60
+ read_pathspecs( opts[:file] )
61
+ else
62
+ ## check for filepack
63
+ filepack = if File.file?( './filepack.txt')
64
+ read_filepack( './filepack.txt' )
65
+ else
66
+ nil
67
+ end
68
+
69
+ path = SportDb::Pathspec.path(
70
+ ['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
71
+ '/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
72
+ '/sports/openfootball'])
73
+
74
+ build_pathspecs( args, path: path,
75
+ filepack: filepack )
76
+ end
77
+
78
+
79
+ if opts[:debug]
80
+ puts
81
+ puts "pathspecs:"
82
+ pp specs
83
+ end
84
+
85
+
86
+ if opts[:seasons].size > 0
87
+ specs = filter_pathspecs( specs, seasons: opts[:seasons] )
88
+ end
89
+
90
+ puts
91
+ specs.each_with_index do |rec,i|
92
+ path = rec['path']
93
+ datafiles = rec['datafiles']
94
+
95
+ print "==> [#{i+1}/#{specs.size}] #{path}"
96
+ print " (incl. seasons #{opts[:seasons]})" if opts[:seasons].size > 0
97
+ print "...\n"
98
+ pp datafiles
99
+ puts " #{datafiles.size} datafile(s)"
100
+ end
101
+
102
+ puts "bye"
103
+ end
104
+
105
+ end ## module Fbfind
@@ -67,7 +67,14 @@ specs = if opts[:file]
67
67
  nil
68
68
  end
69
69
 
70
- build_pathspecs( args, filepack: filepack )
70
+ path = SportDb::Pathspec.path(
71
+ ['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
72
+ '/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
73
+ '/sports/openfootball'])
74
+
75
+
76
+ build_pathspecs( args, path: path,
77
+ filepack: filepack )
71
78
  end
72
79
 
73
80
  pp specs
@@ -101,6 +108,7 @@ pp specs
101
108
  pp errors
102
109
  else
103
110
  puts
111
+ pp datafiles
104
112
  puts " OK - no parse errors in #{datafiles.size} datafile(s)"
105
113
  end
106
114
 
@@ -6,8 +6,9 @@ def self.main( args=ARGV )
6
6
 
7
7
  opts = {
8
8
  debug: true,
9
- warn: false,
10
9
  file: nil,
10
+ seasons: [],
11
+ # warn: false,
11
12
  }
12
13
 
13
14
 
@@ -23,11 +24,18 @@ parser = OptionParser.new do |parser|
23
24
  "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
24
25
  opts[:debug] = true
25
26
  end
26
- parser.on( "-w", "--warn",
27
- "turn warnings into errors (default: #{opts[:warn]})" ) do |warn|
28
- opts[:warn] = true
29
- end
27
+ # parser.on( "-w", "--warn",
28
+ # "turn warnings into errors (default: #{opts[:warn]})" ) do |warn|
29
+ # opts[:warn] = true
30
+ # end
31
+
30
32
 
33
+ parser.on( "--seasons SEASONS",
34
+ "filter by seasons (default: #{opts[:seasons]})") do |seasons|
35
+ opts[:seasons] = seasons
36
+ .split( /[,:]/ )
37
+ .map { |season| Season.parse(season.strip) }
38
+ end
31
39
 
32
40
  parser.on( "-f FILE", "--file FILE",
33
41
  "read datafiles (pathspecs) via .csv file") do |file|
@@ -65,18 +73,27 @@ specs = if opts[:file]
65
73
  nil
66
74
  end
67
75
 
68
- build_pathspecs( args, filepack: filepack )
76
+ path = SportDb::Pathspec.path(
77
+ ['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
78
+ '/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
79
+ '/sports/openfootball'])
80
+
81
+ build_pathspecs( args, path: path,
82
+ filepack: filepack )
69
83
  end
70
84
 
71
85
 
72
- pp specs
73
86
 
87
+ if opts[:seasons].size > 0
88
+ specs = filter_pathspecs( specs, seasons: opts[:seasons] )
89
+ end
74
90
 
75
91
 
76
92
  specs.each_with_index do |rec,i|
77
93
  datafiles = rec['datafiles']
78
94
 
79
95
  errors = []
96
+ log = [] ## quick one-line summary per datafile
80
97
 
81
98
  datafiles.each_with_index do |path,j|
82
99
  puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
@@ -97,18 +114,24 @@ specs.each_with_index do |rec,i|
97
114
  ### errors << [ path, *msg ] # note: use splat (*) to add extra values (starting with msg)
98
115
  errors << [path, msg]
99
116
  end
117
+
118
+ log << [:ERROR, path, "#{more_errors.size} tokenize error(s), #{tokens.size} token(s)"]
119
+ else
120
+ log << [:OK, path, "#{tokens.size} token(s)"]
100
121
  end
122
+ end
101
123
 
102
124
 
103
- end
104
125
 
105
126
  if errors.size > 0
106
127
  puts
107
128
  pp errors
108
129
  puts
130
+ pp log
109
131
  puts "!! #{errors.size} tokenize error(s) in #{datafiles.size} datafiles(s)"
110
132
  else
111
133
  puts
134
+ pp log
112
135
  puts "OK no tokenize errors found in #{datafiles.size} datafile(s)"
113
136
  end
114
137
 
@@ -6,8 +6,9 @@ def self.main( args=ARGV )
6
6
 
7
7
  opts = {
8
8
  debug: true,
9
- warn: false,
10
9
  file: nil,
10
+ seasons: [],
11
+ ## warn: false,
11
12
  }
12
13
 
13
14
  parser = OptionParser.new do |parser|
@@ -22,11 +23,18 @@ parser = OptionParser.new do |parser|
22
23
  "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
23
24
  opts[:debug] = true
24
25
  end
25
- parser.on( "-w", "--warn",
26
- "turn warnings into errors (default: #{opts[:warn]})" ) do |warn|
27
- opts[:warn] = true
28
- end
26
+ # parser.on( "-w", "--warn",
27
+ # "turn warnings into errors (default: #{opts[:warn]})" ) do |warn|
28
+ # opts[:warn] = true
29
+ # end
30
+
29
31
 
32
+ parser.on( "--seasons SEASONS",
33
+ "filter by seasons (default: #{opts[:seasons]})") do |seasons|
34
+ opts[:seasons] = seasons
35
+ .split( /[,:]/ )
36
+ .map { |season| Season.parse(season.strip) }
37
+ end
30
38
 
31
39
  parser.on( "-f FILE", "--file FILE",
32
40
  "read datafiles (pathspecs) via .csv file") do |file|
@@ -38,7 +46,6 @@ parser = OptionParser.new do |parser|
38
46
  end
39
47
  parser.parse!( args )
40
48
 
41
-
42
49
  if opts[:debug]
43
50
  puts "OPTS:"
44
51
  p opts
@@ -47,8 +54,6 @@ if opts[:debug]
47
54
  end
48
55
 
49
56
 
50
- # SportDb::Parser::Linter.debug = opts[:debug]
51
- # SportDb::Parser::Linter.warn = opts[:warn]
52
57
 
53
58
 
54
59
 
@@ -65,16 +70,39 @@ specs = if opts[:file]
65
70
  nil
66
71
  end
67
72
 
68
- build_pathspecs( args, filepack: filepack )
73
+ path = SportDb::Pathspec.path(
74
+ ['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
75
+ '/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
76
+ '/sports/openfootball'])
77
+
78
+ build_pathspecs( args, path: path,
79
+ filepack: filepack )
69
80
  end
70
81
 
71
82
 
72
83
 
84
+ ## if more than single datafile
85
+ ## auto-switch into quite mode for now
86
+ ## if specs.size > 0 && specs[0]['datafiles'].size > 1
87
+ ## opts[:debug] = false
88
+ ## end
89
+
90
+ # SportDb::Parser::Linter.debug = opts[:debug]
91
+ # SportDb::Parser::Linter.warn = opts[:warn]
92
+
93
+
94
+
95
+ if opts[:seasons].size > 0
96
+ specs = filter_pathspecs( specs, seasons: opts[:seasons] )
97
+ end
98
+
99
+
73
100
 
74
101
  specs.each_with_index do |rec,i|
75
102
  datafiles = rec['datafiles']
76
103
 
77
104
  errors = []
105
+ log = [] ## quick one-line summary per datafile
78
106
 
79
107
  datafiles.each_with_index do |path,j|
80
108
  puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
@@ -92,6 +120,10 @@ specs.each_with_index do |rec,i|
92
120
  ### errors << [ path, *msg ] # note: use splat (*) to add extra values (starting with msg)
93
121
  errors << [path, msg]
94
122
  end
123
+
124
+ log << [:ERROR, path, "#{parser.errors.size} parse error(s), #{tree.size} tree node(s)"]
125
+ else
126
+ log << [:OK, path, "#{tree.size} tree node(s)"]
95
127
  end
96
128
  end
97
129
 
@@ -100,9 +132,12 @@ specs.each_with_index do |rec,i|
100
132
  puts
101
133
  pp errors
102
134
  puts
135
+ puts
136
+ pp log
103
137
  puts "!! #{errors.size} parse error(s) in #{datafiles.size} datafiles(s)"
104
138
  else
105
139
  puts
140
+ pp log
106
141
  puts "OK no parse errors found in #{datafiles.size} datafile(s)"
107
142
  end
108
143
 
@@ -1,12 +1,37 @@
1
1
 
2
2
 
3
- module SportDb
4
- class Pathspec
3
+ ##
4
+ ## note - add find_dir( name, path: ) helper
5
+ ## move upstream into cocos - why? why not?
6
+ def find_dir( name, path: [] )
7
+ return File.expand_path( name ) if Dir.exist?( name )
8
+
9
+ ## note - if name starts with / or \ assume it's absolute!!
10
+ ## do NOT search!!!
11
+ ## note - search still works for
12
+ ## ./austria or ../austria or such
13
+ ##
14
+ ## todo/check/fix-fix-fix
15
+ ## is there a File.absolute? or such method for reuse??
16
+ ##
17
+ ## todo/fix-fix-fix add absolute check upstream to find_file too!!!
18
+ return nil if name.start_with?( %r{[/\\]} )
19
+
20
+ path.each do |basedir|
21
+ ## todo/check - always make sure basedir is an absolute/expanded path - why? why not?
22
+ dirpath = File.expand_path( name, basedir )
23
+ return dirpath if Dir.exist?( dirpath )
24
+ end
25
+
26
+ nil ## return nil if not found
27
+ end
28
+
29
+
5
30
 
6
- def self.debug=(value) @@debug = value; end
7
- def self.debug?() @@debug ||= false; end ## note: default is FALSE
8
31
 
9
32
 
33
+ module SportDb
34
+ class Pathspec
10
35
 
11
36
  SEASON_RE = %r{ (?:
12
37
  (?<season>\d{4}-\d{2})
@@ -71,7 +96,7 @@ class Pathspec
71
96
  ## that will use generic **/*.txt and only use ignore filter!!!
72
97
 
73
98
 
74
- def self._find( path, seasons: nil )
99
+ def self.find( path, seasons: nil )
75
100
  ##
76
101
  ## note - only if seasons filter is turn on
77
102
  ## MATCH_RE gets used!!!
@@ -85,11 +110,11 @@ def self._find( path, seasons: nil )
85
110
 
86
111
  ## note: normalize path - use File.expand_path ??
87
112
  ## change all backslash to slash for now
88
- ## path = path.gsub( "\\", '/' )
89
113
  fullpath = File.expand_path( path )
90
114
 
91
115
  ####
92
116
  ## note - make sure path exists; raise error if not
117
+ ## ENOENT => Error No Entity
93
118
  raise Errno::ENOENT, "No such directory - #{path})" unless Dir.exist?( fullpath )
94
119
 
95
120
 
@@ -150,15 +175,33 @@ def self._find( path, seasons: nil )
150
175
  end
151
176
 
152
177
 
178
+ def self.path( default=[])
179
+ ## check for FBPATH
180
+ ## or FBTXT_PATH
181
+ path = ENV['FBPATH'] || ENV['FBTXT_PATH']
182
+ if path
183
+ path.split( /[:;]/)
184
+ else
185
+ default
186
+ end
187
+ end
188
+ end # class Pathspec
189
+
190
+
191
+
192
+
193
+
194
+ class Pathspecs ## change to a module - why? why not?
195
+
196
+
197
+ def self.debug=(value) @@debug = value; end
198
+ def self.debug?() @@debug ||= false; end ## note: default is FALSE
153
199
 
154
200
 
155
- ##
156
- ## rename/change to read_csv - why? why not?
157
201
  def self.read( src )
158
- ## note: normalize scr - use File.expand_path ??
159
- ## change all backslash to slash for now
160
- ## scr = scr.gsub( "\\", '/' )
161
- fullsrc = File.expand_path( scr )
202
+ ## note: normalize src - use File.expand_path ??
203
+ ## change all backslash to slash for now (\ to /)
204
+ fullsrc = File.expand_path( src )
162
205
 
163
206
  recs = read_csv( fullsrc )
164
207
  pp recs if debug?
@@ -167,11 +210,13 @@ def self.read( src )
167
210
  basedir = File.dirname( fullsrc )
168
211
 
169
212
  recs.each do |rec|
213
+ ##
214
+ ## todo/check - check for season/seasons column - why? why not?
170
215
  path = rec['path']
171
216
  fullpath = File.expand_path( path, basedir )
172
- datafiles = _find( fullpath )
217
+ datafiles = Pathspec.find( fullpath )
173
218
 
174
- ## add (new) datafiles column (from expanded pathspec)
219
+ ## auto-add (new) datafiles column (from expanded pathspec)
175
220
  rec['datafiles'] = datafiles
176
221
  end
177
222
 
@@ -179,15 +224,30 @@ def self.read( src )
179
224
  end
180
225
 
181
226
 
227
+ ## quick (internal) helper to
228
+ ## expand names (directories) ending with /*
229
+ ## with Pathspec.find
230
+ def self._expand_pathspecs( names )
231
+ datafiles = []
232
+ names.each do |name|
233
+ if name.end_with?('/*')
234
+ datafiles += Pathspec.find( name[0..-3] )
235
+ else
236
+ datafiles << name
237
+ end
238
+ end
239
+ datafiles
240
+ end
182
241
 
183
- def self.build( args, filepack: nil )
242
+ def self.build( args, path: [],
243
+ filepack: nil )
184
244
  recs = []
185
245
 
186
246
  ## check fo no args case (and filepack present with default)
187
247
  if args.empty?
188
248
  if filepack && filepack.has_key?('default')
189
249
  recs << { 'path' => '<default>',
190
- 'datafiles' => filepack['default'] }
250
+ 'datafiles' => _expand_pathspecs(filepack['default']) }
191
251
  end
192
252
  else
193
253
 
@@ -195,22 +255,38 @@ def self.build( args, filepack: nil )
195
255
  ## in single default pathspec node
196
256
  more = []
197
257
 
198
-
199
258
  args.each do |arg|
200
- if filepack && filepack.has_key?( arg.downcase )
201
- recs << { 'path' => "<#{arg.downcase}>",
202
- 'datafiles' => filepack[arg.downcase] }
203
- ## check if directory
204
- elsif Dir.exist?( arg )
259
+ ## note - ALWAYS give priority to existing directory matches (over filepack)
260
+ ## e.g. euro or such - why? why not?
261
+ ##
262
+ ## todo/check if euro/ works too?
263
+ ## check if directory
264
+ ## note - make find_dir/path lookup an env variable
265
+ ## e.g. FBTXT_ROOTDIR, FBTXT_SOURCE, FBSOURCE,
266
+ ## FBTXT_REPOS/PACKS/etc. or such!!!
267
+ ## add dir_path/dirs or such to build - why? why not?
268
+ if dir=find_dir( arg, path: ['/sports/openfootball'] )
205
269
  recs << { 'path' => arg,
206
- 'datafiles' => _find( arg ) }
207
- elsif File.file?( arg ) ## assume it's a file
208
- ## make sure path exists; raise error if not
209
- ## (auto-)expand path to normalize - yes why? why not?
210
- more << File.expand_path( arg )
211
- else
212
- raise Errno::ENOENT, "No such file or directory - #{arg}"
213
- end
270
+ 'datafiles' => Pathspec.find( dir ) }
271
+ elsif filepack && filepack.has_key?( arg.downcase )
272
+ recs << { 'path' => "<#{arg.downcase}>",
273
+ 'datafiles' => _expand_pathspecs(filepack[arg.downcase]) }
274
+ else ## assume it's a file
275
+ file = find_file( arg, path: path )
276
+ ## check if file (exists) in any path lookup
277
+ if file
278
+ ## todo/fix:
279
+ ## add File.expand_path upstream in find_file !!!
280
+ ## and remove later here
281
+ ## also fix upstream Errorno::ENOENT to Errno::ENOENT !!!
282
+ ##
283
+ ## make sure path exists; raise error if not
284
+ ## (auto-)expand path to normalize - yes why? why not?
285
+ more << File.expand_path(file)
286
+ else
287
+ raise Errno::ENOENT, "No such file or directory - #{arg}"
288
+ end
289
+ end
214
290
  end
215
291
 
216
292
  if more.size > 0
@@ -222,7 +298,7 @@ def self.build( args, filepack: nil )
222
298
  recs
223
299
  end
224
300
 
225
- end # class Pathspec
301
+ end # class Pathspecs
226
302
  end # module Sportdb
227
303
 
228
304
 
@@ -237,12 +313,36 @@ end # module Sportdb
237
313
  ## - (ii) all files get bundled together into <input> pathspec entry/record
238
314
  ##
239
315
  ## note: was formerly known as expand_args
240
- def build_pathspecs( args, filepack: nil )
241
- SportDb::Pathspec.build( args, filepack: filepack )
316
+ def build_pathspecs( args, path: [], filepack: nil )
317
+ SportDb::Pathspecs.build( args, path: path, filepack: filepack )
242
318
  end
243
319
 
244
320
  ####
245
321
  ## read pathspecs via csv file (using path column)
246
322
  def read_pathspecs( src )
247
- SportDb::Pathspec.read( src )
323
+ SportDb::Pathspecs.read( src )
324
+ end
325
+
326
+
327
+
328
+ def filter_pathspecs( specs, seasons: )
329
+ ## norm seasons
330
+ seasons = seasons.map {|season| Season(season) }
331
+
332
+ ## todo/fix: auto-add/update rec['seasons'] column - why? why not?
333
+
334
+ ## note - filter datafiles inplace!!!
335
+ specs.each do |rec|
336
+ rec['datafiles'] =
337
+ rec['datafiles'].select do |candidate|
338
+ m=SportDb::Pathspec::MATCH_RE.match( candidate )
339
+ if m && seasons.include?( Season.parse( m[:season] ))
340
+ true
341
+ else
342
+ false
343
+ end
344
+ end
345
+ end
346
+
347
+ specs
248
348
  end
data/lib/fbtok.rb CHANGED
@@ -7,7 +7,8 @@ require_relative 'fbtok/filepack'
7
7
  require_relative 'fbtok/pathspec'
8
8
  require_relative 'fbtok/pathspec_report'
9
9
 
10
- require_relative 'fbtok/fbtok'
11
- require_relative 'fbtok/fbtree'
12
- require_relative 'fbtok/fbquick'
13
- require_relative 'fbtok/fbx'
10
+ require_relative 'fbtok/command-fbfind'
11
+ require_relative 'fbtok/command-fbtok'
12
+ require_relative 'fbtok/command-fbtree'
13
+ require_relative 'fbtok/command-fbquick'
14
+ require_relative 'fbtok/command-fbx'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbtok
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-09 00:00:00.000000000 Z
11
+ date: 2026-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-parser
@@ -75,6 +75,7 @@ dependencies:
75
75
  description: fbtok - football.txt lint tools incl. tokenizer, parser & more
76
76
  email: gerald.bauer@gmail.com
77
77
  executables:
78
+ - fbfind
78
79
  - fbquick
79
80
  - fbquik
80
81
  - fbtok
@@ -90,16 +91,18 @@ files:
90
91
  - Manifest.txt
91
92
  - README.md
92
93
  - Rakefile
94
+ - bin/fbfind
93
95
  - bin/fbquick
94
96
  - bin/fbquik
95
97
  - bin/fbtok
96
98
  - bin/fbtree
97
99
  - bin/fbx
98
100
  - lib/fbtok.rb
99
- - lib/fbtok/fbquick.rb
100
- - lib/fbtok/fbtok.rb
101
- - lib/fbtok/fbtree.rb
102
- - lib/fbtok/fbx.rb
101
+ - lib/fbtok/command-fbfind.rb
102
+ - lib/fbtok/command-fbquick.rb
103
+ - lib/fbtok/command-fbtok.rb
104
+ - lib/fbtok/command-fbtree.rb
105
+ - lib/fbtok/command-fbx.rb
103
106
  - lib/fbtok/filepack.rb
104
107
  - lib/fbtok/pathspec.rb
105
108
  - lib/fbtok/pathspec_report.rb
File without changes