Gemfile.lock应该承诺在Windows上进行源代码控制吗? [英] Should Gemfile.lock be committed to source control on Windows?

查看:120
本文介绍了Gemfile.lock应该承诺在Windows上进行源代码控制吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ruby newb here。

我通过rubyinstaller下载ruby,做了 gem install rails ,解决了一些遗漏库,并最终分叉我想要工作的 ruby​​项目



在触摸任何东西之前,我看到我的Gemfile.lock被修改了:

  diff --git a / Gemfile。 lock b / Gemfile.lock 
index aefda68..9ebccba 100644
--- a / Gemfile.lock
+++ b / Gemfile.lock
@@ -46,6 +46,7 @@ GEM
diff-lcs(1.1.3)
erubis(2.7.0)
eventmachine(1.0.0)
+ eventmachine(1.0.0- x86-mingw32)
execjs(1.4.0)
multi_json(〜> 1.0)
远足(1.2.1)
@@ -65,11 +66,17 @ @ GEM
multi_json(1.3.6)
multi_xml(0.2.2)
pg(0.14.1)
+ pg(0.14.1-x86-mingw32)
polyglot(0.3.3)

...

平台
红宝石
+ x86-mingw32



所有修改过的行似乎都与Windows有关。 这个答案似乎表明我不应该gitignore Gemfile.lock(它已经提交给我克隆的repo)。 这个答案意味着如果我提交&推到heroku(有道理,因为我不希望我的应用程序依赖于Windows特定的文件)。



所以,这是什么?我应该如何解决它?我应该从我的repo中删除Gemfile.lock吗?

解决方案

上次我用Windows Gemfile.lock 它处理得非常优美。我不记得它是否失败并重建了 Gemfile.lock 或者只是去掉了二进制gem标签。



我看到有两个可行的选项。

一个是假设这种行为不会有问题。这意味着使用严格的宝石版本要求或更新您的,并在推送前确认一切正常。

使用 :platform 标志在你的Gemfile中。我不会推荐这个,但它应该强制源代码并在本地编译gem。这意味着任何外部依赖需要可用。有很多二进制宝石(比如 pg gem),这不是一件容易的事情。与其他一些宝石可能几乎不可能。再次,我不会推荐这样做。


Ruby newb here.

I download ruby via rubyinstaller, did gem install rails, resolved a few missing libraries, and finally forked the ruby project I want to work on.

Before touching anything, I see that my Gemfile.lock is modified:

diff --git a/Gemfile.lock b/Gemfile.lock
index aefda68..9ebccba 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -46,6 +46,7 @@ GEM
     diff-lcs (1.1.3)
     erubis (2.7.0)
     eventmachine (1.0.0)
+    eventmachine (1.0.0-x86-mingw32)
     execjs (1.4.0)
       multi_json (~> 1.0)
     hike (1.2.1)
@@ -65,11 +66,17 @@ GEM
     multi_json (1.3.6)
     multi_xml (0.2.2)
     pg (0.14.1)
+    pg (0.14.1-x86-mingw32)
     polyglot (0.3.3)

...

 PLATFORMS
   ruby
+  x86-mingw32

All the modified lines seem to be Windows related. This answer seems to indicate that I should not gitignore Gemfile.lock (it's already committed to the repo I cloned anyway). This answer implies I might get errors if I do commit & push it to heroku (makes sense, since I don't want my app to depend on Windows-specific files).

So, which is it? How should I fix it? Should I delete Gemfile.lock from my repo?

解决方案

Last time I pushed to Heroku with a Windows Gemfile.lock it handled it pretty gracefully. I don't remember if it failed and rebuilt the Gemfile.lock or just stripped the binary gem tags.

There are 2 viable options I see.
One is to assume that there isn't going to be a problem with this behavior. Which means using strict gem version requirements or updating your bundle and confirming everything works before you push.

Another is to use the :platform flag in your Gemfile. I won't recommend this, but it should force the source down and compile the gem locally. Which means any external dependencies need to be available. With a lot of binary gems (like the pg gem) this isn't an easy task. With some other gems it can be nearly impossible. Once again, I would not recommend doing this.

这篇关于Gemfile.lock应该承诺在Windows上进行源代码控制吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆