sportdb-quick 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b43470a4bd201f62546d9a790b837f3bfc8210f6dedadef0fbe812dc64e7d97d
4
- data.tar.gz: 95d9917fd58cc4b0967bcac350c5d11893acffd9f420b2d04310d3b8c9464baf
3
+ metadata.gz: d24c209b9b7c40d0f042062a41edf15ebc99a9d6536b06456eb09b365ddc3d11
4
+ data.tar.gz: d6d4c961906539774027860d4c29a306186f5fba96b049a3a7b9720a9c87498d
5
5
  SHA512:
6
- metadata.gz: 89c899e6c26a654f8e799935f5c9a0521c7c985d1cd80957c60bbeacbe90304511f204bca1511d0b8fc621bf05629fad98fd438e38eb9c0f0d2d224960702f64
7
- data.tar.gz: 57ae74125c564a83487a03bf47734f14590a35ff99e54d8b8343bbff71740d3bab6fc7edf707ca1f8cbc510502f2fb819555b0c6863f71bc4dca5d60a6f5d2bb
6
+ metadata.gz: bde8f1b34c6be7c3c68b5c051dcb21c257d721719ea1e1c648b911c504535832c885395492427ca985de7b2b35e2c2b92590cd5e41b5f5f6c7344dcee8e3904a
7
+ data.tar.gz: a46daab3b1d77e498badaca558c237ad43e81c129641efa88450eabaa05d4b71499b6f2d7af0101a46b976e1ab6b0a152a9b3a6c3d0183faae53b56648814e51
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.3.0
1
+ ### 0.3.1
2
2
  ### 0.0.1 / 2024-08-27
3
3
 
4
4
  * Everything is new. First release.
data/Manifest.txt CHANGED
@@ -2,8 +2,6 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
- bin/fbt
6
- bin/fbx
7
5
  lib/sportdb/quick.rb
8
6
  lib/sportdb/quick/match_parser.rb
9
7
  lib/sportdb/quick/quick_league_outline_reader.rb
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ Hoe.spec 'sportdb-quick' do
21
21
  self.licenses = ['Public Domain']
22
22
 
23
23
  self.extra_deps = [
24
- ['sportdb-parser', '>= 0.2.2'],
24
+ ['sportdb-parser', '>= 0.4.0'],
25
25
  ['sportdb-structs', '>= 0.5.0'],
26
26
  ['logutils', '>= 0.6.1'],
27
27
  ]
@@ -4,7 +4,7 @@ module SportDb
4
4
  module Quick
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
6
  MINOR = 3
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
data/lib/sportdb/quick.rb CHANGED
@@ -17,10 +17,6 @@ end
17
17
  ## our own code
18
18
  require_relative 'quick/version'
19
19
 
20
- # require_relative 'quick/opts'
21
- # require_relative 'quick/linter'
22
- # require_relative 'quick/outline_reader'
23
-
24
20
 
25
21
  require_relative 'quick/match_parser'
26
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-quick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.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: 2024-12-30 00:00:00.000000000 Z
11
+ date: 2025-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-parser
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.2
19
+ version: 0.4.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.2.2
26
+ version: 0.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sportdb-structs
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,9 +88,7 @@ dependencies:
88
88
  version: '4.2'
89
89
  description: sportdb-quick - football.txt (quick) match readers and more
90
90
  email: gerald.bauer@gmail.com
91
- executables:
92
- - fbt
93
- - fbx
91
+ executables: []
94
92
  extensions: []
95
93
  extra_rdoc_files:
96
94
  - CHANGELOG.md
@@ -101,8 +99,6 @@ files:
101
99
  - Manifest.txt
102
100
  - README.md
103
101
  - Rakefile
104
- - bin/fbt
105
- - bin/fbx
106
102
  - lib/sportdb/quick.rb
107
103
  - lib/sportdb/quick/match_parser.rb
108
104
  - lib/sportdb/quick/quick_league_outline_reader.rb
data/bin/fbt DELETED
@@ -1,170 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ## tip: to test run:
4
- ## ruby -I ./lib bin/fbt
5
- ## -or-
6
- ## ruby -I ../parser/lib -I ./lib bin/fbt
7
- ## -or-
8
- ## ruby -I ../parser/lib -I ../sportdb-structs/lib -I ./lib bin/fbt
9
-
10
-
11
- ## our own code
12
- require 'sportdb/quick'
13
-
14
-
15
-
16
- require 'optparse'
17
-
18
- ##
19
- ## read textfile
20
- ## and dump tokens
21
- ##
22
- ## fbt ../openfootball/.../euro.txt
23
-
24
-
25
-
26
-
27
- args = ARGV
28
- opts = { debug: false,
29
- file: nil,
30
- }
31
-
32
- parser = OptionParser.new do |parser|
33
- parser.banner = "Usage: #{$PROGRAM_NAME} [options]"
34
-
35
- ##
36
- ## check if git has a offline option?? (use same)
37
- ## check for other tools - why? why not?
38
- # parser.on( "-q", "--quiet",
39
- # "less debug output/messages - default is (#{!opts[:debug]})" ) do |debug|
40
- # opts[:debug] = false
41
- # end
42
- parser.on( "--verbose", "--debug",
43
- "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
44
- opts[:debug] = true
45
- end
46
-
47
- parser.on( "-f FILE", "--file FILE",
48
- "read datafiles (pathspecs) via .csv file") do |file|
49
- opts[:file] = file
50
- end
51
-
52
-
53
- end
54
- parser.parse!( args )
55
-
56
- puts "OPTS:"
57
- p opts
58
- puts "ARGV:"
59
- p args
60
-
61
-
62
- ## todo/check - use packs or projects or such
63
- ## instead of specs - why? why not?
64
- specs = []
65
- if opts[:file]
66
- recs = read_csv( opts[:file] )
67
- pp recs
68
- ## note - make pathspecs relative to passed in file arg!!!
69
- basedir = File.dirname( opts[:file] )
70
- recs.each do |rec|
71
- paths = SportDb::Parser::Opts.find( rec['path'], dir: basedir )
72
- specs << [paths, rec]
73
- end
74
- else
75
- paths = if args.empty?
76
- [
77
- '../../../openfootball/euro/2021--europe/euro.txt',
78
- '../../../openfootball/euro/2024--germany/euro.txt',
79
- ]
80
- else
81
- ## check for directories
82
- ## and auto-expand
83
- SportDb::Parser::Opts.expand_args( args )
84
- end
85
- specs << [paths, {}]
86
- end
87
-
88
-
89
- if opts[:debug]
90
- SportDb::QuickMatchReader.debug = true
91
- SportDb::MatchParser.debug = true
92
- else
93
- SportDb::QuickMatchReader.debug = false
94
- SportDb::MatchParser.debug = false
95
- LogUtils::Logger.root.level = :info
96
- end
97
-
98
-
99
- specs.each_with_index do |(paths, rec),i|
100
- errors = []
101
- paths.each_with_index do |path,j|
102
- puts "==> [#{j+1}/#{paths.size}] reading >#{path}<..."
103
- quick = SportDb::QuickMatchReader.new( read_text( path ) )
104
- matches = quick.parse
105
-
106
- if quick.errors?
107
- puts "!! #{quick.errors.size} error(s):"
108
- pp quick.errors
109
-
110
- quick.errors.each do |err|
111
- errors << [ path, *err ] # note: use splat (*) to add extra values (starting with msg)
112
- end
113
- end
114
- puts " #{matches.size} match(es)"
115
- end
116
-
117
- if errors.size > 0
118
- puts
119
- puts "!! #{errors.size} PARSE ERRORS in #{paths.size} datafile(s)"
120
- pp errors
121
- else
122
- puts
123
- puts " OK - no parse errors in #{paths.size} datafile(s)"
124
- end
125
-
126
- ## add errors to rec via rec['errors'] to allow
127
- ## for further processing/reporting
128
- rec['errors'] = errors
129
- end
130
-
131
-
132
-
133
- ###
134
- ## generate a report if --file option used
135
- if opts[:file]
136
-
137
- buf = String.new
138
-
139
- buf << "# fbt summary report - #{specs.size} dataset(s)\n\n"
140
-
141
- specs.each_with_index do |(paths, rec),i|
142
- errors = rec['errors']
143
-
144
- if errors.size > 0
145
- buf << "!! #{errors.size} ERROR(S) "
146
- else
147
- buf << " OK "
148
- end
149
- buf << "%-20s" % rec['path']
150
- buf << " - #{paths.size} datafile(s)"
151
- buf << "\n"
152
-
153
- if errors.size > 0
154
- buf << errors.pretty_inspect
155
- buf << "\n"
156
- end
157
- end
158
-
159
- puts
160
- puts "SUMMARY:"
161
- puts buf
162
-
163
- # maybe write out in the future?
164
- # basedir = File.dirname( opts[:file] )
165
- # basename = File.basename( opts[:file], File.extname( opts[:file] ))
166
- end
167
-
168
-
169
- puts "bye"
170
-
data/bin/fbx DELETED
@@ -1,152 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- ## tip: to test run:
4
- ## ruby -I ./lib -I ../parser/lib bin/fbx
5
-
6
- ##
7
- ## todo/fix - use for testing
8
- # reads textfile and dumps results in json
9
- #
10
- # check - keep fbx name or find a differnt name - why? why not?
11
-
12
-
13
- ## our own code
14
- require 'sportdb/quick'
15
-
16
-
17
-
18
- require 'optparse'
19
-
20
- ##
21
- ## read textfile
22
- ## and dump match parse results
23
- ##
24
- ## fbt ../openfootball/.../euro.txt
25
-
26
-
27
-
28
-
29
- args = ARGV
30
- opts = { debug: false,
31
- outline: false }
32
-
33
- parser = OptionParser.new do |parser|
34
- parser.banner = "Usage: #{$PROGRAM_NAME} [options]"
35
-
36
- ##
37
- ## check if git has a offline option?? (use same)
38
- ## check for other tools - why? why not?
39
-
40
-
41
- parser.on( "--verbose", "--debug",
42
- "turn on verbose / debug output (default: #{opts[:debug]})" ) do |debug|
43
- opts[:debug] = debug
44
- end
45
-
46
- parser.on( "--outline",
47
- "turn on outline (only) output (default: #{opts[:outline]})" ) do |outline|
48
- opts[:outline] = outline
49
- end
50
- end
51
- parser.parse!( args )
52
-
53
- puts "OPTS:"
54
- p opts
55
- puts "ARGV:"
56
- p args
57
-
58
-
59
-
60
-
61
-
62
- paths = if args.empty?
63
- [
64
- '../../../openfootball/euro/2021--europe/euro.txt',
65
- '../../../openfootball/euro/2024--germany/euro.txt',
66
- ]
67
- else
68
- ## check for directories
69
- ## and auto-expand
70
-
71
- SportDb::Parser::Opts.expand_args( args )
72
- end
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
- SportDb::MatchParser.debug = true if opts[:debug]
81
-
82
-
83
- ## errors = []
84
-
85
-
86
- paths.each_with_index do |path,i|
87
- puts "==> [#{i+1}/#{paths.size}] reading >#{path}<..."
88
-
89
- txt = read_text( path )
90
- secs = SportDb::LeagueOutlineReader.parse( txt )
91
- ## pp secs
92
-
93
- secs.each_with_index do |sec,j| ## sec(tion)s
94
- season = sec[:season]
95
- league = sec[:league]
96
- stage = sec[:stage]
97
- lines = sec[:lines]
98
-
99
- puts " section #{j+1}/#{secs.size} - #{league.name} #{season}, #{stage} - #{lines.size} line(s)"
100
-
101
- next if opts[:outline]
102
-
103
- =begin
104
- ### check if event info availabe - use start_date;
105
- ## otherwise we have to guess (use a "synthetic" start_date)
106
- event_info = catalog.events.find_by( season: season,
107
- league: league )
108
-
109
- start = if event_info && event_info.start_date
110
- puts "event info found:"
111
- puts " using start date from event: "
112
- pp event_info
113
- pp event_info.start_date
114
- event_info.start_date
115
- else
116
- =end
117
- start = if season.year?
118
- Date.new( season.start_year, 1, 1 )
119
- else
120
- Date.new( season.start_year, 7, 1 )
121
- end
122
-
123
- parser = SportDb::MatchParser.new( lines,
124
- start ) ## note: keep season start_at date for now (no need for more specific stage date need for now)
125
-
126
- auto_conf_teams, matches, rounds, groups = parser.parse
127
-
128
- puts ">>> #{auto_conf_teams.size} teams:"
129
- pp auto_conf_teams
130
- puts ">>> #{matches.size} matches:"
131
- ## pp matches
132
- puts ">>> #{rounds.size} rounds:"
133
- pp rounds
134
- puts ">>> #{groups.size} groups:"
135
- pp groups
136
- end # each secs
137
- end # each paths
138
-
139
- =begin
140
- if errors.size > 0
141
- puts
142
- pp errors
143
- puts
144
- puts "!! #{errors.size} parse error(s) in #{paths.size} datafiles(s)"
145
- else
146
- puts
147
- puts "OK no parse errors found in #{paths.size} datafile(s)"
148
- end
149
- =end
150
-
151
- puts "bye"
152
-