我如何让Textmate使用MacRuby? [英] How do I get Textmate to use MacRuby?
问题描述
那么,如何让Textmate使用MacRuby(1.9.2的一个分支),而不是OSX中默认的Ruby 1.8.7?
So, how do I get Textmate to use MacRuby, a branch of 1.9.2, instead of the default Ruby in OSX, 1.8.7?
推荐答案
从昨晚开始从事此工作……终于使它起作用了
Been working on this since last night…finally got it to work
如何使MacRuby在TextMate上运行
How to Get MacRuby Running on TextMate
通过(johnrubythecat *)
By (johnrubythecat*)
*对约翰·罗比(John robie)的引用,《偷猫贼》中凯瑞·格兰特(cary Grant)扮演的小偷
*reference to john robie, "the cat", thief played by cary grant in To Catch A Thief
OS X上的Ruby当前为1.8.7 但是Ruby的最新版本是1.9.2(速度更快) MacRuby(比RubyCocoa更好)建立在1.9.2上
Ruby on OS X is currently 1.8.7 But latest version of Ruby is 1.9.2 (MUCH faster) And MacRuby (much better than RubyCocoa) is built on 1.9.2
- http://www.ruby-lang.org/en/
- http://www.macruby.org/
- http://rubycocoa.sourceforge.net/Home (已过时,但如果您好奇)
- http://www.ruby-lang.org/en/
- http://www.macruby.org/
- http://rubycocoa.sourceforge.net/HomePage (obsolete, but if you're curious)
因此,以下是使用ruby轻松构建Mac桌面应用程序的说明
So here are instructions for easily building mac desktop apps using ruby
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) http://rvm.beginrescueend.com/
1.2).bash_profile或.bashrc中的源命令(因此可以找到rvm bin):
source $HOME/.rvm/scripts/rvm
1.2) source command in .bash_profile or .bashrc (so rvm bin can be found):
source $HOME/.rvm/scripts/rvm
2)使用rvm安装MacRuby
2) Use rvm to install MacRuby
rvm notes # to see available rubies
rvm install macruby-0.8 # for exmpl
3)然后,rvm --default macruby-0.8
(或至少rvm use macrmacruby-0.8
)
3) then, rvm --default macruby-0.8
(or at least rvm use macrmacruby-0.8
)
4)使用此脚本更新Textmate捆绑包,以确保您是最新的;看到:
4) update Textmate bundles with this script, just to make sure you're up to date; see:
- http://www .christopherirish.com/2010/06/28/how-to-setup-textmate-to-use-rvm/
- 和 https://gist.github.com/455521
- http://www.christopherirish.com/2010/06/28/how-to-setup-textmate-to-use-rvm/
- and https://gist.github.com/455521
--- #!/usr/bin/env bash
mkdir -p /Library/Application\ Support/TextMate/
sudo chown -R $(whoami) /Library/Application\ Support/TextMate
cd /Library/Application\ Support/TextMate/
if [[ -d Bundles/.svn ]] ; then
cd Bundles && svn up
else
if [[ -d Bundles ]] ; then
mv Bundles Bundles.old
fi
svn co http://svn.textmate.org/trunk/Bundles
fi
exit 0
5)为TextMate生成Ruby包装器包装器
rvm wrapper macruby-0.8 textmate
5) Generate Ruby wrapper wrapper for TextMate
rvm wrapper macruby-0.8 textmate
包装器在$HOME/.rvm/bin
中;它叫做textmate_ruby
6)转到TextMate首选项中的shell变量,并将TM_RUBY
设置为
/Users/homedirname/.rvm/bin/textmate_ruby
6) go to shell variables in TextMate preferences and set TM_RUBY
to
/Users/homedirname/.rvm/bin/textmate_ruby
应该做的
7)此脚本运行得很好—打开一个可可窗口
7) this script ran great —opens a Cocoa window
framework 'AppKit'
class AppDelegate
def applicationDidFinishLaunching(notification)
voice_type = "com.apple.speech.synthesis.voice.GoodNews"
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
end
def windowWillClose(notification)
puts "Bye!"
exit
end
def say_hello(sender)
@voice.startSpeakingString("Hello World!")
puts "Hello World!"
end
end
app = NSApplication.sharedApplication
app.delegate = AppDelegate.new
window = NSWindow.alloc.initWithContentRect([200, 300, 300, 100],
styleMask:NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask,
backing:NSBackingStoreBuffered,
defer:false)
window.title = 'MacRuby: The Definitive Guide'
window.level = NSModalPanelWindowLevel
window.delegate = app.delegate
button = NSButton.alloc.initWithFrame([80, 10, 120, 80])
button.bezelStyle = 4
button.title = 'Hello World!'
button.target = app.delegate
button.action = 'say_hello:'
window.contentView.addSubview(button)
window.display
window.orderFrontRegardless
app.run
这是一段视频,讨论如何将MacRuby与XCode集成.
And here is a video discussing how to integrate MacRuby with XCode.
http://thinkcode.tv/catalog/introduction-macruby/
现在是8.99,但我建议您自己购买一些东西. MacRuby已经过时(0.6),但是它显示了在XCode中使用MacRuby的细节,包括设置XIB和建立连接,创建应用程序委托,将Textmate设置为您的外部编辑器.
It's 8.99, but I am recommending something I purchased myself. It's MacRuby is out of date (0.6), but it shows the nuts and bolts of using MacRuby in XCode, including setting up the XIB and making connections, creating the application delegate, setting up Textmate as your external editor.
非常有用.推荐.
这篇关于我如何让Textmate使用MacRuby?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!