Reputation: 981
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
Upvotes: 4
Views: 1105
Reputation: 34338
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.
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'
Upvotes: 3
Reputation: 2378
Not sure what you mean, but the gem is definitely "installed". You can validate that by doing gem which test_gem
from the directory your code is in.
If you want it to look like the other gems, test_gem
must be hosted on a gem server like rubygems.org. If you own test_gem
and would like to publish it, RubyGems provides a lot of helpful guides to do it with
Upvotes: 0