13
votes

First let me say I cannot do gem install, I don't know why. Probably because I live in China and the firewall random things.

So I have to locally install gems. For example, i want to install this gem riddle. But this gem downloads as a tar or zip and when i open it it is a folder not a .gem file.

So what to do?

2
Just out of curiosity, what do you get when you do gem install?Ben

2 Answers

21
votes

You can do gem build whatever.gemspec inside of the directory that you untar/unzip -- that will produce a .gem file, then do gem install whatever.gem.

You need to be at the directory where you unzip the gem file for example

C:\railsinstaller\ruby2.2.0\lib\ruby\gems\2.2.0\gems> gem install rails-5.0.0.1.gem

and that's it - you are done downloading and installing Rails.

1
votes

To avoid the gem build step, and to always run the actual code, bundler can install from a local path:

gem 'pry', path: './pry'

in a Gemfile.

... where ./pry would be the clone of your repository.

Simply run bundle install once, and any changes in the gem sources you make are immediately reflected. With gem build pry / gem install pry/pry.gem, the sources are still moved into GEM_PATH and you'll always have to run both gem build pry and gem update again if you make changes.