aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-09-07 01:07:38 +0300
committerHisham Muhammad <hisham@gobolinux.org>2018-09-07 02:42:15 +0300
commit8840171407a17a6237e193fde3d6a3cc8aee1c4e (patch)
tree7c3fd825f9af121171bbb1b7c59ba964bf5c5e6c
parentea49b058fb0a2f48ab8b3e3aa2879bbd01a412c9 (diff)
downloadluarocks-8840171407a17a6237e193fde3d6a3cc8aee1c4e.tar.gz
luarocks-8840171407a17a6237e193fde3d6a3cc8aee1c4e.tar.bz2
luarocks-8840171407a17a6237e193fde3d6a3cc8aee1c4e.zip
write_rockspec, init: rename --lua-version to --lua-versions
Fixes conflict between the use of --lua-version in write_rockspec to list supported Lua versions in a rockspec (now renamed to --lua-versions) and the general --lua-version flag used to select a Lua interpreter.
-rw-r--r--spec/write_rockspec_spec.lua10
-rw-r--r--src/luarocks/cmd/init.lua2
-rw-r--r--src/luarocks/cmd/write_rockspec.lua6
-rw-r--r--src/luarocks/util.lua1
4 files changed, 10 insertions, 9 deletions
diff --git a/spec/write_rockspec_spec.lua b/spec/write_rockspec_spec.lua
index 1fb53547..35870775 100644
--- a/spec/write_rockspec_spec.lua
+++ b/spec/write_rockspec_spec.lua
@@ -56,14 +56,14 @@ describe("LuaRocks write_rockspec tests #integration", function()
56 56
57 it("runs with format flag", function() 57 it("runs with format flag", function()
58 finally(function() os.remove("testrock-dev-1.rockspec") end) 58 finally(function() os.remove("testrock-dev-1.rockspec") end)
59 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --rockspec-format=1.1 --lua-version=5.1,5.2")) 59 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --rockspec-format=1.1 --lua-versions=5.1,5.2"))
60 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) 60 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec"))
61 -- TODO check contents 61 -- TODO check contents
62 end) 62 end)
63 63
64 it("runs with full flags", function() 64 it("runs with full flags", function()
65 finally(function() os.remove("testrock-dev-1.rockspec") end) 65 finally(function() os.remove("testrock-dev-1.rockspec") end)
66 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --lua-version=5.1,5.2 --license=\"MIT/X11\" " 66 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --lua-versions=5.1,5.2 --license=\"MIT/X11\" "
67 .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" ")) 67 .. " --homepage=\"http://www.luarocks.org\" --summary=\"A package manager for Lua modules\" "))
68 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) 68 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec"))
69 -- TODO check contents 69 -- TODO check contents
@@ -71,7 +71,7 @@ describe("LuaRocks write_rockspec tests #integration", function()
71 71
72 it("with various flags", function() 72 it("with various flags", function()
73 finally(function() os.remove("testrock-dev-1.rockspec") end) 73 finally(function() os.remove("testrock-dev-1.rockspec") end)
74 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --lib=fcgi --license=\"3-clause BSD\" " .. "--lua-version=5.1,5.2")) 74 assert.is_true(run.luarocks_bool("write_rockspec git://localhost/testrock --lib=fcgi --license=\"3-clause BSD\" " .. "--lua-versions=5.1,5.2"))
75 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec")) 75 assert.is.truthy(lfs.attributes("testrock-dev-1.rockspec"))
76 -- TODO check contents 76 -- TODO check contents
77 end) 77 end)
@@ -88,14 +88,14 @@ describe("LuaRocks write_rockspec tests #integration", function()
88 88
89 it("via http", function() 89 it("via http", function()
90 finally(function() os.remove("an_upstream_tarball-0.1-1.rockspec") end) 90 finally(function() os.remove("an_upstream_tarball-0.1-1.rockspec") end)
91 assert.is_true(run.luarocks_bool("write_rockspec http://localhost:8080/file/an_upstream_tarball-0.1.tar.gz --lua-version=5.1")) 91 assert.is_true(run.luarocks_bool("write_rockspec http://localhost:8080/file/an_upstream_tarball-0.1.tar.gz --lua-versions=5.1"))
92 assert.is.truthy(lfs.attributes("an_upstream_tarball-0.1-1.rockspec")) 92 assert.is.truthy(lfs.attributes("an_upstream_tarball-0.1-1.rockspec"))
93 -- TODO check contents 93 -- TODO check contents
94 end) 94 end)
95 95
96 it("with a different basedir", function() 96 it("with a different basedir", function()
97 finally(function() os.remove("renamed_upstream_tarball-0.1-1.rockspec") end) 97 finally(function() os.remove("renamed_upstream_tarball-0.1-1.rockspec") end)
98 assert.is_true(run.luarocks_bool("write_rockspec http://localhost:8080/file/renamed_upstream_tarball-0.1.tar.gz --lua-version=5.1")) 98 assert.is_true(run.luarocks_bool("write_rockspec http://localhost:8080/file/renamed_upstream_tarball-0.1.tar.gz --lua-versions=5.1"))
99 assert.is.truthy(lfs.attributes("renamed_upstream_tarball-0.1-1.rockspec")) 99 assert.is.truthy(lfs.attributes("renamed_upstream_tarball-0.1-1.rockspec"))
100 -- TODO check contents 100 -- TODO check contents
101 end) 101 end)
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua
index a9511316..0138c056 100644
--- a/src/luarocks/cmd/init.lua
+++ b/src/luarocks/cmd/init.lua
@@ -19,7 +19,7 @@ init.help = [[
19--summary="<txt>" A short one-line description summary. 19--summary="<txt>" A short one-line description summary.
20--detailed="<txt>" A longer description string. 20--detailed="<txt>" A longer description string.
21--homepage=<url> Project homepage. 21--homepage=<url> Project homepage.
22--lua-version=<ver> Supported Lua versions. Accepted values are "5.1", "5.2", 22--lua-versions=<ver> Supported Lua versions. Accepted values are "5.1", "5.2",
23 "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3". 23 "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3".
24--rockspec-format=<ver> Rockspec format version, such as "1.0" or "1.1". 24--rockspec-format=<ver> Rockspec format version, such as "1.0" or "1.1".
25--lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to 25--lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to
diff --git a/src/luarocks/cmd/write_rockspec.lua b/src/luarocks/cmd/write_rockspec.lua
index 701b079e..4a8a997e 100644
--- a/src/luarocks/cmd/write_rockspec.lua
+++ b/src/luarocks/cmd/write_rockspec.lua
@@ -33,7 +33,7 @@ rockspec, and is not guaranteed to be complete or correct.
33--summary="<txt>" A short one-line description summary. 33--summary="<txt>" A short one-line description summary.
34--detailed="<txt>" A longer description string. 34--detailed="<txt>" A longer description string.
35--homepage=<url> Project homepage. 35--homepage=<url> Project homepage.
36--lua-version=<ver> Supported Lua versions. Accepted values are: "5.1", "5.2", 36--lua-versions=<ver> Supported Lua versions. Accepted values are: "5.1", "5.2",
37 "5.3", "5.4", "5.1,5.2", "5.2,5.3", "5.3,5.4", "5.1,5.2,5.3", 37 "5.3", "5.4", "5.1,5.2", "5.2,5.3", "5.3,5.4", "5.1,5.2,5.3",
38 "5.2,5.3,5.4", or "5.1,5.2,5.3,5.4" 38 "5.2,5.3,5.4", or "5.1,5.2,5.3,5.4"
39--rockspec-format=<ver> Rockspec format version, such as "1.0" or "1.1". 39--rockspec-format=<ver> Rockspec format version, such as "1.0" or "1.1".
@@ -283,7 +283,7 @@ function write_rockspec.command(flags, name, version, url_or_dir)
283 license = flags["license"] or "*** please specify a license ***", 283 license = flags["license"] or "*** please specify a license ***",
284 }, 284 },
285 dependencies = { 285 dependencies = {
286 lua_version_dep[flags["lua-version"]], 286 lua_version_dep[flags["lua-versions"]],
287 }, 287 },
288 build = {}, 288 build = {},
289 }) 289 })
@@ -291,7 +291,7 @@ function write_rockspec.command(flags, name, version, url_or_dir)
291 rockspec.source.protocol = protocol 291 rockspec.source.protocol = protocol
292 292
293 if not next(rockspec.dependencies) then 293 if not next(rockspec.dependencies) then
294 util.warning("Please specify supported Lua version with --lua-version=<ver>. "..util.see_help("write_rockspec")) 294 util.warning("Please specify supported Lua versions with --lua-versions=<ver>. "..util.see_help("write_rockspec"))
295 end 295 end
296 296
297 local local_dir = url_or_dir 297 local local_dir = url_or_dir
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index e65128da..4be7d71e 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -117,6 +117,7 @@ local supported_flags = {
117 ["lr-path"] = true, 117 ["lr-path"] = true,
118 ["lua-dir"] = "<path>", 118 ["lua-dir"] = "<path>",
119 ["lua-version"] = "<vers>", 119 ["lua-version"] = "<vers>",
120 ["lua-versions"] = "<versions>",
120 ["lua-ver"] = true, 121 ["lua-ver"] = true,
121 ["lua-incdir"] = true, 122 ["lua-incdir"] = true,
122 ["lua-libdir"] = true, 123 ["lua-libdir"] = true,