Support file name patterns (globs) to find files
Problem
Currently we only support exact matches on the file system and no globs as in https://rubyapi.org/3.3/o/file#method-c-fnmatch.
This prevents matching lib/api/issues.rb
to spec/requests/issues/*_spec.rb
.
The following configuration is currently not supported:
mapping:
- source: 'lib/api/(.*)\.rb'
test: 'spec/requests/%s/*_spec.rb'
- source: '(ee/)?app/models/(.+)\.rb'
test: '%sspec/models/%s/**/*_spec.rb'
Proposed solution
Use Dir.glob
instead of File.exists?
to allow the configuration above.
Performance consideration
Using Dir.glob
is slower than File.exists?
and we need to test the difference.
Edited by Peter Leitzen