aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-07-16 10:06:55 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-07-18 11:24:07 -0300
commit703b1fec30c1e2ca7932b09996d34b9aaf8f43eb (patch)
treece5325d1c5c1904cd92db305d6f3cde6867b6155
parent981b37c83681203cf69f04d8f8fbc360dc7f345e (diff)
downloadluarocks-703b1fec30c1e2ca7932b09996d34b9aaf8f43eb.tar.gz
luarocks-703b1fec30c1e2ca7932b09996d34b9aaf8f43eb.tar.bz2
luarocks-703b1fec30c1e2ca7932b09996d34b9aaf8f43eb.zip
write_rockspec: detect git+ssh and hg+ssh
-rw-r--r--src/luarocks/cmd/write_rockspec.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/luarocks/cmd/write_rockspec.lua b/src/luarocks/cmd/write_rockspec.lua
index d3ec7b0d..cf9181e6 100644
--- a/src/luarocks/cmd/write_rockspec.lua
+++ b/src/luarocks/cmd/write_rockspec.lua
@@ -76,8 +76,14 @@ local lua_version_dep = {
76} 76}
77 77
78local simple_scm_protocols = { 78local simple_scm_protocols = {
79 git = true, ["git+http"] = true, ["git+https"] = true, 79 git = true,
80 hg = true, ["hg+http"] = true, ["hg+https"] = true 80 ["git+http"] = true,
81 ["git+https"] = true,
82 ["git+ssh"] = true,
83 hg = true,
84 ["hg+http"] = true,
85 ["hg+https"] = true,
86 ["hg+ssh"] = true,
81} 87}
82 88
83local detect_url 89local detect_url
@@ -89,10 +95,13 @@ do
89 local url = pipe:read("*a"):match("^([^\r\n]+)") 95 local url = pipe:read("*a"):match("^([^\r\n]+)")
90 pipe:close() 96 pipe:close()
91 if not url then return nil end 97 if not url then return nil end
92 if not util.starts_with(url, program.."://") then 98 if url:match("^[^@:/]+@[^@:/]+:.*$") then
99 local u, h, p = url:match("^([^@]+)@([^:]+):(.*)$")
100 url = program.."+ssh://"..u.."@"..h.."/"..p
101 elseif not util.starts_with(url, program.."://") then
93 url = program.."+"..url 102 url = program.."+"..url
94 end 103 end
95 104
96 if simple_scm_protocols[dir.split_url(url)] then 105 if simple_scm_protocols[dir.split_url(url)] then
97 return url 106 return url
98 end 107 end