13

红宝石新手在这里。

我通过 ruby​​installer 下载了 ruby​​,做了gem install rails,解决了一些缺失的库,最后 fork 了我想要处理的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)
     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

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

那么,它是什么?我应该如何解决它?我应该从我的仓库中删除 Gemfile.lock 吗?

4

1 回答 1

1

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.

于 2012-12-26T00:03:06.940 回答