Worked on it from last night ... finally got it to work
How to run MacRuby in TextMate
By (johnrubythecat *)
* link to john robie, "cat", a thief played by cary grant in To Catch A Thief
Ruby on OS X is currently 1.8.7 But the latest version of Ruby is 1.9.2 (MUCH FASTER) And MacRuby (much better than RubyCocoa) is built on 1.9.2
, ruby
RVM
1) rvm git
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) http://rvm.beginrescueend.com/
1.2) .bash_profile .bashrc( bin rvm):
source $HOME/.rvm/scripts/rvm
MACRUBY
2) rvm MacRuby
rvm notes
rvm install macruby-0.8
3), rvm --default macruby-0.8
(, , rvm use macrmacruby-0.8)
.
4) Textmate script, , ; :
---
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) Ruby TextMate
rvm wrapper macruby-0.8 textmate
$HOME/.rvm/bin; textmate_ruby
6) TextMate TM_RUBY
/Users/homedirname/.rvm/bin/textmate_ruby
7) script - Cocoa
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.
http://thinkcode.tv/catalog/introduction-macruby/
8.99, , . MacRuby (0,6), MacRuby XCode, XIB , , Textmate .
. .