Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to host gem in Github and use it?

I have added the private gem files to new repository in here but when I try to add it to my gem file

gem 'test_gem' , :git => 'https://github.com/praveenitmec/testgem.git'

It is not installing gem instead it trying to use it directly from Github.Like this

Using spring 1.4.0
Using sqlite3 1.3.11
Using test_gem 0.1.0 from https://github.com/praveenitmec/testgem.git    (at master)
Using turbolinks 2.5.3
Using typhoeus 0.8.0

How to install this gem from github.

The actual Procedure is the bundler has to fetch gemspec file from the Github and by using that it will install gem in local.But for me it is not installing in the local.Did I miss any configuration.

Got It:I came to know that if use Git for gem it wont get installed in local Thanks to K M Rakibul Islam

like image 215
Praveenkumar Avatar asked Sep 01 '25 21:09

Praveenkumar


2 Answers

If you want to use your own gem, you can specify that using the git option in your Gemfile:

gem 'test_gem', git: '[email protected]:praveenitmec/testgem.git', branch: 'master'

And, then run:

bundle install

This is the correct way of using a private gem that you don't want to share with anyone else outside your company.

But, if you want to share your gem publicly, you can publish the gem and use that like any other gem in your Gemfile. To know how to publish a gem, tehre are many articles online that you can search for. Here is one of them.

Update

If you want to use the local version of the gem, then you have to specify using the path option this way:

gem 'test_gem', path: 'path_to_your_test_gem'
like image 55
K M Rakibul Islam Avatar answered Sep 03 '25 11:09

K M Rakibul Islam


Try this gem 'test_gem', github: 'praveenitmec/testgem'

like image 21
Pardeep Saini Avatar answered Sep 03 '25 11:09

Pardeep Saini