diff options
Diffstat (limited to 'src/luarocks/fetch/git_ssh.lua')
-rw-r--r-- | src/luarocks/fetch/git_ssh.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/luarocks/fetch/git_ssh.lua b/src/luarocks/fetch/git_ssh.lua new file mode 100644 index 00000000..8a95a722 --- /dev/null +++ b/src/luarocks/fetch/git_ssh.lua | |||
@@ -0,0 +1,35 @@ | |||
1 | local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local string = _tl_compat and _tl_compat.string or string | ||
2 | |||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | local git_ssh = {} | ||
11 | |||
12 | |||
13 | local git = require("luarocks.fetch.git") | ||
14 | |||
15 | |||
16 | |||
17 | |||
18 | |||
19 | |||
20 | |||
21 | |||
22 | |||
23 | |||
24 | function git_ssh.get_sources(rockspec, extract, dest_dir) | ||
25 | rockspec.source.url = rockspec.source.url:gsub("^git.", "") | ||
26 | |||
27 | |||
28 | if rockspec.source.url:match("^ssh://[^/]+:[^%d]") then | ||
29 | rockspec.source.url = rockspec.source.url:gsub("^ssh://", "") | ||
30 | end | ||
31 | |||
32 | return git.get_sources(rockspec, extract, dest_dir, "--") | ||
33 | end | ||
34 | |||
35 | return git_ssh | ||