This is a talk that I gave for the Boston Ruby Group on Dec. 13, 2011. The talk covers the use of MacRuby as a Cocoa REPL for learning and exploration, and integration between MacRuby and Xcode for
This is a talk that I gave for the Boston Ruby Group on Dec. 13, 2011. The talk covers the use of MacRuby as a Cocoa REPL for learning and exploration, and integration between MacRuby and Xcode for the development of OS X applications.
MacRuby For fun... and proﬁt!Presented by: Joshua Ballanco
A quick introduction...• Been using Ruby since 2004• MacRuby Core Team member• Worked for Apple 2006 to 2010• Currently at Patch (AOL)• https://github.com/jballanc• @manhattanmetric
Overview• Using MacRuby as a Cocoa REPL• Cocoa Development with MacRuby • Getting Started • Building and Running • Hooking Up a UI • Using Gems • Packaging and Shipping
What is MacRuby?• http://www.macruby.org• http://www.macruby.org/ﬁles/• http://www.macruby.org/ﬁles/nightlies/• Available from RVM (but not recommended)• Source at GitHub: https://github.com/MacRuby/MacRuby
What is MacRuby?• Compiling MacRuby: • Need LLVM *2.9* (see the README) • rake ; sudo rake install• Bugs – https://www.macruby.org/trac/report• MacRuby-devel mailing list• @macruby, #macruby
MacRuby for Fun!• Let’s learn CoreData!• There sure is a lot of documentation on http://developer.apple.com about CoreData• Documentation is boring... :-(
MacRuby for Fun!• Let’s learn CoreData!• There sure is a lot of documentation on http://developer.apple.com about CoreData• Documentation is boring... :-(• REPLs are fun! :-)
MacRuby for Proﬁt!• Things you will need: • MacRuby nightly build (or 0.11 when it comes out) • Xcode 4.2 (v4.1 is deﬁnitely broken, v3- series may still work) • Gumption (and the mailing list address)
MacRuby for Proﬁt!• Install Xcode FIRST! then MacRuby• Start Xcode, choose the MacRuby template• Build and go!
Building and Running• MacRuby template already contains targets needed to compile, build, and run• macruby_deploy does all the hard work...
Hooking Up a UI• MacRuby classes are Objective-C classes• Deﬁne outlets with attr_* methods• Any MacRuby method with a single argument named “sender” can be used as an action
Using Gems• Install with sudo macgem install <gemname>• Require Gems in rb• Use Gems for Development• Vendor Gems with macruby_deploy --gem for Distribution
Packaging and Shipping• App bundles generated by macruby_deploy are relocatable to machines without MacRuby (or even with incompatible versions of MacRuby)• Bundles can be signed for App store distribution with the codesign CLI tool• Excellent blog post at: http://astonj.com/ tech/how-to-submit-your-macruby-app-to- the-mac-app-store/
MacRuby......and you didn’t even know it!!!• CocoaPods!• https://github.com/CocoaPods/CocoaPods• Like Gems for iOS (and OS X... and MacRuby)• Uses MacRuby under the covers• Complemented by Laurent Sansonetti!