Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install a ruby gem from a local repository

Tags:

ruby

rubygems

I have a git repository locally which contain a SDK project in ruby. I want to install the gem file from this local repo. It has the gemfile and gemspec files as well. Please help me on this. I tried to find a solution online but all of them are for .gem file which is locally stored not for a repo it self.

like image 365
Gihan Avatar asked Feb 27 '15 05:02

Gihan


People also ask

Where do I put RubyGems?

When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.

What is gem install command?

The gem command allows you to interact with RubyGems. Ruby 1.9 and newer ships with RubyGems built-in but you may need to upgrade for bug fixes or new features. To upgrade RubyGems, visit the download page. If you want to see how to require files from a gem, skip ahead to What is a gem. Finding Gems.


2 Answers

In your local repository:

gem build yourlocalrepo.gemspec

This will create a .gem file. Now:

gem install yourlocalrepo.gem
like image 156
shivam Avatar answered Sep 20 '22 12:09

shivam


If your SDK project's gem was initialized by bundle gem command, the modern way for starting a gem, then the gem project would be configured so that the basic gem related tasks are available through the rake command of the project.

Namely, in my gem project I can execute

rake install:local

to build the gem being developed and install the artifact to local system.

like image 38
Yuki Inoue Avatar answered Sep 20 '22 12:09

Yuki Inoue