aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/luarocks/write_rockspec.lua17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua
index 9b6593b6..213d1b01 100644
--- a/src/luarocks/write_rockspec.lua
+++ b/src/luarocks/write_rockspec.lua
@@ -266,10 +266,6 @@ function write_rockspec.run(...)
266 version = version or "scm" 266 version = version or "scm"
267 267
268 local filename = flags["output"] or dir.path(fs.current_dir(), name:lower().."-"..version.."-1.rockspec") 268 local filename = flags["output"] or dir.path(fs.current_dir(), name:lower().."-"..version.."-1.rockspec")
269
270 if not flags["homepage"] and url_or_dir:match("^git://github.com") then
271 flags["homepage"] = "http://"..url_or_dir:match("^[^:]+://(.*)")
272 end
273 269
274 local rockspec = { 270 local rockspec = {
275 rockspec_format = flags["rockspec-format"], 271 rockspec_format = flags["rockspec-format"],
@@ -324,6 +320,19 @@ function write_rockspec.run(...)
324 if not local_dir then 320 if not local_dir then
325 local_dir = "." 321 local_dir = "."
326 end 322 end
323
324 if not flags["homepage"] then
325 local url_protocol, url_path = dir.split_url(rockspec.source.url)
326
327 if simple_scm_protocols[url_protocol] then
328 for _, domain in ipairs({"github.com", "bitbucket.org", "gitlab.com"}) do
329 if util.starts_with(url_path, domain) then
330 rockspec.description.homepage = "https://"..url_path:gsub("%.git$", "")
331 break
332 end
333 end
334 end
335 end
327 336
328 local libs = nil 337 local libs = nil
329 if flags["lib"] then 338 if flags["lib"] then