diff options
-rw-r--r-- | src/luarocks/util.lua | 1 | ||||
-rw-r--r-- | src/luarocks/write_rockspec.lua | 26 | ||||
-rw-r--r-- | test/testing.lua | 1 | ||||
-rwxr-xr-x | test/testing.sh | 1 |
4 files changed, 17 insertions, 12 deletions
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 6fecf863..c06c8354 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -118,6 +118,7 @@ local supported_flags = { | |||
118 | ["rock-tree"] = true, | 118 | ["rock-tree"] = true, |
119 | ["rock-trees"] = true, | 119 | ["rock-trees"] = true, |
120 | ["rockspec"] = true, | 120 | ["rockspec"] = true, |
121 | ["rockspec-format"] = "<ver>", | ||
121 | ["server"] = "<server>", | 122 | ["server"] = "<server>", |
122 | ["skip-pack"] = true, | 123 | ["skip-pack"] = true, |
123 | ["source"] = true, | 124 | ["source"] = true, |
diff --git a/src/luarocks/write_rockspec.lua b/src/luarocks/write_rockspec.lua index 68942e07..972562c3 100644 --- a/src/luarocks/write_rockspec.lua +++ b/src/luarocks/write_rockspec.lua | |||
@@ -24,18 +24,19 @@ If a repository URL is given with no version, it creates an 'scm' rock. | |||
24 | Note that the generated file is a _starting point_ for writing a | 24 | Note that the generated file is a _starting point_ for writing a |
25 | rockspec, and is not guaranteed to be complete or correct. | 25 | rockspec, and is not guaranteed to be complete or correct. |
26 | 26 | ||
27 | --output=<file> Write the rockspec with the given filename. | 27 | --output=<file> Write the rockspec with the given filename. |
28 | If not given, a file is written in the current | 28 | If not given, a file is written in the current |
29 | directory with a filename based on given name and version. | 29 | directory with a filename based on given name and version. |
30 | --license="<string>" A license string, such as "MIT/X11" or "GNU GPL v3". | 30 | --license="<string>" A license string, such as "MIT/X11" or "GNU GPL v3". |
31 | --summary="<txt>" A short one-line description summary. | 31 | --summary="<txt>" A short one-line description summary. |
32 | --detailed="<txt>" A longer description string. | 32 | --detailed="<txt>" A longer description string. |
33 | --homepage=<url> Project homepage. | 33 | --homepage=<url> Project homepage. |
34 | --lua-version=<ver> Supported Lua versions. Accepted values are "5.1", "5.2", | 34 | --lua-version=<ver> Supported Lua versions. Accepted values are "5.1", "5.2", |
35 | "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3". | 35 | "5.3", "5.1,5.2", "5.2,5.3", or "5.1,5.2,5.3". |
36 | --tag=<tag> Tag to use. Will attempt to extract version number from it. | 36 | --rockspec-format=<ver> Rockspec format version, such as "1.0" or "1.1". |
37 | --lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to | 37 | --tag=<tag> Tag to use. Will attempt to extract version number from it. |
38 | link to. | 38 | --lib=<lib>[,<lib>] A comma-separated list of libraries that C files need to |
39 | link to. | ||
39 | ]] | 40 | ]] |
40 | 41 | ||
41 | local function open_file(name) | 42 | local function open_file(name) |
@@ -246,6 +247,7 @@ function write_rockspec.run(...) | |||
246 | end | 247 | end |
247 | 248 | ||
248 | local rockspec = { | 249 | local rockspec = { |
250 | rockspec_format = flags["rockspec-format"], | ||
249 | package = name, | 251 | package = name, |
250 | name = name:lower(), | 252 | name = name:lower(), |
251 | version = version.."-1", | 253 | version = version.."-1", |
diff --git a/test/testing.lua b/test/testing.lua index 44c6f098..48d4ac0e 100644 --- a/test/testing.lua +++ b/test/testing.lua | |||
@@ -400,6 +400,7 @@ local tests = { | |||
400 | end, | 400 | end, |
401 | test_write_rockspec = function() return run "$luarocks write_rockspec git://github.com/keplerproject/luarocks" end, | 401 | test_write_rockspec = function() return run "$luarocks write_rockspec git://github.com/keplerproject/luarocks" end, |
402 | test_write_rockspec_lib = function() return run '$luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2' end, | 402 | test_write_rockspec_lib = function() return run '$luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2' end, |
403 | test_write_rockspec_format = function() return run '$luarocks write_rockspec git://github.com/keplerproject/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2' end, | ||
403 | test_write_rockspec_fullargs = function() return run '$luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"' end, | 404 | test_write_rockspec_fullargs = function() return run '$luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"' end, |
404 | fail_write_rockspec_args = function() return run "$luarocks write_rockspec invalid" end, | 405 | fail_write_rockspec_args = function() return run "$luarocks write_rockspec invalid" end, |
405 | fail_write_rockspec_args_url = function() return run "$luarocks write_rockspec http://example.com/invalid.zip" end, | 406 | fail_write_rockspec_args_url = function() return run "$luarocks write_rockspec http://example.com/invalid.zip" end, |
diff --git a/test/testing.sh b/test/testing.sh index 4338e48f..c43b4d52 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -492,6 +492,7 @@ test_deps_mode_make_order_sys() { $luarocks build --tree="$testing_tree" lpeg && | |||
492 | 492 | ||
493 | test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; } | 493 | test_write_rockspec() { $luarocks write_rockspec git://github.com/keplerproject/luarocks; } |
494 | test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; } | 494 | test_write_rockspec_lib() { $luarocks write_rockspec git://github.com/mbalmer/luafcgi --lib=fcgi --license="3-clause BSD" --lua-version=5.1,5.2; } |
495 | test_write_rockspec_format() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --rockspec-format=1.1 --lua-version=5.1,5.2; } | ||
495 | test_write_rockspec_fullargs() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"; } | 496 | test_write_rockspec_fullargs() { $luarocks write_rockspec git://github.com/keplerproject/luarocks --lua-version=5.1,5.2 --license="MIT/X11" --homepage="http://www.luarocks.org" --summary="A package manager for Lua modules"; } |
496 | fail_write_rockspec_args() { $luarocks write_rockspec invalid; } | 497 | fail_write_rockspec_args() { $luarocks write_rockspec invalid; } |
497 | fail_write_rockspec_args_url() { $luarocks write_rockspec http://example.com/invalid.zip; } | 498 | fail_write_rockspec_args_url() { $luarocks write_rockspec http://example.com/invalid.zip; } |