excluding dot files from gems

Ken Dreyer ktdreyer at ktdreyer.com
Wed Dec 11 18:46:47 UTC 2013


Lots of gems ship dot files, like .gitignore or .travis.yml. These are
basically useless to users, and in our RPMs, we have to exclude these
files by hand.

The problem is that a lot of gems do something like this in the gemspec:

   s.files         = `git ls-files`.split("\n")

I end up repeating the same exclusions over and over in the RPM
packaging. I've been brainstorming about the best way to push the dot
file exclusions upstream.

What do you think about something like this?

--- a/pkgwat.gemspec
+++ b/pkgwat.gemspec
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
   s.add_development_dependency("debugger")

   s.files         = `git ls-files`.split("\n")
+  s.files        -= `git ls-files -- .??*`.split("\n")
   s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
   s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(
   s.require_paths = ["lib"]

It seems like this would be a good pattern to propose to the various
upstreams, but I wanted to get others' opinions first.

- Ken


More information about the ruby-sig mailing list