如何在 textmate 中设置自定义路径来查找我的 ruby 文件?
我是编程新手,并尝试通过一些在线教程来学习 Ruby。我有 textmate,并在我的 Documents 文件夹中创建了一个 Ruby 文件夹来保存我的 .rb 文件。在阅读“为什么令人心酸的指南”时,我遇到了一个两个文件的程序。一个文件试图“要求”另一个文件。但是,这在此文件夹中不起作用。无论如何,有没有办法设置文本伙伴来查看这里。我遇到过一些似乎正在解决这个问题的网站,但我不明白文件路径在 Unix 中是如何工作的。
I'm new to programming and trying to learn Ruby through some online tutorials. I have textmate and have created a Ruby folder in my Documents folder to hold my .rb files. While working through "Why's Poignant Guide" I came a across a two file program. One file attempts to 'require' the other. However, this doesn't work in this folder. Is there anyway to set textmate up to look here. I've come across a few sites that seem to be addressing this but I don't understand how file paths work in Unix.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将
RUBYLIB
变量设置为包含文件的目录。假设它位于~/Documents/Ruby
(即“Documents”文件夹中的文件夹“Ruby”)。~
是/User/yourusername
的简写,因此该目录的完整路径是/Users/yourusername/Documents/Ruby
。您可以在 TextMate 中将其设置为RUBYLIB
,您可以通过转到“首选项”->“RUBYLIB”来完成此操作。高级-> Shell 变量,然后单击“+”按钮,添加RUBYLIB
作为“变量”,添加/Users/yourusername/Documents/Ruby
作为“值”。You'll have to set the
RUBYLIB
variable to the directory that contains your files. Let's say it's at~/Documents/Ruby
(that is, a folder "Ruby" in your "Documents" folder).~
is shorthand for/User/yourusername
, so the full path to the directory is/Users/yourusername/Documents/Ruby
. You'll set this asRUBYLIB
in TextMate, which you can do by going to Preferences -> Advanced -> Shell Variables, then click the "+" button and addRUBYLIB
as the "Variable" and/Users/yourusername/Documents/Ruby
as the "Value".