Added Jasmine() command to run rake jasmine:ci using the nearest

Rakefile for the current ft=jasmine buffer
This commit is contained in:
Christopher H. Laco 2011-02-02 23:04:36 -05:00
parent 05d0cdd5b6
commit 4f20bd0225
3 changed files with 45 additions and 1 deletions

View File

@ -30,13 +30,20 @@ This plugin is pretty basic right now. It currently:
** expect: expect..to line
** spy: spyOn method
* Uses templates for new Spec/SpecHelper buffers
* Runs all specs in jasmine:ci
You can disable templating by setting g:jasmine_use_templates=""
By default, the plugin assumes the templates are in bundle/jasmine/template and the snippets are in bundle/jasmine/snippets. You can override those by setting g:jasmine_snippets_directory and g:jasmine_templates_directory in your vimrc
h2. Running Specs
Slowly working on interactive spec running support. Currently, the Jasmine() command is provided for jasmine fileType buffers. When invoke, it searchs the curent/parent directories of that buffer for the nearest Rakefile, then invokes rake jasmine:ci to run all specs.
I plan on added Red/Green support, as well as quickfix error support.
h2. TODO
* Add commands/functions to run a spec, a spec file, and jasmine:ci
* Add commands/functions to run a spec, a spec file
* Add Red/Green bar to spec runner output and error buffer support
* docs help file

View File

@ -3,6 +3,8 @@ if exists("g:loaded_autoloadjasmine") || &cp
endif
let g:loaded_autoloadjasmine=1
let b:jasmine_rakefile=""
let b:jasmine_root=""
if !exists("g:jasmine_use_templates")
let g:jasmine_use_templates = 1
@ -53,3 +55,36 @@ function jasmine#configure_templates()
let g:configured_templates=1
endif
endfunction
function jasmine#find_root()
let dn = expand("%:p:h")
let odn = ""
while dn != odn
let b:jasmine_rakefile = glob(dn."/[Rr]akefile")
if b:jasmine_rakefile != ""
return dn
break
endif
let odn = dn
let dn = fnamemodify(dn,":h")
endwhile
endfunction
function jasmine#run_tests()
let b:jasmine_root = jasmine#find_root()
execute "!rake ".b:jasmine_rakefile." jasmine:ci"
endfunction
function jasmine#redbar()
hi RedBar ctermfg=white ctermbg=red guibg=red
echohl RedBar
echon repeat(" ",&columns - 1)
echohl
endfunction
function jasmine#greenbar()
hi GreenBar ctermfg=white ctermbg=green guibg=green
echohl GreenBar
echon repeat(" ",&columns - 1)
echohl
endfunction

View File

@ -5,3 +5,5 @@ endif
let b:did_ftplugin = 1
call jasmine#load_snippets()
command! Jasmine :call jasmine#run_tests()