我应该检查`.ruby-gemset` 和/或`.ruby-version` 吗? [英] Should I check in `.ruby-gemset` and/or `.ruby-version`?

查看:45
本文介绍了我应该检查`.ruby-gemset` 和/或`.ruby-version` 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新了 RVM,代替旧的 .rvmrc,它自动创建了 .ruby-gemset.ruby-version.

我一直有 .rvmrc 文件,其内容类似于 rvm use --create default@project_name.但是,.ruby-version 包含我正在运行的特定 Ruby 版本,而不是 default.我很犹豫要不要签入.

另外,我在播客中听到有人说不应该检查 .ruby-gemset,因为其他人可能对如何命名 gemset 有自己的偏好.

我什么时候应该或不应该签入 .ruby-gemset 和/或 .ruby-version?

特别是:

  • 有哪些权衡?
  • 项目类型如何影响决策(例如,应用程序与 gems)?
  • 如果它们应该被签入,项目的类型如何影响这些文件中应该包含的内容?

来自 rvm、rbenv 等工具创建者的引用将在答案中表示赞赏.

解决方案

对于标准项目

如果您的项目依赖于 ruby-2.0.0 之类的 ruby​​,请检查 .ruby-version.仅当您的团队同意时才签入 .ruby-gemset.将 .rvmrc 添加到 .gitignore 以便任何人都可以使用 .rvmrc 覆盖 .ruby-* 文件设置.

对于宝石

仅当您的项目仍然以 ruby​​ 1.8.7 为目标时,才将 .ruby-versionruby-1.8.7 一起检查,否则检查它仅当您的 gem 需要它时.不要签入.ruby-gemset.

I've just updated RVM, and in place of the old .rvmrc, it auto-created .ruby-gemset and .ruby-version.

I've always had .rvmrc files with contents like rvm use --create default@project_name. However, .ruby-version contains the specific Ruby version I'm running rather than default. I'm hesitant to check this in.

Also, I heard someone say on a podcast that one shouldn't check in .ruby-gemset because others may have their own preferences about how to name gemsets.

When should or shouldn't I check in .ruby-gemset and/or .ruby-version?

Specifically:

  • What are some of the tradeoffs?
  • How does the type of project affect the decision (for example, applications vs gems)?
  • If they should be checked in, how does the type of project affect what should go in these files?

Citations from from the creators of tools like rvm, rbenv, etc would be appreciated in an answer.

解决方案

For standard projects

Check in .ruby-version if your project depends on a ruby like ruby-2.0.0. Check in .ruby-gemset only if your team agreed on it. Add .rvmrc to .gitignore so anyone can override .ruby-* files settings with .rvmrc.

For gems

Check in .ruby-version with ruby-1.8.7 only if your project still targets ruby 1.8.7, otherwise check it in only if your gem requires it. Do not check in .ruby-gemset.

这篇关于我应该检查`.ruby-gemset` 和/或`.ruby-version` 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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