Home

Awesome

globby

<img src="https://travis-ci.org/jenseng/globby.svg" />

globby is a .gitignore-style file globber for ruby.

Installation

Put gem 'globby' in your Gemfile.

Usage

# all files matched by the rules
Globby.select(rules)

# all other files
Globby.reject(rules)

# ooh chaining!
Globby.select(rules).reject(other_rules)

An example:

 > rules = File.read('.gitignore').split(/\n/)
-> ["Gemfile.lock", "doc", "*.gem"]

 > pp Globby.select(rules)
["Gemfile.lock",
 "doc/Foreigner.html",
 "doc/Foreigner/Adapter.html",
 "doc/Gemfile.html",
 "doc/Immigrant.html",
 ...
 "immigrant-0.1.3.gem",
 "immigrant-0.1.4.gem"]
=> nil

Why on earth would I ever use this?

Compatibility Notes

globby is compatible with .gitignore rules; it respects negated patterns, and ignores comments or empty patterns. That said, it supports some things that may or may not work in your version of git. These platform-dependent .gitignore behaviors are platform independent in globby and can always be used:

License

Copyright (c) 2013-2016 Jon Jensen, released under the MIT license