fbtok 0.5.4 → 0.9.1
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/CHANGELOG.md +1 -1
- data/README.md +2 -2
- data/Rakefile +3 -3
- data/bin/fbquick +2 -2
- data/bin/fbquik +1 -1
- data/bin/fbx +1 -1
- data/lib/fbtok/command-fbfind.rb +1 -5
- data/lib/fbtok/command-fbquick.rb +12 -15
- data/lib/fbtok/command-fbtok.rb +4 -4
- data/lib/fbtok/command-fbtree.rb +4 -4
- data/lib/fbtok/command-fbx.rb +13 -15
- data/lib/fbtok/pathspec.rb +10 -5
- data/lib/fbtok/pathspec_report.rb +2 -2
- data/lib/fbtok.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c19bd3b153f7429d9397fb767ba9d420ee74ebef9065cc294cd8f6ef9efa9141
|
|
4
|
+
data.tar.gz: 51187932ab782b85c941741864fbc40287252fe1d7e01e0411bc1b13131644f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 926145f258c1b0bc260dcb726478c34a9ea19872449dd1d7c046dde7035fafc4f23dd9cfdc37307bacf628e87e54b70437f444ef2bcf1f6f41e96dfab2b2852b
|
|
7
|
+
data.tar.gz: 00bd95604cb4f1add3214b158ec8237f948aac7ccee2a087c05e358bab5834911088daea3b9b269275ff733f04675b6e4e15bfb5fd0ef20bac27d9375a6c0cbf
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ gem install fbtok
|
|
|
22
22
|
|
|
23
23
|
### fbtok & fbtree - use tokenizer (lexer) & parser
|
|
24
24
|
|
|
25
|
-
- depends on
|
|
25
|
+
- depends on fbtxt-parser
|
|
26
26
|
|
|
27
27
|
get help
|
|
28
28
|
|
|
@@ -54,7 +54,7 @@ $ fbtree worldcup
|
|
|
54
54
|
|
|
55
55
|
### fbquick/fbquik & fbx - use quick match reader & dump match schedule
|
|
56
56
|
|
|
57
|
-
- depends on
|
|
57
|
+
- depends on fbtxt-document (& fbtxt-parser)
|
|
58
58
|
|
|
59
59
|
get help
|
|
60
60
|
|
data/Rakefile
CHANGED
|
@@ -2,7 +2,7 @@ require 'hoe'
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
Hoe.spec 'fbtok' do
|
|
5
|
-
self.version = '0.
|
|
5
|
+
self.version = '0.9.1'
|
|
6
6
|
|
|
7
7
|
self.summary = "fbtok - football.txt lint tools incl. tokenizer, parser & more"
|
|
8
8
|
self.description = summary
|
|
@@ -19,8 +19,8 @@ Hoe.spec 'fbtok' do
|
|
|
19
19
|
self.licenses = ['Public Domain']
|
|
20
20
|
|
|
21
21
|
self.extra_deps = [
|
|
22
|
-
['
|
|
23
|
-
['
|
|
22
|
+
['fbtxt-parser', '>= 0.9.0'],
|
|
23
|
+
['fbtxt-document', '>= 0.9.0'],
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
self.spec_extras = {
|
data/bin/fbquick
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
## -or-
|
|
6
6
|
## $ ruby -I ../parser/lib -I ./lib bin/fbquick
|
|
7
7
|
## -or-
|
|
8
|
-
## $ ruby -I ../parser/lib -I ../
|
|
8
|
+
## $ ruby -I ../parser/lib -I ../document/lib -I ./lib bin/fbquick
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
## quick hack
|
|
12
12
|
## if available always use latest (local) source version
|
|
13
13
|
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/parser/lib' )
|
|
14
|
-
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/
|
|
14
|
+
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/document/lib' )
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
data/bin/fbquik
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
## quick hack
|
|
7
7
|
## if available always use latest (local) source version
|
|
8
8
|
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/parser/lib' )
|
|
9
|
-
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/
|
|
9
|
+
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/document/lib' )
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
## our own code
|
data/bin/fbx
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
## quick hack
|
|
8
8
|
## if available always use latest (local) source version
|
|
9
9
|
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/parser/lib' )
|
|
10
|
-
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/
|
|
10
|
+
$LOAD_PATH.unshift( '/sports/sportdb/sport.db.v2/document/lib' )
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
data/lib/fbtok/command-fbfind.rb
CHANGED
|
@@ -49,10 +49,6 @@ if opts[:debug]
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
# SportDb::Parser::Linter.debug = opts[:debug]
|
|
53
|
-
# SportDb::Parser::Linter.warn = opts[:warn]
|
|
54
|
-
|
|
55
|
-
|
|
56
52
|
|
|
57
53
|
## todo/check - use packs or projects or such
|
|
58
54
|
## instead of specs - why? why not?
|
|
@@ -66,7 +62,7 @@ specs = if opts[:file]
|
|
|
66
62
|
nil
|
|
67
63
|
end
|
|
68
64
|
|
|
69
|
-
path =
|
|
65
|
+
path = Fbtxt::Pathspec.path(
|
|
70
66
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
71
67
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
72
68
|
'/sports/openfootball'])
|
|
@@ -40,14 +40,11 @@ if opts[:debug]
|
|
|
40
40
|
puts "ARGV:"
|
|
41
41
|
p args
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
SportDb::QuickMatchReader.debug = true
|
|
43
|
+
Fbtxt::Lexer.debug = true
|
|
44
|
+
Fbtxt::Parser.debug = true
|
|
45
|
+
Fbtxt::Document.debug = true
|
|
47
46
|
else
|
|
48
|
-
|
|
49
|
-
SportDb::MatchParser.debug = false
|
|
50
|
-
LogUtils::Logger.root.level = :info
|
|
47
|
+
## note - assume no debug is default
|
|
51
48
|
end
|
|
52
49
|
|
|
53
50
|
|
|
@@ -69,7 +66,7 @@ specs = if opts[:file]
|
|
|
69
66
|
nil
|
|
70
67
|
end
|
|
71
68
|
|
|
72
|
-
path =
|
|
69
|
+
path = Fbtxt::Pathspec.path(
|
|
73
70
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
74
71
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
75
72
|
'/sports/openfootball'])
|
|
@@ -90,14 +87,14 @@ pp specs
|
|
|
90
87
|
datafiles.each_with_index do |path,j|
|
|
91
88
|
puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
|
|
92
89
|
txt = read_text( path )
|
|
93
|
-
|
|
94
|
-
matches =
|
|
90
|
+
doc = Fbtxt::Document.new( txt )
|
|
91
|
+
matches = doc.matches
|
|
95
92
|
|
|
96
|
-
if
|
|
97
|
-
puts "!! #{
|
|
98
|
-
pp
|
|
93
|
+
if doc.errors?
|
|
94
|
+
puts "!! #{doc.errors.size} error(s):"
|
|
95
|
+
pp doc.errors
|
|
99
96
|
|
|
100
|
-
|
|
97
|
+
doc.errors.each do |err|
|
|
101
98
|
errors << [ path, *err ] # note: use splat (*) to add extra values (starting with msg)
|
|
102
99
|
end
|
|
103
100
|
end
|
|
@@ -124,7 +121,7 @@ pp specs
|
|
|
124
121
|
###
|
|
125
122
|
## generate a report if --file option used
|
|
126
123
|
if opts[:file]
|
|
127
|
-
buf =
|
|
124
|
+
buf = Fbtxt::PathspecReport.new(
|
|
128
125
|
specs,
|
|
129
126
|
title: 'fbquick summary report' ).build
|
|
130
127
|
|
data/lib/fbtok/command-fbtok.rb
CHANGED
|
@@ -55,7 +55,7 @@ if opts[:debug]
|
|
|
55
55
|
puts "ARGV:"
|
|
56
56
|
p args
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
Fbtxt::Lexer.debug = true
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
|
|
@@ -72,7 +72,7 @@ specs = if opts[:file]
|
|
|
72
72
|
nil
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
path =
|
|
75
|
+
path = Fbtxt::Pathspec.path(
|
|
76
76
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
77
77
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
78
78
|
'/sports/openfootball'])
|
|
@@ -98,7 +98,7 @@ specs.each_with_index do |rec,i|
|
|
|
98
98
|
puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
|
|
99
99
|
|
|
100
100
|
txt = read_text( path )
|
|
101
|
-
lexer =
|
|
101
|
+
lexer = Fbtxt::Lexer.new( txt )
|
|
102
102
|
tokens, more_errors = lexer.tokenize_with_errors
|
|
103
103
|
|
|
104
104
|
####
|
|
@@ -143,7 +143,7 @@ end
|
|
|
143
143
|
###
|
|
144
144
|
## generate a report if --file option used
|
|
145
145
|
if opts[:file]
|
|
146
|
-
buf =
|
|
146
|
+
buf = Fbtxt::PathspecReport.new(
|
|
147
147
|
specs,
|
|
148
148
|
title: 'fbtok summary report' ).build
|
|
149
149
|
|
data/lib/fbtok/command-fbtree.rb
CHANGED
|
@@ -73,8 +73,8 @@ if opts[:debug]
|
|
|
73
73
|
puts "ARGV:"
|
|
74
74
|
p args
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
Fbtxt::Lexer.debug = true
|
|
77
|
+
Fbtxt::Parser.debug = true
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
|
|
@@ -152,7 +152,7 @@ specs = if opts[:file]
|
|
|
152
152
|
## Env.fbpath( default)
|
|
153
153
|
## or fb_path or such - why? why not?
|
|
154
154
|
|
|
155
|
-
path =
|
|
155
|
+
path = Fbtxt::Pathspec.path(
|
|
156
156
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
157
157
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
158
158
|
'/sports/openfootball'])
|
|
@@ -227,7 +227,7 @@ end
|
|
|
227
227
|
## generate a report if --file option used
|
|
228
228
|
if opts[:file]
|
|
229
229
|
|
|
230
|
-
buf =
|
|
230
|
+
buf = Fbtxt::PathspecReport.new(
|
|
231
231
|
specs,
|
|
232
232
|
title: 'fbtree summary report' ).build
|
|
233
233
|
|
data/lib/fbtok/command-fbx.rb
CHANGED
|
@@ -46,12 +46,11 @@ if opts[:debug]
|
|
|
46
46
|
puts "ARGV:"
|
|
47
47
|
p args
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
Fbtxt::Lexer.debug = true
|
|
50
|
+
Fbtxt::Parser.debug = true
|
|
51
|
+
Fbtxt::Document.debug = true
|
|
52
52
|
else
|
|
53
|
-
|
|
54
|
-
LogUtils::Logger.root.level = :info
|
|
53
|
+
## note - assume no debug is default
|
|
55
54
|
end
|
|
56
55
|
|
|
57
56
|
|
|
@@ -76,19 +75,18 @@ paths.each_with_index do |path,i|
|
|
|
76
75
|
|
|
77
76
|
##
|
|
78
77
|
## note - use start: nil => requires that first date incl. a year!!!
|
|
79
|
-
|
|
78
|
+
doc = Fbtxt::Document.new( txt, start: nil )
|
|
80
79
|
|
|
81
|
-
auto_conf_teams, matches, rounds, groups = parser.parse
|
|
82
80
|
|
|
83
|
-
puts ">>> #{
|
|
84
|
-
pp
|
|
85
|
-
puts ">>> #{matches.size} matches:"
|
|
86
|
-
pp matches[0,2] ## print first two matches
|
|
81
|
+
puts ">>> #{doc.teams.size} teams:"
|
|
82
|
+
pp doc.teams
|
|
83
|
+
puts ">>> #{doc.matches.size} matches:"
|
|
84
|
+
pp doc.matches[0,2] ## print first two matches
|
|
87
85
|
puts "..."
|
|
88
|
-
puts ">>> #{rounds.size} rounds:"
|
|
89
|
-
pp rounds
|
|
90
|
-
puts ">>> #{groups.size} groups:"
|
|
91
|
-
pp groups
|
|
86
|
+
puts ">>> #{doc.rounds.size} rounds:"
|
|
87
|
+
pp doc.rounds
|
|
88
|
+
puts ">>> #{doc.groups.size} groups:"
|
|
89
|
+
pp doc.groups
|
|
92
90
|
end # each paths
|
|
93
91
|
|
|
94
92
|
=begin
|
data/lib/fbtok/pathspec.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
module
|
|
5
|
+
module Fbtxt
|
|
6
6
|
class Pathspec
|
|
7
7
|
|
|
8
8
|
SEASON_RE = %r{ (?:
|
|
@@ -133,6 +133,10 @@ def self.find( path, seasons: nil )
|
|
|
133
133
|
next if /squad/i.match?( basename )
|
|
134
134
|
next if /\.v[0-9][0-9_]*/i.match?( basename )
|
|
135
135
|
|
|
136
|
+
## exclude
|
|
137
|
+
## .meta.txt used in (wget) cache for meta data
|
|
138
|
+
next if /\.meta$/i.match?( basename )
|
|
139
|
+
|
|
136
140
|
### exclude
|
|
137
141
|
## logs.txt or logs.xxx.txt etc
|
|
138
142
|
## log.txt or log.xxx.txt etc
|
|
@@ -280,7 +284,7 @@ def self.build( args, path: [],
|
|
|
280
284
|
end
|
|
281
285
|
|
|
282
286
|
end # class Pathspecs
|
|
283
|
-
end # module
|
|
287
|
+
end # module Fbtxt
|
|
284
288
|
|
|
285
289
|
|
|
286
290
|
|
|
@@ -295,17 +299,18 @@ end # module Sportdb
|
|
|
295
299
|
##
|
|
296
300
|
## note: was formerly known as expand_args
|
|
297
301
|
def build_pathspecs( args, path: [], filepack: nil )
|
|
298
|
-
|
|
302
|
+
Fbtxt::Pathspecs.build( args, path: path, filepack: filepack )
|
|
299
303
|
end
|
|
300
304
|
|
|
301
305
|
####
|
|
302
306
|
## read pathspecs via csv file (using path column)
|
|
303
307
|
def read_pathspecs( src )
|
|
304
|
-
|
|
308
|
+
Fbtxt::Pathspecs.read( src )
|
|
305
309
|
end
|
|
306
310
|
|
|
307
311
|
|
|
308
312
|
|
|
313
|
+
|
|
309
314
|
def filter_pathspecs( specs, seasons: )
|
|
310
315
|
## norm seasons
|
|
311
316
|
seasons = seasons.map {|season| Season(season) }
|
|
@@ -316,7 +321,7 @@ def filter_pathspecs( specs, seasons: )
|
|
|
316
321
|
specs.each do |rec|
|
|
317
322
|
rec['datafiles'] =
|
|
318
323
|
rec['datafiles'].select do |candidate|
|
|
319
|
-
m=
|
|
324
|
+
m=Fbtxt::Pathspec::MATCH_RE.match( candidate )
|
|
320
325
|
if m && seasons.include?( Season.parse( m[:season] ))
|
|
321
326
|
true
|
|
322
327
|
else
|
data/lib/fbtok.rb
CHANGED
metadata
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fbtok
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.1
|
|
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-
|
|
11
|
+
date: 2026-07-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
14
|
+
name: fbtxt-parser
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
19
|
+
version: 0.9.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
26
|
+
version: 0.9.0
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: fbtxt-document
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
33
|
+
version: 0.9.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 0.
|
|
40
|
+
version: 0.9.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rdoc
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|