Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Crafting iOS Dev Tools in Redcar, the Ruby Editor

Crafting iOS Dev Tools in Redcar, the Ruby Editor

Redcar is a really fun text editor, written in Ruby and fully customizable. Let's see how we can make iOS development better by building better tools in an expressive language. We don't have to do things all the same way. :-)

Delisa Mason

March 28, 2013
Tweet

More Decks by Delisa Mason

Other Decks in Programming

Transcript

  1. @kattrali Why I like Redcar • It is written in

    Ruby • It is an editor for Ruby • Open source • Easily extensible • Lightweight • It was open source TextMate before TextMate was open source
  2. @kattrali Features • Source control integration • Support for TextMate

    bundles • Fast project navigation between files and methods • Ability to run shell commands and process the output • Syntax checking
  3. @kattrali So many features! • Two-way communication between javascript and

    ruby in embedded web views • Evaluates Ruby code in a REPL and change the editor itself in real time • Easy to test new feature ideas • Excellent RubyMotion support! ΁(◕. ◕ ΁ʣ
  4. @kattrali Under the Hood • Runs on JRuby • Uses

    Standard Widget Toolkit for GUI bindings • Adds functionality by composition • Everything is a plugin
  5. @kattrali Plugin Specification # plugin.rb Plugin.define do name "HTML View"

    version "0.3.2" object "Redcar::HtmlView" file "lib", "html_view" dependencies "core", ">0", "application", ">0", "application_swt", ">0", "edit_view", ">0" end
  6. @kattrali Event Hooks self.menus # Define Menu and Submenu Items

    self.keymaps # Define Keyboard Shortcuts for Menu Items self.toolbars # Define Toolbar Items and Icons self.storage # Define Settings and Defaults self.before_save # Perform an action before saving a tab self.after_save # Perform an action after saving a tab self.templates # Define File Templates under File > New...
  7. @kattrali Composing a Plugin module Redcar class TaskManager # ...

    class Controller include HtmlController # mix in core models to add functionality def title # override default method implementations "Tasks" end def index render :index end end end end
  8. @kattrali My Redcar plugins • help • web_bookmarks • tab_pane

    • line_tools • miniview • templates • groovy support • code-package-view • runnable • terminal • vimly • hotswap • inline documentation • storytracker • clipboard viewer • web bookmarks • grails integration • highlight-line • rubymotion
  9. @kattrali Developing RubyMotion features for Redcar • Only 1,000 lines

    of code • Makes use of AppleScript for iOS Simulator manipulation • Uses SWT bindings for autocompletion http://cloc.sourceforge.net v 1.56 T=0.5 s (32.0 files/s, 2640.0 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Ruby 16 151 76 1093 ------------------------------------------------------------------------------- SUM: 16 151 76 1093 -------------------------------------------------------------------------------
  10. @kattrali Redcar RubyMotion Features • Build, Run and Test Projects

    • Inline syntax checking for MacRuby • Inline documentation lookup • View RubyMotion and iOS reference centers • Send support tickets • Save and install custom templates • View documentation for focused or selected text • Resource Manager pane for adding, removing and viewing project resources • Autocompletion of classes, method names, disturbingly long constants • Deploy and manage beta builds with TestFlight
  11. @kattrali Installation and upgrade • Download and drop into ~/.redcar/plugins

    • git checkout alternate branches for experimental features • Restart Redcar
  12. Future Plans for Redcar+RubyMotion 1.0+ • Stable integrated debugger •

    Commands for attaching profiling tools to a running application (e.g. Instruments) • Smarter autocompletion • Static analysis for Ruby • Better snippets and templates • More testing support