Skip to content

Instantly share code, notes, and snippets.

@bfitch
Created September 21, 2014 00:56
Show Gist options
  • Save bfitch/a5cc031c4121b7055764 to your computer and use it in GitHub Desktop.
Save bfitch/a5cc031c4121b7055764 to your computer and use it in GitHub Desktop.
Run JS specs in vim
function! RunJsSpec()
ruby <<EOF
def absolute_path
File.expand_path VIM::evaluate("expand('%:p')")
end
def filename
File.basename(absolute_path)
end
def konacha_path
path = (File.dirname(absolute_path).clone.split('/') - blacklisted_directories)
path.join('/')
end
def blacklisted_directories
["Users", "bfitch", "src", "icisstaff", "spec", "konacha"]
end
def konacha_spec
(konacha_path + "/#{filename}").gsub(/^\//,"")
end
VIM::command "!zeus rake konacha:run SPEC=#{konacha_spec}"
EOF
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment