Skip to content

Commit a84ab9d

Browse files
gabetaxfloehopper
authored andcommitted
Remove docs & tests from gem to reduce its size by over 50%
I was looking through https://rubygems.org/gems/mocha/versions and noticed the .gem's file size increased from 94kb in v1.7.0 to 219kb in v1.8.0 - an increase of 125kb. The culprit seems to be the addition of generated docs to the repo in 4a85555. I don't think there reasonable value in including the generated docs in the compiled .gem, especially for the byte size increase. Gem users still can locally still produce documentation with rdoc/ri. I've also removed the test directory, since they are not useful to gem users. I'm using the syntax from the gemspec used in `bundle gem` [1]. [1]: https://github.com/rubygems/bundler/blob/v2.1.4/lib/bundler/templates/newgem/newgem.gemspec.tt#L23-L27
1 parent e5b9fee commit a84ab9d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mocha.gemspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
1212
s.description = 'Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.'
1313
s.email = '[email protected]'
1414

15-
s.files = `git ls-files`.split("\n")
15+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
16+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|test)/}) }
17+
end
1618
s.files.delete('.travis.yml')
1719
s.files.delete('.gitignore')
1820

0 commit comments

Comments
 (0)