Everyone might have used the (Bundler) for managing the rubygems dependencies.
But whenever we do bundle install and if the internet connection is slow or average, we feel the pain of waiting and waiting.
This might not be so much of a pain if your Gemfile contains couple of gems. But if your app uses many gem dependencies, it will be a pain.
There are many quests on solving this problem.
At first (Nando Vieira) gave a shot for this (Rubygems proxy)
And then (Akita) tweaked it to request the file directly from production.cf.rubygems.org with (his fork)
But still the setup process has to be dealt with the couple of configurations with apache + passenger + /etc/hosts file.
Recently, the guys from 37Signals released (Pow) which they advertise as Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute.
Pow makes it super simple to launch a server just by symlinking the project folder inside the ~/.pow directory.
To ease this even further, Adam created a rubygem named (powder) which gives us the executable binary powder after installing the gem.
Setup
So here is my 3 simple steps that I use to setup a Rubygems proxy cache on local machine.
1. Setup the Pow
curl get.pow.cx | sh2. Clone the proxy repo
cd
git clone git://github.com/akitaonrails/rubygems_proxy.git rubygems3. Link the app with Pow using the powder gem command
cd rubygems
powder link
That’s it. So, now if you visit the page at http://rubygems.dev, you’d be seeing the site.
To use it, edit your ~/.gemrc file’s source to http://rubygems.dev instead of http://rubygems.org and same goes for the project’s Gemfile if you are using Bundler.
What this setup actually does?
Now whenever you do gem install <some-gem> or bundle install, it will search the index of the local http://rubygems.dev and if it doesn’t find the required gem with particular version, it goes to the remote http://rubygems.org, gets the gems, cache it and install it.
Now, when we do gem install <some-gem> or bundle, those gems which were previously cached will be installed right from the local cache with magnitudes of speed.
If you’ve any other kinds of solution, questions or suggestions, please discuss in the comments.