fbtok 0.3.3 → 0.3.4

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/Rakefile +1 -1
  4. data/lib/fbtok/opts.rb +20 -6
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90e2b9d1bb70a32d8ce47c920d411de8f45a99f7d8c9661d3f144f6087c4bb63
4
- data.tar.gz: 2878f46e029072dc5170a0153afc3f791068f83535139bc3e93fbdabfacd85a7
3
+ metadata.gz: f1d30fb729e926e1745a62c927272839f8be9b6578b92a6d4aa6415872c49164
4
+ data.tar.gz: 9eb174553656a9394993c554969600262807f8210dd1b4d01a5b392431bf14f0
5
5
  SHA512:
6
- metadata.gz: 85f951fecd347f7af50ce5f43bb8fcc6afccb57a27180980e2401f51d91f7607f11aeaf0d713f8808404e99d49f38b4a8fa28d3982c5ee73f3772ea320e5ee80
7
- data.tar.gz: d0ace4aab05240e76143ea5d83acafdf8eba3690ec22ecdbc108a15bf010a1386c8b71c9bc9e86d6a6728909141d1d0f36b3d97bab1292eb0c3bf57f4438930f
6
+ metadata.gz: 9fadde8d521bf4dc46f20650789b1b9de1e8ffe68289bd499ea5d0807e8911bfe7a424a082dfcc599c8e7e97dce63b30ed9962d93cba4cf6b4d5ee3e4f8703bf
7
+ data.tar.gz: 197a3385174d42bab7045a8d3e64844f85d131da66d51973cfca71cd2176e88baa2831b40a9d1cfe31b8f13352971576f5427b02575c8b2a12d7f38d81fc3ce9
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.3.3
1
+ ### 0.3.4
2
2
  ### 0.0.1 / 2025-01-02
3
3
 
4
4
  * Everything is new. First release.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'hoe'
2
2
 
3
3
 
4
4
  Hoe.spec 'fbtok' do
5
- self.version = '0.3.3'
5
+ self.version = '0.3.4'
6
6
 
7
7
  self.summary = "fbtok - football.txt lint tools incl. tokenizer, parser & more"
8
8
  self.description = summary
data/lib/fbtok/opts.rb CHANGED
@@ -12,8 +12,10 @@ class Opts
12
12
 
13
13
 
14
14
  SEASON_RE = %r{ (?:
15
- \d{4}-\d{2}
16
- | \d{4} (?: --[a-z0-9_-]+ )? ## todo/fix - allow "extension" to 2024-25 too - why?
15
+ (?<season>\d{4}-\d{2})
16
+ |
17
+ (?<season>\d{4})
18
+ (?: --[a-z0-9_-]+ )? ## todo/fix - allow "extension" to 2024-25 too - why?
17
19
  )
18
20
  }x
19
21
  SEASON = SEASON_RE.source ## "inline" helper for embedding in other regexes - keep? why? why not?
@@ -34,9 +36,9 @@ class Opts
34
36
  |
35
37
  (?: ## "compact" variant ii) with season in filename
36
38
  (?: ^|/ ) # beginning (^) or beginning of path (/)
37
- (?: \d{4}-\d{2}
39
+ (?: (?<season>\d{4}-\d{2})
38
40
  |
39
- \d{4}
41
+ (?<season>\d{4})
40
42
  )
41
43
  _ ## allow more than one underscore - why? why not?
42
44
  [a-z0-9][a-z0-9_.-]*\.txt$
@@ -47,7 +49,7 @@ class Opts
47
49
  ## but starting filename e.g. 2024_friendlies.txt or 2024-25_bundesliga.txt
48
50
 
49
51
 
50
- def self._find( path )
52
+ def self._find( path, seasons: nil )
51
53
  ## check - rename dir
52
54
  ## use root_dir or work_dir or cd or such - why? why not?
53
55
 
@@ -58,6 +60,11 @@ def self._find( path )
58
60
  ## path = path.gsub( "\\", '/' )
59
61
  path = File.expand_path( path )
60
62
 
63
+ if seasons && seasons.size > 0
64
+ ## norm seasons
65
+ seasons = seasons.map {|season| Season(season) }
66
+ end
67
+
61
68
 
62
69
  ## check all txt files
63
70
  ## note: incl. files starting with dot (.)) as candidates
@@ -65,7 +72,14 @@ def self._find( path )
65
72
  candidates = Dir.glob( "#{path}/**/{*,.*}.txt" )
66
73
  ## pp candidates
67
74
  candidates.each do |candidate|
68
- datafiles << candidate if MATCH_RE.match( candidate )
75
+ if m=MATCH_RE.match( candidate )
76
+ if seasons && seasons.size > 0 ## check for seasons filter
77
+ season = Season.parse(m[:season])
78
+ datafiles << candidate if seasons.include?( season )
79
+ else
80
+ datafiles << candidate
81
+ end
82
+ end
69
83
  end
70
84
 
71
85
  ## pp datafiles
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.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-25 00:00:00.000000000 Z
11
+ date: 2025-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sportdb-parser