File tree 1 file changed +28
-2
lines changed
1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
target = File . expand_path ( ARGV . first )
4
4
5
+ # Cross-platform way of finding an executable in the $PATH.
6
+ #
7
+ # which('ruby') #=> /usr/bin/ruby
8
+ def which ( cmd )
9
+ exts = ENV [ 'PATHEXT' ] ? ENV [ 'PATHEXT' ] . split ( ';' ) : [ '' ]
10
+ ENV [ 'PATH' ] . split ( File ::PATH_SEPARATOR ) . each do |path |
11
+ exts . each { |ext |
12
+ exe = "#{ path } /#{ cmd } #{ ext } "
13
+ return exe if File . executable? exe
14
+ }
15
+ end
16
+ return nil
17
+ end
18
+
5
19
if RUBY_PLATFORM =~ /win32/i
6
20
js_cmd = 'cscript'
7
21
runjslint_ext = 'wsf'
10
24
if ENV [ 'JS_CMD' ]
11
25
js_cmd = ENV [ 'JS_CMD' ]
12
26
else
13
- js_cmd = 'js'
27
+ js_cmd = [ 'node' , 'nodejs' , 'js' ] . find { |ex | which ex }
28
+ end
29
+
30
+ if !js_cmd and File . exist? ( '/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc' )
31
+ js_cmd = '/System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc'
14
32
end
33
+
15
34
runjslint_ext = 'js'
35
+
16
36
plugin_path = File . join ( ENV [ 'HOME' ] , '.vim' )
17
- # check for pathogen
37
+ end
38
+
39
+ # check for pathogen
40
+ pathogen_path = File . join ( plugin_path , 'bundle' , 'jslint.vim' )
41
+ if File . exist? pathogen_path
42
+ plugin_path = pathogen_path
43
+ else
18
44
pathogen_path = File . join ( plugin_path , 'bundle' , 'jslint' )
19
45
plugin_path = pathogen_path if File . exist? ( pathogen_path )
20
46
end
You can’t perform that action at this time.
0 commit comments