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

我怎么做呢?


当前回答

尝试specific_install gem,它允许您从其github存储库(如'edge')或从任意URL安装一个gem。非常有用的分叉宝石和黑客对他们在多台机器等。

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

e.g.

gem specific_install https://github.com/githubsvnclone/rdoc.git 

其他回答

尝试specific_install gem,它允许您从其github存储库(如'edge')或从任意URL安装一个gem。非常有用的分叉宝石和黑客对他们在多台机器等。

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

e.g.

gem specific_install https://github.com/githubsvnclone/rdoc.git 

在一台新的Linux机器上,您还需要安装git。Bundle在幕后使用它。

这取决于所讨论的项目。有些项目有*。Gemspec文件在他们的根目录。在这种情况下,它将是:

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

其他项目有一个rake任务,称为gem或build或类似的东西。在这种情况下,您必须调用rake <taskname>,但这取决于项目。

在这两种情况下,您都必须下载源代码。

在您的Gemfile中,添加以下内容:

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

你也可以添加ref, branch和tag选项,

例如,如果你想从一个特定的分支下载:

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

然后运行:

bundle install

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