(Note: this is tailored to work on windows..)
[ 200, {'Content-Type' => format}, out ]
#\ -w -p 8765
use Rack::Reloader, 0
use Rack::ContentLength
app = proc do |env|
formatting = '--require "C:\\...\\Ruby RSpec.tmbundle\\Support\\lib\\text_mate_formatter" -f ' +
'Spec::Runner::Formatter::TextMateFormatter' if env["REQUEST_PATH"] == "/textmate"
formatting = '-f h' if env["REQUEST_PATH"] == "/html"
out = `spec.bat spec #{formatting} 2>&1`
format = out=~/\
end
run app
How to use it
Install rack if you haven't already.
gem install rack
- To start it, save this code into a file called 'spec_rack.ru'.
- Change the '...' to the path to your textmate bundles... (or just ignore it if you don't use E or textmate)
- Run
rackup spec_rack.ru
- visit http://localhost:8765 http://localhost:8765/html or http://localhost:8765/textmate
Why Bother?
I'm using RSpec for testing, but the integration with E (the windows clone of Textmate) seems to hang sometimes when there is an error in my code.
Having explorer open with the results so I can just press refresh is working well for me.
I wanted to post a simple rack application as there don't seem to be many examples around.