fbtok 0.5.3 → 0.9.0
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 -13
- data/lib/fbtok/command-fbtok.rb +7 -8
- data/lib/fbtok/command-fbtree.rb +11 -6
- data/lib/fbtok/command-fbx.rb +13 -13
- data/lib/fbtok/pathspec.rb +6 -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: 79b90fe564aceafc6c304dda555d29602c54cd6a5dc0973d929948f342a34ad2
|
|
4
|
+
data.tar.gz: 32d96ae47f2d9341a28ab52397122dd7d45839689f05211b397c8233c8d879ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da06e09e80a97753369af5cf1abecc7af1576e5a02d7ad69866c060c724f94ed9f35c2d7022759c3ccc4f34275fba7fffde27cdd6a79976f73550ca359556a77
|
|
7
|
+
data.tar.gz: c951cbd72bb32e608e2bfb19ddf45498a9858305ec886062963d7b7517532a55c1d079650097ea1b2e7a96cba99b0f8ffc3177af6682fe09966feb76490a9f5e
|
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.0'
|
|
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,12 +40,11 @@ if opts[:debug]
|
|
|
40
40
|
puts "ARGV:"
|
|
41
41
|
p args
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
Fbtxt::Lexer.debug = true
|
|
44
|
+
Fbtxt::Parser.debug = true
|
|
45
|
+
Fbtxt::Document.debug = true
|
|
45
46
|
else
|
|
46
|
-
|
|
47
|
-
SportDb::MatchParser.debug = false
|
|
48
|
-
LogUtils::Logger.root.level = :info
|
|
47
|
+
## note - assume no debug is default
|
|
49
48
|
end
|
|
50
49
|
|
|
51
50
|
|
|
@@ -67,7 +66,7 @@ specs = if opts[:file]
|
|
|
67
66
|
nil
|
|
68
67
|
end
|
|
69
68
|
|
|
70
|
-
path =
|
|
69
|
+
path = Fbtxt::Pathspec.path(
|
|
71
70
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
72
71
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
73
72
|
'/sports/openfootball'])
|
|
@@ -88,14 +87,14 @@ pp specs
|
|
|
88
87
|
datafiles.each_with_index do |path,j|
|
|
89
88
|
puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
|
|
90
89
|
txt = read_text( path )
|
|
91
|
-
|
|
92
|
-
matches =
|
|
90
|
+
doc = Fbtxt::Document.new( txt )
|
|
91
|
+
matches = doc.matches
|
|
93
92
|
|
|
94
|
-
if
|
|
95
|
-
puts "!! #{
|
|
96
|
-
pp
|
|
93
|
+
if doc.errors?
|
|
94
|
+
puts "!! #{doc.errors.size} error(s):"
|
|
95
|
+
pp doc.errors
|
|
97
96
|
|
|
98
|
-
|
|
97
|
+
doc.errors.each do |err|
|
|
99
98
|
errors << [ path, *err ] # note: use splat (*) to add extra values (starting with msg)
|
|
100
99
|
end
|
|
101
100
|
end
|
|
@@ -122,7 +121,7 @@ pp specs
|
|
|
122
121
|
###
|
|
123
122
|
## generate a report if --file option used
|
|
124
123
|
if opts[:file]
|
|
125
|
-
buf =
|
|
124
|
+
buf = Fbtxt::PathspecReport.new(
|
|
126
125
|
specs,
|
|
127
126
|
title: 'fbquick summary report' ).build
|
|
128
127
|
|
data/lib/fbtok/command-fbtok.rb
CHANGED
|
@@ -6,9 +6,10 @@ def self.main( args=ARGV )
|
|
|
6
6
|
|
|
7
7
|
opts = {
|
|
8
8
|
debug: true,
|
|
9
|
+
# warn: false,
|
|
10
|
+
|
|
9
11
|
file: nil,
|
|
10
12
|
seasons: [],
|
|
11
|
-
# warn: false,
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
|
|
@@ -53,11 +54,9 @@ if opts[:debug]
|
|
|
53
54
|
p opts
|
|
54
55
|
puts "ARGV:"
|
|
55
56
|
p args
|
|
56
|
-
end
|
|
57
|
-
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
Fbtxt::Lexer.debug = true
|
|
59
|
+
end
|
|
61
60
|
|
|
62
61
|
|
|
63
62
|
|
|
@@ -73,7 +72,7 @@ specs = if opts[:file]
|
|
|
73
72
|
nil
|
|
74
73
|
end
|
|
75
74
|
|
|
76
|
-
path =
|
|
75
|
+
path = Fbtxt::Pathspec.path(
|
|
77
76
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
78
77
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
79
78
|
'/sports/openfootball'])
|
|
@@ -99,7 +98,7 @@ specs.each_with_index do |rec,i|
|
|
|
99
98
|
puts "==> [#{i+1}/#{specs.size}, #{j+1}/#{datafiles.size}] reading >#{path}<..."
|
|
100
99
|
|
|
101
100
|
txt = read_text( path )
|
|
102
|
-
lexer =
|
|
101
|
+
lexer = Fbtxt::Lexer.new( txt )
|
|
103
102
|
tokens, more_errors = lexer.tokenize_with_errors
|
|
104
103
|
|
|
105
104
|
####
|
|
@@ -144,7 +143,7 @@ end
|
|
|
144
143
|
###
|
|
145
144
|
## generate a report if --file option used
|
|
146
145
|
if opts[:file]
|
|
147
|
-
buf =
|
|
146
|
+
buf = Fbtxt::PathspecReport.new(
|
|
148
147
|
specs,
|
|
149
148
|
title: 'fbtok summary report' ).build
|
|
150
149
|
|
data/lib/fbtok/command-fbtree.rb
CHANGED
|
@@ -72,6 +72,9 @@ if opts[:debug]
|
|
|
72
72
|
p opts
|
|
73
73
|
puts "ARGV:"
|
|
74
74
|
p args
|
|
75
|
+
|
|
76
|
+
Fbtxt::Lexer.debug = true
|
|
77
|
+
Fbtxt::Parser.debug = true
|
|
75
78
|
end
|
|
76
79
|
|
|
77
80
|
|
|
@@ -144,7 +147,12 @@ specs = if opts[:file]
|
|
|
144
147
|
nil
|
|
145
148
|
end
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
##
|
|
151
|
+
## maybe change to:
|
|
152
|
+
## Env.fbpath( default)
|
|
153
|
+
## or fb_path or such - why? why not?
|
|
154
|
+
|
|
155
|
+
path = Fbtxt::Pathspec.path(
|
|
148
156
|
['/sports/sportdb/sport.db.v2/parser/fbtxt-specs',
|
|
149
157
|
'/sports/sportdb/sport.db.v2/parser/fbtxt-samples',
|
|
150
158
|
'/sports/openfootball'])
|
|
@@ -161,9 +169,6 @@ specs = if opts[:file]
|
|
|
161
169
|
## opts[:debug] = false
|
|
162
170
|
## end
|
|
163
171
|
|
|
164
|
-
# SportDb::Parser::Linter.debug = opts[:debug]
|
|
165
|
-
# SportDb::Parser::Linter.warn = opts[:warn]
|
|
166
|
-
|
|
167
172
|
|
|
168
173
|
|
|
169
174
|
if opts[:seasons].size > 0
|
|
@@ -222,7 +227,7 @@ end
|
|
|
222
227
|
## generate a report if --file option used
|
|
223
228
|
if opts[:file]
|
|
224
229
|
|
|
225
|
-
buf =
|
|
230
|
+
buf = Fbtxt::PathspecReport.new(
|
|
226
231
|
specs,
|
|
227
232
|
title: 'fbtree summary report' ).build
|
|
228
233
|
|
|
@@ -257,7 +262,7 @@ end
|
|
|
257
262
|
|
|
258
263
|
|
|
259
264
|
def self.parse_with_errors( txt, opts={} )
|
|
260
|
-
parser = RaccMatchParser.new( txt
|
|
265
|
+
parser = RaccMatchParser.new( txt )
|
|
261
266
|
tree = parser.parse
|
|
262
267
|
|
|
263
268
|
dump_tree_stats( tree )
|
data/lib/fbtok/command-fbx.rb
CHANGED
|
@@ -46,10 +46,11 @@ if opts[:debug]
|
|
|
46
46
|
puts "ARGV:"
|
|
47
47
|
p args
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Fbtxt::Lexer.debug = true
|
|
50
|
+
Fbtxt::Parser.debug = true
|
|
51
|
+
Fbtxt::Document.debug = true
|
|
50
52
|
else
|
|
51
|
-
|
|
52
|
-
LogUtils::Logger.root.level = :info
|
|
53
|
+
## note - assume no debug is default
|
|
53
54
|
end
|
|
54
55
|
|
|
55
56
|
|
|
@@ -74,19 +75,18 @@ paths.each_with_index do |path,i|
|
|
|
74
75
|
|
|
75
76
|
##
|
|
76
77
|
## note - use start: nil => requires that first date incl. a year!!!
|
|
77
|
-
|
|
78
|
+
doc = Fbtxt::Document.new( txt, start: nil )
|
|
78
79
|
|
|
79
|
-
auto_conf_teams, matches, rounds, groups = parser.parse
|
|
80
80
|
|
|
81
|
-
puts ">>> #{
|
|
82
|
-
pp
|
|
83
|
-
puts ">>> #{matches.size} matches:"
|
|
84
|
-
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
|
|
85
85
|
puts "..."
|
|
86
|
-
puts ">>> #{rounds.size} rounds:"
|
|
87
|
-
pp rounds
|
|
88
|
-
puts ">>> #{groups.size} groups:"
|
|
89
|
-
pp groups
|
|
86
|
+
puts ">>> #{doc.rounds.size} rounds:"
|
|
87
|
+
pp doc.rounds
|
|
88
|
+
puts ">>> #{doc.groups.size} groups:"
|
|
89
|
+
pp doc.groups
|
|
90
90
|
end # each paths
|
|
91
91
|
|
|
92
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{ (?:
|
|
@@ -280,7 +280,7 @@ def self.build( args, path: [],
|
|
|
280
280
|
end
|
|
281
281
|
|
|
282
282
|
end # class Pathspecs
|
|
283
|
-
end # module
|
|
283
|
+
end # module Fbtxt
|
|
284
284
|
|
|
285
285
|
|
|
286
286
|
|
|
@@ -295,17 +295,18 @@ end # module Sportdb
|
|
|
295
295
|
##
|
|
296
296
|
## note: was formerly known as expand_args
|
|
297
297
|
def build_pathspecs( args, path: [], filepack: nil )
|
|
298
|
-
|
|
298
|
+
Fbtxt::Pathspecs.build( args, path: path, filepack: filepack )
|
|
299
299
|
end
|
|
300
300
|
|
|
301
301
|
####
|
|
302
302
|
## read pathspecs via csv file (using path column)
|
|
303
303
|
def read_pathspecs( src )
|
|
304
|
-
|
|
304
|
+
Fbtxt::Pathspecs.read( src )
|
|
305
305
|
end
|
|
306
306
|
|
|
307
307
|
|
|
308
308
|
|
|
309
|
+
|
|
309
310
|
def filter_pathspecs( specs, seasons: )
|
|
310
311
|
## norm seasons
|
|
311
312
|
seasons = seasons.map {|season| Season(season) }
|
|
@@ -316,7 +317,7 @@ def filter_pathspecs( specs, seasons: )
|
|
|
316
317
|
specs.each do |rec|
|
|
317
318
|
rec['datafiles'] =
|
|
318
319
|
rec['datafiles'].select do |candidate|
|
|
319
|
-
m=
|
|
320
|
+
m=Fbtxt::Pathspec::MATCH_RE.match( candidate )
|
|
320
321
|
if m && seasons.include?( Season.parse( m[:season] ))
|
|
321
322
|
true
|
|
322
323
|
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.0
|
|
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
|