When unpacking, the gem spec/ folder has more than 99 MB. You must exclude it from the final gem (even if it’s small). The reason it is so large is because it contains a dummy application with the log/ (80MB) and tmp/ (18MB) directories.
The way you exclude files is the files variable in gemspec . The variable contains an array of each file to be placed in the built-in stone.
Gem::Specification.new do |gem| gem.files = `git ls-files`.split($/).reject { |fn| fn.start_with? "spec" } ... end
First, the code will get a list of all the files in the directory (with git ls-files it will also apply the rules from .gitignore ), and then it will delete any file whose path starts with spec .
It depends on whether you want to include tests in the final stone or not. The problem is that there is no easy way to test. There used to be an option ( -t ) to do this directly through Rubygems, but this option was removed quite a while ago. Given the current situation, I believe that perhaps the best way is to run tests in the repository.
Note that you can also see a variable called test_files in gemspec . This variable is deprecated and does nothing.
source share