Bonjour,

I’ve carefully read the rubygems/bundler#5810 issue and have been thinking more about it.

Whilst I did some experiments with this, too, I am yet to look more on this.

I did and figured that it works like charm. Thanks to Dana for writing this!

Now, this can potentially be used to drop git:

irb(main):001:0> `git ls-files`.split("\n").sort
=> [".gitignore", ".travis.yml", "Gemfile", "LICENSE", "README.md", "Rakefile", "batalert.gemspec", "bin/console", "bin/setup", "config/schedule.rb", "exe/batalert", "lib/batalert.rb", "lib/batalert/version.rb", "test/test_batalert.rb"]
irb(main):002:0> 
irb(main):003:0> require 'fast_ignore'
=> true
irb(main):004:0> FastIgnore.new(relative: true).sort
=> [".gitignore", ".travis.yml", "Gemfile", "LICENSE", "README.md", "Rakefile", "batalert.gemspec", "bin/console", "bin/setup", "config/schedule.rb", "exe/batalert", "lib/batalert.rb", "lib/batalert/version.rb", "test/test_batalert.rb"]

And to check:

irb(main):007:0> x = `git ls-files`.split("\n").sort
irb(main):008:0> y = FastIgnore.new(relative: true).sort
irb(main):009:0> x == y
=> true

Another example:

irb(main):014:0> Dir["config/*", "exe/*", "lib/**/*", "LICENSE", "README.md"]
=> ["config/schedule.rb", "exe/batalert", "lib/batalert.rb", "lib/batalert", "lib/batalert/version.rb", "LICENSE", "README.md"]
irb(main):015:0> 
irb(main):016:0> FastIgnore.new(include_rules: ["config/*", "exe/*", "lib/**/*", 
"LICENSE", "README.md"], relative: true).sort
=> ["LICENSE", "README.md", "config/schedule.rb", "exe/batalert", "lib/batalert.rb", "lib/batalert/version.rb"]

There! Did it, done & dusted! 🔥

Anyway, I further requested rake’s upstream to see if they can add support for respecting all the rules of the gitignore file: ruby/rake#356.


:wq for today.