在 TextMate 中将 RVM 与不同的 gemset 结合使用
我已经按照 RVM 最佳实践 设置了 RVM 并为我的项目制作了单独的 gemset。现在在 TextMate 中运行测试文件不起作用,我有阅读此处该怎么做。问题是它不起作用,因为指南希望我只有一个宝石集(他们称之为“Rails3”)。我通常一次打开 2-3 个项目(使用不同的宝石集),所以我无法有效地使用这种方法。
你们中有人解决了这个问题吗?
I have set up RVM and made individual gemsets for my projects as per the RVM best practices. Now running a test file in TextMate dosen't work and I have read here what to do. The problem is that it won't work because the guide expects me to have just one gemset (they call it "Rails3"). I normally have 2-3 projects open at a time (using different gemsets) so I can't effectively use this approach.
Have any of you solved that problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现 RVM 包装器方法有很多错误,并且正如您所发现的,除非您进行大量繁琐的设置,否则它根本不适用于宝石集。
我使用以下脚本作为
TM_RUBY
取得了一些成功:只要您位于 TextMate 项目中并且项目根目录中有一个
.rvmrc
文件,它就会在.rvmrc
中指定的 Ruby 版本和 gemset 中运行代码。cd
确保 RVM 发现.rvmrc
。将上面的代码放入
~/bin/textmate_ruby_wrapper
中,然后进入 Preferences >高级> Shell 变量并将TM_RUBY
设置为同一路径。I've found the RVM wrappers method to be very buggy, and as you've discovered it doesn't work at all with gemsets unless you do a lot of tedious setup.
I've had some success using the following script as
TM_RUBY
:As long as you're in a TextMate project and you have a
.rvmrc
file in the project root it will run your code in the Ruby version and gemset specified in the.rvmrc
. Thecd
makes sure RVM discovers the.rvmrc
.Put the code above into
~/bin/textmate_ruby_wrapper
and then go to Preferences > Advanced > Shell Variables and setTM_RUBY
to that same path.我发现这个解决方案更简单。在 TextMate 首选项 - 高级 - Shell 变量下:
设置您的 GEM_HOME:
设置您的 GEM_PATH:
I've found this solution which is even simpler. Under the TextMate Preferences - Advanced - Shell Variables:
Set your GEM_HOME:
Set your GEM_PATH: