I am currently in the process of creating a gem and it seems to be considerably bigger than comparative gems.
First of all is this really an issue and if so is there a particular way to reduce the size of the gem?
I am currently in the process of creating a gem and it seems to be considerably bigger than comparative gems.
First of all is this really an issue and if so is there a particular way to reduce the size of the gem?
The gem's
spec/
directory has, when unpacked, over 99MB. You should definitely exclude it from the final gem (even if small). The reason it's so large is because it contains the dummy app withlog/
(80MB) andtmp/
(18MB) directories still present.The way you exclude the files is though the
files
variable in thegemspec
. The variable holds an array of every file that will be put into the built gem.The code will first get the list of every file in the directory (with
git ls-files
it will also apply the rules from.gitignore
) and then removes any file whose path starts withspec
.It's up to you whether you want to include the tests in the final gem or not. The problem is that there's not a easy way of runing the tests. There used to be an option (
-t
) to do that directly via Rubygems but that option has been removed quite some time ago. Given the situation, I think it's probably for the best to just keep the tests in the repository.Note that you might also see a variable called
test_files
in agemspec
. That variable is deprecated and doesn't do anything.