-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Conversation
I notice Rails uses |
Off the top of my head, I'm 👍 this. |
👍 I'm all for smaller gems.. I've had some terrible Internet connections this year and bundling has been painful |
all in there should be only code in gems, no docs, tests, etc... |
@simi To be clear, this patch says nothing about documentation, only tests. I think there’s a good case to be made for packaging documentation, even if that documentation is also available online. @GeekOnCoffee Rails |
I was thinking about separated docs packages. Something similar to Maybe time to move this idea to mail-list. |
Given the prevailing climate of every gem's source being on github (rather than vanishing as individual websites go down or expire), I think this makes sense. It also helps with situations like Bundler itself, where the tests only pass if run from the git repo. |
Cool. Thanks for the feedback. |
Don't package test files with gem
Should reduce the size of the gem. The default for new gems (created by bundler) is not to include test files. See rubygems/bundler#3207
See [this issue on the Bundler repository][issue3207] for reasoning. Basically the test files are available on at the gem's site (Github) and aren't needed for executing the code. If you want to hack on the gem, get it with git. [issue3207]: rubygems/bundler#3207
I was just looking through the code installed for teaspoon, and I noticed that the /spec/dummy directory is huge. It turns out that rubygems is packaging up not only /spec/dummy, but also all the tempfiles and logfiles there *at the time of packaging*. The latest consensus is that test_files shouldn't be packaged with a gem anyway (see rubygems/bundler#3207) because they're never used, so rather than filtering out /spec/dummy/log and /spec/dummy/tmp I've prevented rubygems from packing test files at all.
Tests aren't useful for end users of the gem, and excluding them from the gem them reduces the size of the download. Since rubygems/bundler#3207 this has been the default for gems created using `bundler gem`, and I've taken the code for excluding them from there.
Tests aren't useful for end users of the gem, and excluding them from the gem them reduces the size of the download. Since rubygems/bundler#3207 this has been the default for gems created using `bundler gem`, and I've taken the code for excluding them from there.
* Do not distribute test files * Do not distribute the intermediate api_names_out.yaml file > Reduces the packaged gem size from 1.8Mb to 1.6Mb The practice of not distributing test files with a gem was originally discussed and adopted by the Bundler team here: rubygems/bundler#3207
Rationale: rubygems/bundler#3207 39KB => 29KB
Rationale: rubygems/bundler#3207 39KB => 29KB
Rationale: rubygems/bundler#3207 39KB => 29KB
It reduces the size of the gem by half, from 645K to 294K. The default for new gems (created by bundler) is not to include test files. See rubygems/bundler#3207
It drastically reduces the size of the gem, from 1.9M to 32K. The default for new gems (created by bundler) is not to include test files. See rubygems/bundler#3207
It reduces the size of the gem by half, from 645K to 294K. The default for new gems (created by bundler) is not to include test files. See rubygems/bundler#3207
Rationale: rubygems/bundler#3207 10KB => 9KB
I just 🚢 a new version of the
rails_admin
gem and it took longer to push than I expected. Upon investigating, I realized that was because the gem had grown to 8.1 MB:exclamation: Digging deeper, I was astonished to realize that all but 229 KB were tests! This means that hundreds of thousands of people were downloading a file 36X bigger than necessary to get tests they would almost certainly never run.This may be an extreme example, as RailsAdmin embeds a full Rails app in the spec directory in order to mount itself as a Rails engine. That said, this problem affects almost every gem, albeit to a lesser extent, and I can’t think of a good reason why any gem should package its tests.
Back in the day, there was a service called Gem Testers (originally at gem-testers.org and eventually at test.rubygems.org) and a corresponding
rubygems-test
gem that automatically ran the test suite of a every gem on install, however, this service never gained traction and is now offline.If someone wants to run the tests for a particular gem, they can easily find the source code at the project’s homepage. Ninety-nine percent of the time, when someone installs a gem it’s because they want to execute the code, not the tests. I believe changing this default will improve the health of the RubyGems ecosystem and the Ruby community. If everyone adopts this change,
bundle install
will be significantly faster, especially in places where bandwidth is constrained (e.g. in hotels, at conferences, on airplanes, when tethered to a 3G connection, and in much of the developing world).This patch excludes test files from the
bundle gem
template as well as from Bundler’s own gemspec.