Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install a gem from a downloaded tar or zip

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?

like image 305
thenengah Avatar asked Dec 08 '09 04:12

thenengah


People also ask

How do I install specific gems?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

Where gem files are installed?

By default, binaries installed by gem will be placed into: /usr/local/lib/ruby/gems/3.1. 0/bin You may want to add this to your PATH.


2 Answers

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.

like image 184
Ben Avatar answered Oct 01 '22 15:10

Ben


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.

like image 41
Matthias Winkelmann Avatar answered Oct 01 '22 14:10

Matthias Winkelmann