Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added variable webapi#system_function.

  • Loading branch information...
commit b847cd04cc83bbf27e0939928001ccd749efc2a5 1 parent 9683526
@mattn authored
View
4 autoload/webapi/atom.vim
@@ -8,6 +8,8 @@
let s:save_cpo = &cpo
set cpo&vim
+let s:system = function(get(g:, 'webapi#system_function', 'system'))
+
let s:author_template = {
\ "name": "",
\}
@@ -66,7 +68,7 @@ for s:name in ['author', 'link', 'category', 'feed', 'entry']
endfor
function s:entry_template.setContentFromFile(file) dict
let quote = &shellxquote == '"' ? "'" : '"'
- let bits = substitute(system("xxd -ps ".quote.file.quote), "[ \n\r]", '', 'g')
+ let bits = substitute(s:system("xxd -ps ".quote.file.quote), "[ \n\r]", '', 'g')
let self['mode'] = "base64"
let self['content'] = webapi#base64#b64encodebin(bits)
endfunction
View
10 autoload/webapi/http.vim
@@ -7,6 +7,8 @@
let s:save_cpo = &cpo
set cpo&vim
+let s:system = function(get(g:, 'webapi#system_function', 'system'))
+
function! s:nr2byte(nr)
if a:nr < 0x80
return nr2char(a:nr)
@@ -136,7 +138,7 @@ function! webapi#http#get(url, ...)
endif
endfor
let command .= " ".quote.url.quote
- let res = system(command)
+ let res = s:system(command)
elseif executable('wget')
let command = printf('wget -O- --save-headers --server-response -q %s', follow ? '-L' : '')
let quote = &shellxquote == '"' ? "'" : '"'
@@ -148,7 +150,7 @@ function! webapi#http#get(url, ...)
endif
endfor
let command .= " ".quote.url.quote
- let res = system(command)
+ let res = s:system(command)
else
throw "require `curl` or `wget` command"
endif
@@ -200,7 +202,7 @@ function! webapi#http#post(url, ...)
endfor
let command .= " ".quote.url.quote
call writefile(split(postdatastr, "\n"), file, "b")
- let res = system(command . " --data-binary @" . quote.file.quote)
+ let res = s:system(command . " --data-binary @" . quote.file.quote)
elseif executable('wget')
let command = printf('wget -O- --save-headers --server-response -q %s', follow ? '-L' : '')
let headdata['X-HTTP-Method-Override'] = method
@@ -214,7 +216,7 @@ function! webapi#http#post(url, ...)
endfor
let command .= " ".quote.url.quote
call writefile(split(postdatastr, "\n"), file, "b")
- let res = system(command . " --post-data @" . quote.file.quote)
+ let res = s:system(command . " --post-data @" . quote.file.quote)
else
throw "require `curl` or `wget` command"
endif
View
4 autoload/webapi/xmlrpc.vim
@@ -8,6 +8,8 @@
let s:save_cpo = &cpo
set cpo&vim
+let s:system = function(get(g:, 'webapi#system_function', 'system'))
+
function! webapi#xmlrpc#nil()
return 0
endfunction
@@ -88,7 +90,7 @@ function! s:to_value(content)
call base64.value(a:content["bits"])
elseif has_key(a:content, "path")
let quote = &shellxquote == '"' ? "'" : '"'
- let bits = substitute(system("xxd -ps ".quote.a:content["path"].quote), "[ \n\r]", '', 'g')
+ let bits = substitute(s:system("xxd -ps ".quote.a:content["path"].quote), "[ \n\r]", '', 'g')
call base64.value(webapi#base64#b64encodebin(bits))
endif
return struct
Please sign in to comment.
Something went wrong with that request. Please try again.