From f10113ff32a1ab9fff5abe68e84ccc5bad9a4908 Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Fri, 26 Jun 2015 11:59:10 -0300 Subject: Adds help to 'luarocks config' command --- src/luarocks/config_cmd.lua | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/luarocks/config_cmd.lua b/src/luarocks/config_cmd.lua index c066cfec..f3b54494 100644 --- a/src/luarocks/config_cmd.lua +++ b/src/luarocks/config_cmd.lua @@ -6,6 +6,22 @@ local cfg = require("luarocks.cfg") local util = require("luarocks.util") local dir = require("luarocks.dir") +config_cmd.help_summary = "Queries information about the LuaRocks configuration." +config_cmd.help_arguments = "" +config_cmd.help = [[ +--lua-incdir Path to Lua header files. + +--lua-libdir Path to Lua library files. + +--lua-ver Lua version (in major.minor format). e.g. 5.1 + +--system-config Location of the system config file. + +--user-config Location of the user config file. + +--rock-trees Rocks trees in use. First the user tree, then the system tree. +]] + local function config_file(conf) print(dir.normalize(conf.file)) if conf.ok then @@ -39,7 +55,6 @@ function config_cmd.run(...) if flags["user-config"] then return config_file(conf.user) end - if flags["rock-trees"] then for _, tree in ipairs(cfg.rocks_trees) do if type(tree) == "string" then -- cgit v1.2.3-55-g6feb From ed97ece0c1992d93b9a4a18a9abc413ece19a4ea Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Fri, 26 Jun 2015 12:28:13 -0300 Subject: Adds missing tests --- test/testing.lua | 33 ++++++++++++++++++++++++++++++++- test/testing.sh | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test/testing.lua b/test/testing.lua index 44c6f098..4a5d73eb 100644 --- a/test/testing.lua +++ b/test/testing.lua @@ -50,6 +50,10 @@ local function glob(patt) -- TODO end +local function touch(filename) + -- TODO +end + local function rm(...) for _, filename in ipairs {...} do filename = expand_variables(filename) @@ -397,7 +401,7 @@ local tests = { local found = run_get_contents '$luarocks_noecho list --tree="$testing_sys_tree" --porcelain lpeg' rm_rf "./lxsh-${verrev_lxsh}" return found ~= "" - end, + end, test_write_rockspec = function() return run "$luarocks write_rockspec git://github.com/keplerproject/luarocks" end, 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, 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, @@ -405,6 +409,33 @@ local tests = { fail_write_rockspec_args_url = function() return run "$luarocks write_rockspec http://example.com/invalid.zip" end, test_write_rockspec_http = function() return run "$luarocks write_rockspec http://luarocks.org/releases/luarocks-2.1.0.tar.gz --lua-version=5.1" end, test_write_rockspec_basedir = function() return run "$luarocks write_rockspec https://github.com/downloads/Olivine-Labs/luassert/luassert-1.2.tar.gz --lua-version=5.1" end, + + fail_config_noflags = function() return run "$luarocks config; " end, + test_config_lua_incdir = function() return run "$luarocks config --lua-incdir; " end, + test_config_lua_libdir = function() return run "$luarocks config --lua-libdir; " end, + test_config_lua_ver = function() return run "$luarocks config --lua-ver; " end, + fail_config_system_config = function() + return rm "$testing_lrprefix/etc/luarocks/config.lua" + and run "$luarocks config --system-config; " + end, + test_config_system_config = function() + local ok = mkdir "$testing_lrprefix/etc/luarocks" + and touch "$testing_lrprefix/etc/luarocks/config.lua" + and run "$luarocks config --system-config; " + rm "$testing_lrprefix/etc/luarocks/config.lua" + return ok + end, + fail_config_system_config_invalid = function() + local ok = mkdir "$testing_lrprefix/etc/luarocks" + and run "echo 'if if if' > '$testing_lrprefix/etc/luarocks/config.lua' ;" + and run "$luarocks config --system-config" + rm "$testing_lrprefix/etc/luarocks/config.lua" + return ok + end, + test_config_user_config = function() return run "$luarocks config --user-config; " end, + fail_config_user_config = function() return run "LUAROCKS_CONFIG='/missing_file.lua' $luarocks config --user-config; " end, + test_config_rock_trees = function() return run "$luarocks config --rock-trees;" end, + test_config_help = function() return run "$luarocks help config;" end, test_doc = function() return run "$luarocks install luarepl" and run "$luarocks doc luarepl" diff --git a/test/testing.sh b/test/testing.sh index 4338e48f..4f88538b 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -508,6 +508,7 @@ fail_config_system_config_invalid() { mkdir -p "$testing_lrprefix/etc/luarocks"; test_config_user_config() { $luarocks config --user-config; } fail_config_user_config() { LUAROCKS_CONFIG="/missing_file.lua" $luarocks config --user-config; } test_config_rock_trees() { $luarocks config --rock-trees; } +test_config_help() { $luarocks help config; } test_doc() { $luarocks install luarepl; $luarocks doc luarepl; } -- cgit v1.2.3-55-g6feb From 7e464b149c3ec47161249bd316e446f5261516ab Mon Sep 17 00:00:00 2001 From: Ignacio Burgueño Date: Mon, 29 Jun 2015 14:39:36 -0300 Subject: Changes wording as suggested --- src/luarocks/config_cmd.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/luarocks/config_cmd.lua b/src/luarocks/config_cmd.lua index f3b54494..bf282a7a 100644 --- a/src/luarocks/config_cmd.lua +++ b/src/luarocks/config_cmd.lua @@ -6,7 +6,7 @@ local cfg = require("luarocks.cfg") local util = require("luarocks.util") local dir = require("luarocks.dir") -config_cmd.help_summary = "Queries information about the LuaRocks configuration." +config_cmd.help_summary = "Query information about the LuaRocks configuration." config_cmd.help_arguments = "" config_cmd.help = [[ --lua-incdir Path to Lua header files. -- cgit v1.2.3-55-g6feb From 066e1c6bd90d2e0e4fcdbc116bd857c62779b4cd Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Mon, 29 Jun 2015 21:32:18 -0300 Subject: Make wording of help summaries consistent. As noted by @mpeterv in https://github.com/keplerproject/luarocks/pull/400#issuecomment-116307146 Changed them so they all use imperative verb form. --- src/luarocks/doc.lua | 2 +- src/luarocks/list.lua | 2 +- src/luarocks/show.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/luarocks/doc.lua b/src/luarocks/doc.lua index 034e2a16..53ed0116 100644 --- a/src/luarocks/doc.lua +++ b/src/luarocks/doc.lua @@ -13,7 +13,7 @@ local fetch = require("luarocks.fetch") local fs = require("luarocks.fs") local download = require("luarocks.download") -doc.help_summary = "Shows documentation for an installed rock." +doc.help_summary = "Show documentation for an installed rock." doc.help = [[ is an existing package name. diff --git a/src/luarocks/list.lua b/src/luarocks/list.lua index 518b83ce..fddded03 100644 --- a/src/luarocks/list.lua +++ b/src/luarocks/list.lua @@ -11,7 +11,7 @@ local cfg = require("luarocks.cfg") local util = require("luarocks.util") local path = require("luarocks.path") -list.help_summary = "Lists currently installed rocks." +list.help_summary = "List currently installed rocks." list.help_arguments = "[--porcelain] " list.help = [[ is a substring of a rock name to filter by. diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index 3243c0ce..08b2673f 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua @@ -11,7 +11,7 @@ local path = require("luarocks.path") local deps = require("luarocks.deps") local fetch = require("luarocks.fetch") local manif = require("luarocks.manif") -show.help_summary = "Shows information about an installed rock." +show.help_summary = "Show information about an installed rock." show.help = [[ is an existing package name. -- cgit v1.2.3-55-g6feb