Plumage: A RubyMotion CLI App
14 / Oct 2014I wanted to play with terminal.sexy1 recently to see if I wanted a different terminal colour scheme—but as I use Terminal.app, I needed to convert the colour scheme to the iTerm 2 format for import.
I found plumage.rb
by Wilson Lee, which
converts between Terminal.app colours to iTerm 2 colours. It requires
MacRuby2, which does not run on Mac OS X 10.9. I started working on a
translation to pure Ruby, but hit a roadblock because Terminal.app stores much
of its data as archived NSData
objects, requiring NSKeyedUnarchiver
and
NSKeyedArchiver
—which I didn’t have support for in a pure Ruby
implementation.
This was a perfect excuse to use by RubyMotion licence, so I
restarted my porting effort to RubyMotion. I’m using motion-osx-cli
to build a command-line tool with RubyMotion. I had to implement my own
command-line option parser (importing Ruby’s optparse.rb
mostly worked, but
it didn’t handle extra arguments correctly, and caused too much noise on
incorrect arguments).
There is one point I haven’t figured out how to make work, and that’s how to properly codesign a command-line utility with RubyMotion (it will probably require changes to RubyMotion itself).
You can find this code at halostatue/plumage.
- A Terminal Color Scheme Designer, via One Thing Well. ↩
- MacRuby is a dead port of Ruby to the Cocoa runtime. ↩