How to Significantly Speed Up Gem Installation
Brian Dainton, a developer at FiveRuns, demonstrates "how to speed up gem installs 10x." I don't buy that it's ten times faster, but disabling the generation of ri and rdoc documents does have a significant effect nonetheless.
Brian demonstrates that you can try it on an ad-hoc basis by adding --no-ri --no-rdoc
to your gem install
lines, or you can add gem: --no-ri --no-rdoc
to your ~/.gemrc
file.
Sometimes it's the smaller, throwaway tips that can really brighten your day. Got any time-saving .irbrc
or .gemrc
tips to share?If we get enough, we could run a post full of them.
March 4, 2009 at 9:23 pm
I just learned this same tip about a week earlier from our operations guy. In a similar vein, pulling down gem docs and running 'gem server' locally can be a good productivity boost for development.
http://whatcodecraves.com/articles/2009/02/28/rails_and_gems_documentation_anywhere
March 4, 2009 at 9:26 pm
The only problem I've found with this idea is that you then have no RDocs locally for your gem. Most of the time, not a big deal. However, in the case of the 800lb gorilla, Rails, if you don't have the RDoc for your older versions, you can be lost when trying to code for your old site/program that uses an older API. I have run into this problem even just going from Rails 2.1 to 2.2. I was trying to do something with an ActiveRecord object and found a great option for has_many in the online RDoc...urg, why doesn't it work...oh, it was introduced in 2.2 and I'm on 2.1.
March 4, 2009 at 9:31 pm
This is especially useful on automated server installations (eg, with Chef), when you don't really need the documentation and would like to bootstrap a system quickly.
March 4, 2009 at 9:46 pm
I use the tricks for .irbrc posted recently by thoughbot: http://giantrobots.thoughtbot.com/2008/12/23/script-console-tips
I had syntax highlight in irb for a long time, but the logger in ./script/console was very useful addition!
March 5, 2009 at 12:49 am
Its worth noting that Sprinkle does this out of the box, you can also re-enable rdoc and ri installation if you so wish to.
March 5, 2009 at 8:08 am
Erik, try http://apidock.com/rails, they have docs for Rails since version 1.0.0.
March 5, 2009 at 5:50 pm
@Erik: same thing as szeryf, but I prefer Rails Brain.
March 5, 2009 at 9:06 pm
A common irb 'trick' I use is reloading a file I've required: http://github.com/cldwalker/my_core/blob/36a995109fbf8ab58cb5f6a17ce9d98071d60f57/lib/my_core/object.rb#L20-23
For example: If I want to reload a required path 'hirb/display', then I reload it with: irb>> reload 'hirb/display'
My irbrc files are at http://github.com/cldwalker/irbfiles/tree/master
March 6, 2009 at 12:24 pm
No documentation.
March 7, 2009 at 8:43 pm
Another great way to speed up gem installs is to setup an internal gem mirror. It's dead simple: only requires a web virtual host and the gem command. This has an added benefit of allowing you to stage your own gems or add gems from other servers. Try your luck with the 'gem mirror' command, or use the following simpler method:
http://rubyforge.org/docman/view.php/5/231/mirror_setup.html
Also see our Chef recipe for creating a mirror: http://tinyurl.com/bj6ubl