diff --git a/html-pipeline.gemspec b/html-pipeline.gemspec
index d53aab6b..e5ac3404 100644
--- a/html-pipeline.gemspec
+++ b/html-pipeline.gemspec
@@ -11,8 +11,7 @@ Gem::Specification.new do |gem|
gem.summary = %q{Helpers for processing content through a chain of filters}
gem.homepage = "https://github.com/jch/html-pipeline"
- gem.files = `git ls-files`.split $/
- gem.test_files = gem.files.grep(%r{^test})
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f =~ %r(^(test|gemfiles|script)/) }
gem.require_paths = ["lib"]
gem.add_dependency "nokogiri", ">= 1.4"