简体   繁体   English

从 GitHub 中检出 Ruby Gemfile 中的特定引用

[英]Checking out from GitHub a specific reference within a Ruby Gemfile

So, I have no Ruby experience at all.所以,我根本没有 Ruby 的经验。 However, I'm being asked to look after some Ruby on Rails / Ruby source code that was left behind by my predecessor.但是,我被要求照看我的前任留下的一些 Ruby on Rails / Ruby 源代码。 I'd like to at least get it to install and run within its Docker container.我想至少让它在其 Docker 容器中安装和运行。

From what I can tell, it is failing because of the mimemagic problem from a couple of years ago.据我所知,由于几年前的mimemagic 问题,它失败了。 It has a dependency on mimemagic v0.3.0.它依赖于mimemagic v0.3.0。 I know the right thing to do would be to move on to the recent versions that have not been yanked.我知道正确的做法是继续使用尚未被淘汰的最新版本。 But, with my limited experience with Ruby, I'd like to at least get my predecessor's code to install and run.但是,由于我对 Ruby 的经验有限,我想至少让我的前任代码安装和运行。

Since moving up to the earliest mimemagic that is available (v0.3.7) appears to break other things, I have been trying to install v0.3.0 using the GitHub reference as a work around.由于升级到最早可用mimemagic (v0.3.7) 似乎会破坏其他功能,因此我一直在尝试使用 GitHub 参考安装 v0.3.0 作为解决方法。

This:这个:

gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'

complains that I'm transmitting without encryption.抱怨我在没有加密的情况下传输。 It ultimately fails to fetch with a connection time out.它最终无法获取连接超时。

Meanwhile, this:同时,这:

gem 'mimemagic', git: 'git@github.com:mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'

complains that the host key verification has failed.抱怨主机密钥验证失败。

Finally, this gets me a little further:最后,这让我更进一步:

gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'

but an error later on looks like this:但是稍后出现的错误如下所示:

rake aborted!
Bundler::GitError: The git source https://github.com/mimemagicrb/mimemagic.git is not yet checked out. Please run `bundle install` before trying to start your application

I have this feeling that "quickly getting it to work" isn't a reality and perhaps all of this will take a lot more than the 1-2 days I've spent so far.我有这种感觉,“快速让它工作”不是现实,也许所有这些都比我到目前为止花费的 1-2 天要多得多。 I just would like to check what the correct gem/git commands are, and if any of the above three are close.我只想检查正确的 gem/git 命令是什么,以及以上三个命令中的任何一个是否接近。

Thank you!谢谢!

As the error suggests, you must run the bundle install command before starting the application server or accessing the console.如错误所示,您必须在启动应用程序服务器或访问控制台之前运行bundle install命令。

The reference in the Gemfile is added correctly. Gemfile 中的引用已正确添加。

gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic.git', ref: 'a4b038c6c1b9d76dac33d5711d28aaa9b4c42c66'

If you've already executed the mentioned command, can you update the question to have the output for this command?如果您已经执行了上述命令,您能否更新问题以使用此命令的 output?

PS Read more about the bundle install command here . PS在此处阅读有关bundle install命令的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM