[英]Issue with require gem, when passing git-repo to gem in Gemfile
I haven't done this in the past, so may be I am missing something here. 我过去没有这样做过,所以我可能会在这里遗漏一些东西。
I changed the Gem files for 'ruby-git' locally and it worked fine. 我在本地更改了'ruby-git'的Gem文件,它运行正常。 I forked a gem and made same changes to it, in my Github repo.
在我的Github回购中,我分叉了一个宝石并对它进行了相同的更改。
While building the Sinatra app to push it to Heroku, I changed the Gemfile
as follows: 在构建Sinatra应用程序以将其推送到Heroku时,我更改了
Gemfile
,如下所示:
gem 'git', :git => "git://github.com/silverSpoon/ruby-git.git"`
When I run bundle install
, I get 当我运行
bundle install
,我得到了
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rugged 0.21.0
Using sinatra 1.4.5
Using git 1.2.8 from git://github.com/silverSpoon/ruby-git.git (at master)
Your bundle is complete!
⇒ gem list git
, it doesn't show the gem as installed. ⇒ gem list git
,它不会显示已安装的宝石。 ⇒ bundle show git
, it shows the path where the gem repo was installed - ⇒ bundle show git
,它显示了安装gem repo的路径 - /Users/jatinganhotra/.rvm/gems/ruby-2.1.3@527website/bundler/gems/ruby-git-c7fb35af1a99
irb
and do a 2.1.3 :001 > require 'git'
irb
并执行2.1.3 :001 > require 'git'
LoadError: cannot load such file -- git
Am I missing something silly here? 我在这里想念傻事吗?
Gems installed by Bundler through git are not handled the same way as normal gems : Bundler通过git安装的Gems的处理方式与普通gem不同 :
Because Rubygems lacks the ability to handle gems from git, any gems installed from a git repository will not show up in
gem list
.由于Rubygems缺乏从git处理gems的能力,因此从git存储库安装的任何gem都不会显示在
gem list
。 They will, however, be available after runningBundler.setup
.但是,它们将在运行
Bundler.setup
后Bundler.setup
。
In order to use the gem you need to do it through Bundler. 为了使用gem,您需要通过Bundler来完成它。 Either use
bundle exec
when launching IRB or your app, or use Bundler.setup
from within your code. 启动IRB或您的应用程序时使用
bundle exec
,或者在代码中使用Bundler.setup
。
$ bundle exec irb
> require 'git' # should work ok
or: 要么:
$ irb
> require 'bundler/setup'
> require 'git' # should also work
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.