Cómo instalar gema desde GitHub source?


Me gustaría instalar gema desde la última fuente de GitHub.

¿Cómo hago esto?

 422
Author: Anthony Geoghegan, 2010-04-05

10 answers

En caso de que esté utilizando bundler, debe agregar algo como esto a su Gemfile:

gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git'

Y en caso de que haya un archivo .gemspec, debería ser capaz de obtener e instalar la gema cuando se ejecute bundle install.

 316
Author: Misha Reyzlin,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-09-14 19:13:39

Bueno, eso depende del proyecto en cuestión. Algunos proyectos tienen un*.gemspec archivo en su directorio raíz. En ese caso, sería

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

Otros proyectos tienen una tarea rake, llamada "gem" o "build" o algo así, en este caso tienes que invocar "rake ", pero eso depende del proyecto.

En ambos casos hay que descargar la fuente.

 382
Author: Dominik Honnef,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-04-05 07:46:19

Prueba la gema specific_install te permite instalar una gema desde su repositorio github (como 'edge'), o desde una URL arbitraria. Muy útil para bifurcar gemas y hackearlas en múltiples máquinas y cosas así.

gem install specific_install
gem specific_install -l <url to a github gem>

Por ejemplo

gem specific_install https://github.com/githubsvnclone/rdoc.git 
 224
Author: Kamek,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-27 20:01:45

Bundler te permite usar gemas directamente desde repositorios git. En tu Gemfile:

# Use the http(s), ssh, or git protocol
gem 'foo', git: 'https://github.com/dideler/foo.git'
gem 'foo', git: '[email protected]:dideler/foo.git'
gem 'foo', git: 'git://github.com/dideler/foo.git'

# Specify a tag, ref, or branch to use
gem 'foo', git: '[email protected]:dideler/foo.git', tag: 'v2.1.0'
gem 'foo', git: '[email protected]:dideler/foo.git', ref: '4aded'
gem 'foo', git: '[email protected]:dideler/foo.git', branch: 'development'

# Shorthand for public repos on GitHub (supports all the :git options)
gem 'foo', github: 'dideler/foo'

Para más información, ver http://bundler.io/git.html

 29
Author: Dennis,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-29 15:40:26

OBSOLETO (ver comentarios)

Si el proyecto es de github, y está contenido en la lista de http://gems.github.com/list.html , entonces solo puedes agregar el repositorio de github a las fuentes de gemas para instalarlo:

$ gem sources -a http://gems.github.com
$ sudo gem install username-projectname
 17
Author: Michael Pereira,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-17 19:06:06

Si estás obteniendo tus gemas de un repositorio público de GitHub, puedes usar la abreviatura

gem 'nokogiri', github: 'tenderlove/nokogiri'
 13
Author: Rajeev Kannav Sharma,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-03 23:25:37

También puedes hacer gem install username-projectname -s http://gems.github.com

 5
Author: Chuck Vose,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-10-19 21:13:30

Si se instala usando bundler como sugiere gryzzly y la gema crea un binario, asegúrese de ejecutarlo con bundle exec mygembinary ya que la gema se almacena en un directorio bundler que no es visible en la ruta normal de la gema.

 3
Author: Mark Cheverton,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-15 12:09:51

En su Gemfile, agregue lo siguiente:

gem 'example', :git => 'git://github.com/example.git'

También puede agregar opciones de referencia, rama y etiqueta,

Por ejemplo, si desea descargar desde una rama en particular:

gem 'example', :git => "git://github.com/example.git", :branch => "my-branch"

Luego ejecute:

bundle install
 2
Author: slal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-10 01:49:01

En una máquina Linux nueva también necesita instalar el comando git. El comando bundle lo usa entre bastidores.

 1
Author: user1208639,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-30 14:24:35