Contenu connexe Similaire à GUI Programming with MacRuby (20) GUI Programming with MacRuby7. I’ve committed to...
rails oauth2 rvm
rails_admin faraday bunder
merb_admin thor travis-ci
twitter multi_json dummy_data
twurl multi_xml git-pulls
simple_oauth octokit mlb
9. Who else?
@lrz @benstiglitz
@merbist @importantshock
@rich_kilmer @naixn
@alloy @watson1978
@vincentisambart @Psychs
@macruby macruby-devel
11. What
MacRuby
1. A complete implementation of Ruby 1.9
14. What
MacRuby
1. A complete implementation of Ruby 1.9
2. Allows you to script existing Mac apps
3. Allows you to create new Mac apps
25. MacRuby Hello World
require 'hotcocoa'
include HotCocoa
application do |app|
win = window :size => [100,50]
b = button :title => 'Hello'
b.on_action { puts 'World!' }
win << b
end
26. RubyCocoa Hello World
require 'osx/cocoa'
include OSX
app = NSApplication.sharedApplication
win = NSWindow.alloc.initWithContentRect_styleMask_backing_defer(
[0, 0, 200, 60],
NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask,
NSBackingStoreBuffered, false)
win.title = 'Hello World'
button = NSButton.alloc.initWithFrame(NSZeroRect)
win.contentView.addSubview(button)
button.bezelStyle = NSRoundedBezelStyle
button.title = 'Hello!'
button.sizeToFit
button.frameOrigin = NSMakePoint((win.contentView.frameSize.width / 2.0) - (button.frameSize.width / 2.0),
(win.contentView.frameSize.height / 2.0) - (button.frameSize.height / 2.0))
button_controller = Object.new
def button_controller.sayHello(sender)
puts "Hello World!"
end
button.target = button_controller
button.action = 'sayHello:'
win.display
win.orderFrontRegardless
app.run
30. When
MacRuby
NOW!
Version 0.10
Version 1.0 coming soon
31. When
MacRuby
MacRuby will be included
with Mac OS X 10.7 Lion*
*currently as a private framework :(
33. Why
MacRuby
• You already know Ruby
• Use existing Ruby gems
• Ruby 1.9.2
• No GIL
• Multi-threaded generational GC
• Fast!
34. Performance Benchmarks
8
Ruby 1.9 MacRuby
7
6
5
4
3
2
1
app_answer app_tarai so_object vm1_ivar_set vm2_proc vm2_zsuper
37. How
MacRuby
macruby.com
38. How
MacRuby
rvm get head
rvm install macruby
40. How
MacRuby
brew install llvm
port install llvm
42. How
MacRuby
Free with ADC account at
developer.apple.com/tools/xcode
or $4.99 on the Mac App Store