系统更新后更新所有RVM红宝石和宝石的最佳方法?

时间:2021-12-06 07:16:36

I'm seeking a more streamlined and robust approach to keeping my rvm environment intact after an OS update. I'm using Mountain Lion, rvm 1.18.16 and homebrew, which has readline, gettext, libxml2, libxslt, qt, gtk+ -- the gems that usually break for me are nokogiri and capybara-webkit

我正在寻求一种更加简化和强大的方法来在操作系统更新后保持我的rvm环境完好无损。我正在使用Mountain Lion,rvm 1.18.16和homebrew,它有readline,gettext,libxml2,libxslt,qt,gtk + - 通常为我打破的宝石是nokogiri和capybara-webkit

Twice now after updating Mountain Lion and XCode, my native extension gems and Ruby have suffered breakage and I have to spend time getting everything working again. I have to wonder if I'm following the best practice for getting all the rvm components updated after such system update.

在更新Mountain Lion和XCode后,我的原生扩展宝石和Ruby已经两次遭遇破坏,我不得不花时间让一切都恢复正常。我不得不怀疑我是否遵循了在系统更新后更新所有rvm组件的最佳实践。

What typically happens is that gems with native extensions are linking against old libraries that are no longer available, especially with the libxml issues surrounding Mountain Lion. Here's the basic steps I take to get my system back online across all projects (I have about 8 versions of Ruby installed under rvm, so this is tedious!).

通常情况下,具有本机扩展的gem将链接到不再可用的旧库,尤其是围绕Mountain Lion的libxml问题。这是我让系统在所有项目中重新上线的基本步骤(我在rvm下安装了大约8个Ruby版本,所以这很乏味!)。

First, update Mountain Lion and XCode via the App Store.

首先,通过App Store更新Mountain Lion和XCode。

Second, Update homebrew with:

二,更新自制软件:

brew update
brew upgrade

Then list your rubies and start recompiling each one with...

然后列出你的红宝石并开始重新编译每一个...

rvm list
rvm reinstall ruby-1.9.2-p290
rvm reinstall ruby-1.9.3-p392
...

NOTE: I did try:

注意:我确实尝试过:

rvm all do reinstall

but that gave me this error: "reinstall: command not found"

但这给了我这个错误:“重新安装:找不到命令”

Next up, step through each ruby and perform pristine on the gems (this has side effect of recompiling all native extension gems):

接下来,逐步浏览每个ruby并在gem上执行pristine(这具有重新编译所有本机扩展gem的副作用):

rvm use ruby-1.9.3-p392
gem pristine --all

Finally, go to each project and perform the following:

最后,转到每个项目并执行以下操作:

bundle install

I'm not sure if that last step is strictly necessary -- some projects seemed to be ok, some weren't, but running this seemed to clear up last remaining issues.

我不确定最后一步是否是绝对必要的 - 有些项目似乎没问题,有些项目没有,但是运行这似乎可以解决最后遗留的问题。

Surely there's a more streamlined way to manage this process!? I've only been using both Mountain Lion and rvm for a couple months, but in that time, two system updates have killed most of my working Ruby environment. I have a lot of Ruby versions installed because of my job as a consultant and encountering many development environments, so I'd really like to get this down to an easily repeatable process.

当然,有一种更简化的方式来管理这个过程!?我只使用Mountain Lion和rvm几个月,但在那个时候,两个系统更新已经杀死了我工作的大部分Ruby环境。我安装了很多Ruby版本,因为我担任顾问并遇到许多开发环境,所以我真的很想把它变成一个容易重复的过程。

Any thoughts? Can the above be further improved?

有什么想法吗?以上可以进一步改善吗?

1 个解决方案

#1


13  

You can do:

你可以做:

rvm reinstall all

append --force to skip the questions.

追加--force跳过问题。

Note that will do full reinstall including gem pristine of every gem, you need to pay attention to the output as it will notify you about the gems that failed to executes the pristine action.

请注意,将完全重新安装包括每个gem的gem pristine,您需要注意输出,因为它会通知您有关未能执行原始操作的gem。

#1


13  

You can do:

你可以做:

rvm reinstall all

append --force to skip the questions.

追加--force跳过问题。

Note that will do full reinstall including gem pristine of every gem, you need to pay attention to the output as it will notify you about the gems that failed to executes the pristine action.

请注意,将完全重新安装包括每个gem的gem pristine,您需要注意输出,因为它会通知您有关未能执行原始操作的gem。