require_all icon indicating copy to clipboard operation
require_all copied to clipboard

Update require_all.rb

Open richpeck opened this issue 3 years ago • 2 comments

This fixes the problem with globbing. Despite what the readme says, "native" globbing doesn't work - with this addition, it does.

richpeck avatar Oct 10 '20 10:10 richpeck

Please describe more what problem did you experience and what does it fix. Also, add a spec for it.

jarmo avatar Oct 10 '20 11:10 jarmo

I'm running Windows 10 with Ruby 2.7.2 and if I used the glob syntax without explicitly calling glob, it would fail, citing the file as not being present:

require_all 'app', 'lib', 'config/*.rb'

ruby

This could easily be resolved by using the Dir.glob syntax (require_all Dir.glob("x/y/**/z.rb"), but I didn't want to.

After digging through the gem's code, I found that the require_all method was treating "config/*.rb" as a file. Thus, I was able to determine that wrapping the file in Dir[], it treated it as a glob path, and worked. It also worked for single files.

I'll do a spec when I get a minute.

richpeck avatar Oct 10 '20 19:10 richpeck