diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-24 16:28:49 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-24 16:28:49 -0300 |
commit | 30430cf1c5785e15f93ed9547dd919e658289162 (patch) | |
tree | d9722ddbc763648d36741a138ad641cfe7c0ad49 /src | |
parent | 57c838ec4d0a6dbd75ffe93b9bbf9679f52ed4d2 (diff) | |
download | luarocks-30430cf1c5785e15f93ed9547dd919e658289162.tar.gz luarocks-30430cf1c5785e15f93ed9547dd919e658289162.tar.bz2 luarocks-30430cf1c5785e15f93ed9547dd919e658289162.zip |
Don't overwrite --detailed when given by the user.
See https://twitter.com/Nymphium/status/580098018201882624
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/write_rockspec.lua | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index fb3a120e..0a333123 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua | |||
@@ -83,18 +83,20 @@ local function detect_description(rockspec) | |||
83 | fd:close() | 83 | fd:close() |
84 | local paragraph = data:match("\n\n([^%[].-)\n\n") | 84 | local paragraph = data:match("\n\n([^%[].-)\n\n") |
85 | if not paragraph then paragraph = data:match("\n\n(.*)") end | 85 | if not paragraph then paragraph = data:match("\n\n(.*)") end |
86 | local summary, detailed | ||
86 | if paragraph then | 87 | if paragraph then |
87 | if #paragraph < 80 then | 88 | if #paragraph < 80 then |
88 | rockspec.description.summary = paragraph:gsub("\n", "") | 89 | summary = paragraph:gsub("\n", "") |
89 | rockspec.description.detailed = paragraph | 90 | detailed = paragraph |
90 | else | 91 | else |
91 | local summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") | 92 | local found_summary = paragraph:gsub("\n", " "):match("([^.]*%.) ") |
92 | if summary then | 93 | if summary then |
93 | rockspec.description.summary = summary:gsub("\n", "") | 94 | summary = found_summary:gsub("\n", "") |
94 | end | 95 | end |
95 | rockspec.description.detailed = paragraph | 96 | detailed = paragraph |
96 | end | 97 | end |
97 | end | 98 | end |
99 | return summary, detailed | ||
98 | end | 100 | end |
99 | 101 | ||
100 | local function detect_mit_license(data) | 102 | local function detect_mit_license(data) |
@@ -312,7 +314,11 @@ function write_rockspec.run(...) | |||
312 | local ok, err = fs.change_dir(local_dir) | 314 | local ok, err = fs.change_dir(local_dir) |
313 | if not ok then return nil, "Failed reaching files from project - error entering directory "..local_dir end | 315 | if not ok then return nil, "Failed reaching files from project - error entering directory "..local_dir end |
314 | 316 | ||
315 | detect_description(rockspec) | 317 | if (not flags["summary"]) or (not flags["detailed"]) then |
318 | local summary, detailed = detect_description(rockspec) | ||
319 | rockspec.description.summary = flags["summary"] or summary | ||
320 | rockspec.description.detailed = flags["detailed"] or detailed | ||
321 | end | ||
316 | 322 | ||
317 | local is_mit = show_license(rockspec) | 323 | local is_mit = show_license(rockspec) |
318 | 324 | ||