Download all gems dependencies

Sergio picture Sergio · Dec 9, 2010 · Viewed 34.9k times · Source

I want to install compass by downloading any required file and taking them to another machine without internet connection. I have downloaded the source package for compass and when I run gem on it in the non connected machine it complains about missing dependencies. Any solution?

Answer

jadephantom picture jadephantom · Feb 16, 2012

Thats exactly the problem I had.
After searching around a while I found a Solution who works using Bundler https://bundler.io/

Getting Gem with Dependencies:

  • Create a new Folder with a File named Gemfile in it.
  • Write a Source and the Gem you want to have the dependencys for into the File
  • Bsp:

    source "http://rubygems.org"
    gem 'rails', '3.2.1'

  • Open a Commandline at this Folder an Execute: bundle install
  • This should download and install all Dependencys
  • Execute the Command bundle list if you wanna see it
  • Execute the Command bundle package
  • This should create the Directory Structure vendor/cache
  • Inside the cache Directory are now all the Dependencys you need for your gem

Install Gem on Machine without internet connection:

  • Copy the cache Folder to the Machine
  • Open a Commandline inside the Cache Folder and execute gem install --local Gemname.gem
  • Bsp:

    gem install --local rails-3.2.1.gem