Add support for boot 2.0 and up

Boot's built-in repl task adds a fake.class.path System property which
refers back to the original user files (as opposed to the temporary
files it uses to actually do builds). We should prefer that to anything
else when the property is set.

Fixes #194.
This commit is contained in:
Joshua Davey 2015-02-14 20:19:12 -06:00 committed by Tim Pope
parent 7cebf6847e
commit 5866d0017a

View File

@ -38,7 +38,17 @@ function! fireplace#nrepl#for(transport) abort
\ client.describe.versions.nrepl.minor < 2 \ client.describe.versions.nrepl.minor < 2
throw 'nREPL: 0.2.0 or higher required' throw 'nREPL: 0.2.0 or higher required'
endif endif
if client.has_op('classpath') " Handle boot, which sets a fake.class.path entry
let response = client.process({'op': 'eval', 'code':
\ '[(System/getProperty "path.separator") (System/getProperty "fake.class.path")]', 'session': ''})
let cpath = response.value[-1][5:-2]
if cpath !=# 'nil'
let cpath = eval(cpath)
if !empty(cpath)
let client._path = split(cpath, response.value[-1][2])
endif
endif
if !has_key(client, '_path') && client.has_op('classpath')
let response = client.message({'op': 'classpath'})[0] let response = client.message({'op': 'classpath'})[0]
if type(get(response, 'classpath')) == type([]) if type(get(response, 'classpath')) == type([])
let client._path = response.classpath let client._path = response.classpath