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" }
Install ruby gem globally from github repository
Download the source:
git clone https://github.com/thoughtbot/capybara-webkit.git
Build the gem:
cd capybara-webkit && gem build capybara-webkit.gemspec
Install it (the filename/version may vary):
sudo gem install capybara-webkit-0.14.1.gem
How to install the git head of a gem through Rubygems.org?
Is there a way to force a gem to be installed with the latest commitThe short answer is no, you cannot force-install an unpublished gem through RubyGems.org because RubyGems is a repository for published gems. If the repository owner has pushed a version of the gem to RubyGems you can find and install it. If they haven't, you can't.
through Rubygems.org without using Bundler?
If you want to use pre-published code from a repository, use the Bundler method outlined in Semih's answer:
gem 'rails', github: 'rails/rails', branch: 'master'
Per the RubyGems site documentation:Installing a gem directly from a git repository is a feature of
Bundler, not a feature of RubyGems. Gems installed this way will not
show up when you run gem list.
Installing a Ruby gem from a Github repository using Chef?
Quite old question, but you can use http://community.opscode.com/cookbooks/gem_specific_install
I don't maintain it actively, but I'm quite open to new PR
Install a ruby gem from a local repository
In your local repository:
gem build yourlocalrepo.gemspec
This will create a .gem
file.Now:
gem install yourlocalrepo.gem
Related Topics
How to Test Strong Params with Rspec
Save PDF File Shown by Pdfkit Middleware
Ruby How to Generate a Tree Structure Form Array
Waiting for Ruby Child Pid to Exit
Typeerror: Can't Convert Net::Httpok into String
Rails 4 - Devise: Getting Actioncontroller::Unknownformat on Signup
Stripping Commas from Integers or Decimals in Rails
How to Programmatically Remove "Singleton Information" on an Instance to Make It Marshal
Question on Ruby Collect Method
How to Make Devise Registrationscontroller to Show Sign_Up Page Only If User Is Already Signed In
Ruby: Class C Includes Module M; Including Module N in M Does Not Affect C. What Gives
Rails How to Tell If a Sidekiq Worker Is Done with Perform_Async
How to Change "3 Errors Prohibited This Foobar from Being Saved" Validation Message in Rails
How to Add Values Dynamically to I18N