Created
September 21, 2014 00:56
-
-
Save bfitch/a5cc031c4121b7055764 to your computer and use it in GitHub Desktop.
Run JS specs in vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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