How to install gem from GitHub source?
In case you are using bundler, you need to add something like this to your Gemfile:
gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git'
And in case there is .gemspec
file, it should be able to fetch and install the gem when running bundle install
.
UPD. As indicated in comments, for Bundler to function properly you also need to add the following to config.ru
:
require "bundler"
Bundler.setup(:default)
Install Gem from Github Branch?
You don't need to build the gem locally. In your gemfile you can specify a github source with a ref, branch or tag.
gem 'rails', git: 'git://github.com/rails/rails.git', ref: '4aded'
gem 'rails', git: 'git://github.com/rails/rails.git', branch: '2-3-stable'
gem 'rails', git: 'git://github.com/rails/rails.git', tag: 'v2.3.5'
Then you run bundle install
or the short form is just bundle
.
Read more about it here: http://bundler.io/man/gemfile.5.html#GIT
Update: There's a github source identifier.
gem 'country_select', github: 'stefanpenner/country_select'
However, they warn against using it: NOTE: This shorthand should be avoided until Bundler 2.0, since it currently expands to an insecure git:// URL. This allows a man-in-the-middle attacker to compromise your system.
After Bundler 2.0, you can get around the above issue with this statement near the top of the Gemfile:
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
Bundle : Install gem from private github repository
Use the "SSH" or "HTTP" URLs to your private repo. For example:
# HTTP (I've found this to be more reliable)
gem 'test', :git => 'https://my_account@github.com/my_account/test.git'
# SSH
gem 'test', :git => 'git@github.com:my_account/test.git'
Don't guess them, though. You can get them by going to your github repo page... there are three options at the top.
It's normal to enter a password if it asks.
Related Topics
Convert String with Comma to Integer
Is Alias_Method_Chain Synonymous with Alias_Method
Paperclip Amazon S3 Setup with Heroku
How to Get the Version from a Gemspec File
Devise Skip_Confirmation! Fails to Avoid to Send the Confirmation Instructions
Rails Sort Tags by Most Used (Tag.Posts.Count)
Detect Rspec Test Failure on After Each Method
How to Loop Through a Daterange with Different Intervals
How to Use Basic Authentication with Httparty in a Rails App
How to Include a Yaml File Inside a Yaml File in Ruby
Strictly Convert String to Integer (Or Nil)
Resetting a Singleton Instance in Ruby
Active Admin Scopes for Each Instance of a Related Model