Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install gem from GitHub source?

Tags:

rubygems

I would like to install gem from the latest GitHub source.

How do I do this?

like image 280
Vojto Avatar asked Apr 05 '10 07:04

Vojto


People also ask

How do I install a downloaded gem file?

In the console be located in the gems cache (cd [Ruby Installation version]/lib/ruby/gems/[Ruby version]/cache ) and fire the gem install anygemwithdependencieshere (by example cucumber-2.99. 0 )

How do I install a specific version of a gem?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.


2 Answers

well, that depends on the project in question. Some projects have a *.gemspec file in their root directory. In that case, it would be

gem build GEMNAME.gemspec gem install gemname-version.gem 

Other projects have a rake task, called "gem" or "build" or something like that, in this case you have to invoke "rake ", but that depends on the project.

In both cases you have to download the source.

like image 124
Dominik Honnef Avatar answered Oct 05 '22 05:10

Dominik Honnef


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) 
like image 38
Misha Reyzlin Avatar answered Oct 05 '22 04:10

Misha Reyzlin