Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem bundle install from local resource

can I redirect gem source to my web server path, where I'll download all necessary gem bundles and put there? I want to use those by "bundle install"

GemFile will fetch those from http://rubygems.org as it is defined on there. I usually got an error like "too many requests" (seems internet congestion issues).

is it possible to redirect gem source path to my local server?

like image 303
Mujah Maskey Avatar asked May 22 '11 14:05

Mujah Maskey


2 Answers

TL;DR: Use the :path option.


Assuming you want to install a gem from a not reachable resource, such as:

# Gemfile
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'

and you can't install the gem using bundle install because of a firewall or something.

Following these steps:

  1. Download the file (using any approach you can, e.g. using http_proxy, from https://github.com/sferik/rails_admin/zipball/master)

  2. Put the downloaded file into a folder, such as vendor/gems/rails_admin, and the file in it should look like:

    $ ls vendor/gems/rails_admin
    app  config  Gemfile  Gemfile31  lib  LICENSE.md  rails_admin.gemspec  Rakefile  README.md  screenshots  spec
    
  3. Now let's modify your Gemfile:

    gem 'rails_admin', :path => "vendor/gems/rails_admin"  
    
  4. Run bundle, works!

like image 158
Siwei Avatar answered Nov 04 '22 00:11

Siwei


you can do bundle install --local

from here more detail

like image 30
roxxypoxxy Avatar answered Nov 04 '22 01:11

roxxypoxxy