I’ve been spending a lot of time lately working on the Redcar Text Editor. It’s become my favorite way to spend my personal hacking time. My most recent contribution has been some work on “Runnables” which is the Redcar plugin that lets you run commands from inside the editor. Even one of the collaborators on the project didn’t really know how to use it so I thought I’d write an explaination.
Like I said Runnables lets you run commands inside Redcar. It let’s you set up two types of commands:
Ctrl+R if your current file matches a regex.
You define these runners in
.redcar/runnables/mycommands.json. Runnables will read any
*.json file in that directory.
The file also gets processed whenever you hit
Ctrl+R so you can edit the file runners as much as you like. At the
moment, it looks like you have to re-open your project for Commands to get refreshed. I might fix that soon though.
So here’s my
features.json file which allows me to run a full test suite as well as use
Ctrl+R to run
individual Cucumber and RSpec tests:
So as you can see, the command is just the command that gets run if the file’s path matches
regex and the file path gets
substituted for the
__PATH__ in the command. I still haven’t really figured out what the type and description fields do
for you yet, but I expect I will soon.
If you use my color-and-scrolling-runnables branch you’ll also get support for ANSI color output and automatic scrolling (courtesy of Delisa Mason). Hopefully both of these features will be in master soon. Here are the commands to force color if you want to give it a try:
I’ve been told that this plugin only works on Unix systems right now. So Windows users can’t partake in the awesomeness just yet. I’ll see how I can help there.
I haven’t found a way to make a general
*.rb matcher without having my specs run twice. Seems like
the plugin needs support for a “last” flag to make sure that we don’t keep moving down the list and running more
commands. Perhaps the type field has something to do with it.
I’d like to have a way to reuse the “Run File” tabs that get created so I can just keep re-running my specs without having to clean up old output. I haven’t decided the best workflow for that yet. Sometimes you want to be able to see old output and so I don’t want to just clobber that in all cases.