我想从最新的GitHub源安装gem。

我怎么做呢?


当前回答

你也可以执行gem install username-projectname -s http://gems.github.com

其他回答

如果你从一个公共的GitHub存储库中获取你的gems,你可以使用这个简写

gem 'nokogiri', github: 'tenderlove/nokogiri'

过时(见评论)

如果项目来自github,并且包含在http://gems.github.com/list.html的列表中,那么你可以将github repo添加到gems源代码中来安装它:

$ gem sources -a http://gems.github.com
$ sudo gem install username-projectname

你也可以使用rdp/specific_install gem:

gem install specific_install
gem specific_install https://github.com/capistrano/drupal-deploy.git

Bundler允许你直接从git存储库中使用gems。 在您的Gemfile中:

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

# Specify a tag, ref, or branch to use
gem 'foo', git: 'git@github.com:dideler/foo.git', tag: 'v2.1.0'
gem 'foo', git: 'git@github.com:dideler/foo.git', ref: '4aded'
gem 'foo', git: 'git@github.com:dideler/foo.git', branch: 'development'

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

欲了解更多信息,请访问https://bundler.io/v2.0/guides/git.html

你也可以执行gem install username-projectname -s http://gems.github.com