fbtok 0.5.4 → 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 -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 +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,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{ (?:
|
|
@@ -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
|