I’ve recently begun publishing a number of small gems, and I’m not clear on what files should included in a gemspec’s file directive.
This confusion initially arose since the RubyGems specification guide includes tests…
require 'rake'
spec.files = Dir['lib/ *.rb'] + Dir['bin/*']
spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
spec.files.reject! { |fn| fn.include? "CVS" }
…while Bundler excludes all tests with it’s own voodoo: git ls-files -z
.split(“\x0”).reject { |f| f.match(%r{^(test|spec|features)/}) }`
I also sifted through unpacked gems written by people I respect and admire tremendously, and there doesn’t seem to be an appreciable pattern.
The files that clearly MUST be included are files necessary to use the gem (e.g. /lib
) and any additional files required to build the documentation such as the README. The following is still unclear:
I’d greatly appreciate some insight from you all, and I feel like the community would greatly benefit if the decided best practice were documented in the specification guide as well.
Thanks!
Faraz