fbtok 0.3.2 → 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 +35 -7
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15089da91cb8cb9ce5f6905c3714e52758fcf4254c26f978ef1a64ac053caf9d
4
- data.tar.gz: 13edb307d1fcbc9b0e30ff80f1764623c5f4a1cc17ef225e61d96e071615bcc6
3
+ metadata.gz: f1d30fb729e926e1745a62c927272839f8be9b6578b92a6d4aa6415872c49164
4
+ data.tar.gz: 9eb174553656a9394993c554969600262807f8210dd1b4d01a5b392431bf14f0
5
5
  SHA512:
6
- metadata.gz: 2d56318a4f9895dd71b8c6309ba131e2a310e0bc5d799bfe646f67220138ca1351bbde05ee5725bd28676988ccdbca009f0868b8de6f0e9a2ea5923743a2a32f
7
- data.tar.gz: a28531c219b2ccf4cd1ee76129dcb8564433b1b3c2bdd1fd439ab44a4be2d04541cb8436cc9daab15c3010b22f590179556acfed1a2d2c8b23243f5156220e01
6
+ metadata.gz: 9fadde8d521bf4dc46f20650789b1b9de1e8ffe68289bd499ea5d0807e8911bfe7a424a082dfcc599c8e7e97dce63b30ed9962d93cba4cf6b4d5ee3e4f8703bf
7
+ data.tar.gz: 197a3385174d42bab7045a8d3e64844f85d131da66d51973cfca71cd2176e88baa2831b40a9d1cfe31b8f13352971576f5427b02575c8b2a12d7f38d81fc3ce9
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.3.2
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.2'
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_-]+)?
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?
@@ -25,15 +27,29 @@ class Opts
25
27
  ## BUT NOT as first character!!! (e.g. exclude .confg.txt !!!)
26
28
  ## e.g. 2024-25/at.1.txt
27
29
  ## change to at_1 or uefa_cl or such - why? why not?
28
- MATCH_RE = %r{ (?: ^|/ ) # beginning (^) or beginning of path (/)
30
+ MATCH_RE = %r{ (?: ## "classic" variant i) with season folder
31
+ (?: ^|/ ) # beginning (^) or beginning of path (/)
29
32
  #{SEASON}
30
- /[a-z0-9][a-z0-9_.-]*\.txt$ ## txt e.g /1-premierleague.txt
33
+ /
34
+ [a-z0-9][a-z0-9_.-]*\.txt$ ## txt e.g /1-premierleague.txt
35
+ )
36
+ |
37
+ (?: ## "compact" variant ii) with season in filename
38
+ (?: ^|/ ) # beginning (^) or beginning of path (/)
39
+ (?: (?<season>\d{4}-\d{2})
40
+ |
41
+ (?<season>\d{4})
42
+ )
43
+ _ ## allow more than one underscore - why? why not?
44
+ [a-z0-9][a-z0-9_.-]*\.txt$
45
+ )
31
46
  }x
32
47
 
48
+ ### add support for matchdatafile with season NOT in directory
49
+ ## but starting filename e.g. 2024_friendlies.txt or 2024-25_bundesliga.txt
33
50
 
34
51
 
35
-
36
- def self._find( path )
52
+ def self._find( path, seasons: nil )
37
53
  ## check - rename dir
38
54
  ## use root_dir or work_dir or cd or such - why? why not?
39
55
 
@@ -44,6 +60,11 @@ def self._find( path )
44
60
  ## path = path.gsub( "\\", '/' )
45
61
  path = File.expand_path( path )
46
62
 
63
+ if seasons && seasons.size > 0
64
+ ## norm seasons
65
+ seasons = seasons.map {|season| Season(season) }
66
+ end
67
+
47
68
 
48
69
  ## check all txt files
49
70
  ## note: incl. files starting with dot (.)) as candidates
@@ -51,7 +72,14 @@ def self._find( path )
51
72
  candidates = Dir.glob( "#{path}/**/{*,.*}.txt" )
52
73
  ## pp candidates
53
74
  candidates.each do |candidate|
54
- 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
55
83
  end
56
84
 
57
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.2
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-01-29 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