diff options
author | Paul Ouellette <oue.paul18@gmail.com> | 2019-07-30 16:08:48 -0400 |
---|---|---|
committer | Paul Ouellette <oue.paul18@gmail.com> | 2019-08-01 23:53:03 -0400 |
commit | f52deeed485897511ecf80555e12a52c3e69d674 (patch) | |
tree | 206d36380317df2f0b751b06ddac77af0c5ad2ca | |
parent | b4d7742508105244053ebea15cac5cc570e4337f (diff) | |
download | luarocks-f52deeed485897511ecf80555e12a52c3e69d674.tar.gz luarocks-f52deeed485897511ecf80555e12a52c3e69d674.tar.bz2 luarocks-f52deeed485897511ecf80555e12a52c3e69d674.zip |
Fix some failing tests
-rw-r--r-- | spec/which_spec.lua | 2 | ||||
-rw-r--r-- | src/luarocks/admin/cmd/add.lua | 3 | ||||
-rw-r--r-- | src/luarocks/cmd.lua | 30 | ||||
-rw-r--r-- | src/luarocks/cmd/build.lua | 5 | ||||
-rw-r--r-- | src/luarocks/cmd/install.lua | 4 | ||||
-rw-r--r-- | src/luarocks/cmd/make.lua | 9 | ||||
-rw-r--r-- | src/luarocks/cmd/new_version.lua | 12 | ||||
-rw-r--r-- | src/luarocks/cmd/purge.lua | 4 | ||||
-rw-r--r-- | src/luarocks/cmd/show.lua | 2 |
9 files changed, 46 insertions, 25 deletions
diff --git a/spec/which_spec.lua b/spec/which_spec.lua index d5bcfab9..79b9ef7e 100644 --- a/spec/which_spec.lua +++ b/spec/which_spec.lua | |||
@@ -22,7 +22,7 @@ describe("LuaRocks which tests #integration", function() | |||
22 | 22 | ||
23 | it("fails on missing arguments", function() | 23 | it("fails on missing arguments", function() |
24 | local output = run.luarocks("which") | 24 | local output = run.luarocks("which") |
25 | assert.match("Missing module name", output, 1, true) | 25 | assert.match("missing argument 'modname'", output, 1, true) |
26 | end) | 26 | end) |
27 | 27 | ||
28 | it("finds modules found in package.path", function() | 28 | it("finds modules found in package.path", function() |
diff --git a/src/luarocks/admin/cmd/add.lua b/src/luarocks/admin/cmd/add.lua index 75f9386d..10e6bf09 100644 --- a/src/luarocks/admin/cmd/add.lua +++ b/src/luarocks/admin/cmd/add.lua | |||
@@ -20,6 +20,7 @@ function add.add_to_parser(parser) | |||
20 | 20 | ||
21 | cmd:option("--server", "The server to use. If not given, the default server ".. | 21 | cmd:option("--server", "The server to use. If not given, the default server ".. |
22 | "set in the upload_server variable from the configuration file is used instead.") | 22 | "set in the upload_server variable from the configuration file is used instead.") |
23 | :target("add_server") | ||
23 | cmd:flag("--no-refresh", "Do not refresh the local cache prior to ".. | 24 | cmd:flag("--no-refresh", "Do not refresh the local cache prior to ".. |
24 | "generation of the updated manifest.") | 25 | "generation of the updated manifest.") |
25 | cmd:flag("--index", "Produce an index.html file for the manifest. This ".. | 26 | cmd:flag("--index", "Produce an index.html file for the manifest. This ".. |
@@ -125,7 +126,7 @@ local function add_files_to_server(refresh, rockfiles, server, upload_server, do | |||
125 | end | 126 | end |
126 | 127 | ||
127 | function add.command(args) | 128 | function add.command(args) |
128 | local server, server_table = cache.get_upload_server(args.server) | 129 | local server, server_table = cache.get_upload_server(args.add_server or args.server) |
129 | if not server then return nil, server_table end | 130 | if not server then return nil, server_table end |
130 | return add_files_to_server(not args.no_refresh, args.rock, server, server_table, args.index) | 131 | return add_files_to_server(not args.no_refresh, args.rock, server, server_table, args.index) |
131 | end | 132 | end |
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 174da616..0d249421 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
@@ -338,17 +338,10 @@ local function get_config_text(cfg) | |||
338 | end | 338 | end |
339 | 339 | ||
340 | local function get_parser(description, cmd_modules) | 340 | local function get_parser(description, cmd_modules) |
341 | local epilog = [[ | ||
342 | Variables: | ||
343 | Variables from the "variables" table of the configuration file can be | ||
344 | overridden with VAR=VALUE assignments. | ||
345 | |||
346 | ]]..get_config_text(cfg) | ||
347 | |||
348 | local basename = dir.base_name(program) | 341 | local basename = dir.base_name(program) |
349 | local parser = argparse( | 342 | local parser = argparse( |
350 | basename, "LuaRocks "..cfg.program_version..", the Lua package manager\n\n".. | 343 | basename, "LuaRocks "..cfg.program_version..", the Lua package manager\n\n".. |
351 | program.." - "..description, epilog) | 344 | program.." - "..description) |
352 | :help_max_width(80) | 345 | :help_max_width(80) |
353 | :add_help("--help") | 346 | :add_help("--help") |
354 | :add_help_command() | 347 | :add_help_command() |
@@ -487,11 +480,6 @@ function cmd.run_command(description, commands, external_namespace, ...) | |||
487 | local parser = get_parser(description, cmd_modules) | 480 | local parser = get_parser(description, cmd_modules) |
488 | args = parser:parse(args) | 481 | args = parser:parse(args) |
489 | 482 | ||
490 | if not args.command then | ||
491 | util.printout(parser:get_help()) | ||
492 | os.exit(cmd.errorcodes.OK) | ||
493 | end | ||
494 | |||
495 | -- Compatibility for old flag | 483 | -- Compatibility for old flag |
496 | if args.nodeps then | 484 | if args.nodeps then |
497 | args.deps_mode = "none" | 485 | args.deps_mode = "none" |
@@ -527,7 +515,7 @@ function cmd.run_command(description, commands, external_namespace, ...) | |||
527 | if not lua_found then | 515 | if not lua_found then |
528 | util.warning("Could not find a Lua " .. cfg.lua_version .. " interpreter in your PATH. " .. | 516 | util.warning("Could not find a Lua " .. cfg.lua_version .. " interpreter in your PATH. " .. |
529 | "Modules may not install with the correct configurations. " .. | 517 | "Modules may not install with the correct configurations. " .. |
530 | "You may want to specify to the path prefix to your build " .. | 518 | "You may want to specify the path prefix to your build " .. |
531 | "of Lua " .. cfg.lua_version .. " using --lua-dir") | 519 | "of Lua " .. cfg.lua_version .. " using --lua-dir") |
532 | end | 520 | end |
533 | cfg.lua_found = lua_found | 521 | cfg.lua_found = lua_found |
@@ -568,6 +556,20 @@ function cmd.run_command(description, commands, external_namespace, ...) | |||
568 | cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") | 556 | cfg.local_cache = dir.path(fs.system_cache_dir(), "luarocks") |
569 | end | 557 | end |
570 | 558 | ||
559 | parser:epilog([[ | ||
560 | Variables: | ||
561 | Variables from the "variables" table of the configuration file can be | ||
562 | overridden with VAR=VALUE assignments. | ||
563 | |||
564 | ]]..get_config_text(cfg)) | ||
565 | |||
566 | if not args.command then | ||
567 | util.printout() | ||
568 | util.printout(parser:get_help()) | ||
569 | util.printout() | ||
570 | os.exit(cmd.errorcodes.OK) | ||
571 | end | ||
572 | |||
571 | local cmd_mod = cmd_modules[args.command] | 573 | local cmd_mod = cmd_modules[args.command] |
572 | local call_ok, ok, err, exitcode = xpcall(function() | 574 | local call_ok, ok, err, exitcode = xpcall(function() |
573 | return cmd_mod.command(args) | 575 | return cmd_mod.command(args) |
diff --git a/src/luarocks/cmd/build.lua b/src/luarocks/cmd/build.lua index 09e0abc7..0b1864fc 100644 --- a/src/luarocks/cmd/build.lua +++ b/src/luarocks/cmd/build.lua | |||
@@ -25,6 +25,7 @@ function cmd_build.add_to_parser(parser) | |||
25 | 25 | ||
26 | cmd:argument("rock", "A rockspec file, a source rock file, or the name of ".. | 26 | cmd:argument("rock", "A rockspec file, a source rock file, or the name of ".. |
27 | "a rock to be fetched from a repository.") | 27 | "a rock to be fetched from a repository.") |
28 | :args("?") | ||
28 | cmd:argument("version", "Rock version.") | 29 | cmd:argument("version", "Rock version.") |
29 | :args("?") | 30 | :args("?") |
30 | 31 | ||
@@ -33,6 +34,10 @@ function cmd_build.add_to_parser(parser) | |||
33 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. | 34 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. |
34 | "rock after building a new one. This behavior can be made permanent by ".. | 35 | "rock after building a new one. This behavior can be made permanent by ".. |
35 | "setting keep_other_versions=true in the configuration file.") | 36 | "setting keep_other_versions=true in the configuration file.") |
37 | cmd:flag("--force", "If --keep is not specified, force removal of ".. | ||
38 | "previously installed versions if it would break dependencies.") | ||
39 | cmd:flag("--force-fast", "Like --force, but performs a forced removal ".. | ||
40 | "without reporting dependency issues.") | ||
36 | cmd:option("--branch", "Override the `source.branch` field in the loaded ".. | 41 | cmd:option("--branch", "Override the `source.branch` field in the loaded ".. |
37 | "rockspec. Allows to specify a different branch to fetch. Particularly ".. | 42 | "rockspec. Allows to specify a different branch to fetch. Particularly ".. |
38 | 'for "dev" rocks.') | 43 | 'for "dev" rocks.') |
diff --git a/src/luarocks/cmd/install.lua b/src/luarocks/cmd/install.lua index 9085b3b7..6b308e0f 100644 --- a/src/luarocks/cmd/install.lua +++ b/src/luarocks/cmd/install.lua | |||
@@ -28,6 +28,10 @@ function install.add_to_parser(parser) | |||
28 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. | 28 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. |
29 | "rock after building a new one. This behavior can be made permanent by ".. | 29 | "rock after building a new one. This behavior can be made permanent by ".. |
30 | "setting keep_other_versions=true in the configuration file.") | 30 | "setting keep_other_versions=true in the configuration file.") |
31 | cmd:flag("--force", "If --keep is not specified, force removal of ".. | ||
32 | "previously installed versions if it would break dependencies.") | ||
33 | cmd:flag("--force-fast", "Like --force, but performs a forced removal ".. | ||
34 | "without reporting dependency issues.") | ||
31 | cmd:flag("--only-deps", "Installs only the dependencies of the rock.") | 35 | cmd:flag("--only-deps", "Installs only the dependencies of the rock.") |
32 | cmd:flag("--no-doc", "Installs the rock without its documentation.") | 36 | cmd:flag("--no-doc", "Installs the rock without its documentation.") |
33 | cmd:flag("--verify", "Verify signature of the rockspec or src.rock being ".. | 37 | cmd:flag("--verify", "Verify signature of the rockspec or src.rock being ".. |
diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua index 512a3d74..da22a446 100644 --- a/src/luarocks/cmd/make.lua +++ b/src/luarocks/cmd/make.lua | |||
@@ -45,6 +45,10 @@ only dependencies of the rockspec (see `luarocks help install`). | |||
45 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. | 45 | cmd:flag("--keep", "Do not remove previously installed versions of the ".. |
46 | "rock after building a new one. This behavior can be made permanent by ".. | 46 | "rock after building a new one. This behavior can be made permanent by ".. |
47 | "setting keep_other_versions=true in the configuration file.") | 47 | "setting keep_other_versions=true in the configuration file.") |
48 | cmd:flag("--force", "If --keep is not specified, force removal of ".. | ||
49 | "previously installed versions if it would break dependencies.") | ||
50 | cmd:flag("--force-fast", "Like --force, but performs a forced removal ".. | ||
51 | "without reporting dependency issues.") | ||
48 | cmd:option("--branch", "Override the `source.branch` field in the loaded ".. | 52 | cmd:option("--branch", "Override the `source.branch` field in the loaded ".. |
49 | "rockspec. Allows to specify a different branch to fetch. Particularly ".. | 53 | "rockspec. Allows to specify a different branch to fetch. Particularly ".. |
50 | 'for "dev" rocks.') | 54 | 'for "dev" rocks.') |
@@ -57,14 +61,15 @@ only dependencies of the rockspec (see `luarocks help install`). | |||
57 | "option to work properly.") | 61 | "option to work properly.") |
58 | cmd:flag("--sign", "To be used with --pack-binary-rock. Also produce a ".. | 62 | cmd:flag("--sign", "To be used with --pack-binary-rock. Also produce a ".. |
59 | "signature file for the generated .rock file.") | 63 | "signature file for the generated .rock file.") |
64 | util.deps_mode_option(cmd) | ||
60 | end | 65 | end |
61 | 66 | ||
62 | --- Driver function for "make" command. | 67 | --- Driver function for "make" command. |
63 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an | 68 | -- @return boolean or (nil, string, exitcode): True if build was successful; nil and an |
64 | -- error message otherwise. exitcode is optionally returned. | 69 | -- error message otherwise. exitcode is optionally returned. |
65 | function make.command(args) | 70 | function make.command(args) |
66 | local rockspec | 71 | local rockspec = args.rockspec |
67 | if not args.rockspec then | 72 | if not rockspec then |
68 | local err | 73 | local err |
69 | rockspec, err = util.get_default_rockspec() | 74 | rockspec, err = util.get_default_rockspec() |
70 | if not rockspec then | 75 | if not rockspec then |
diff --git a/src/luarocks/cmd/new_version.lua b/src/luarocks/cmd/new_version.lua index 95d762be..b6951059 100644 --- a/src/luarocks/cmd/new_version.lua +++ b/src/luarocks/cmd/new_version.lua | |||
@@ -139,22 +139,22 @@ local function update_source_section(out_rs, url, tag, old_ver, new_ver) | |||
139 | end | 139 | end |
140 | 140 | ||
141 | function new_version.command(args) | 141 | function new_version.command(args) |
142 | if not args.input then | 142 | if not args.rock then |
143 | local err | 143 | local err |
144 | args.input, err = util.get_default_rockspec() | 144 | args.rock, err = util.get_default_rockspec() |
145 | if not args.input then | 145 | if not args.rock then |
146 | return nil, err | 146 | return nil, err |
147 | end | 147 | end |
148 | end | 148 | end |
149 | 149 | ||
150 | local filename, err | 150 | local filename, err |
151 | if args.input:match("rockspec$") then | 151 | if args.rock:match("rockspec$") then |
152 | filename, err = fetch.fetch_url(args.input) | 152 | filename, err = fetch.fetch_url(args.rock) |
153 | if not filename then | 153 | if not filename then |
154 | return nil, err | 154 | return nil, err |
155 | end | 155 | end |
156 | else | 156 | else |
157 | filename, err = download.download("rockspec", args.input:lower()) | 157 | filename, err = download.download("rockspec", args.rock:lower()) |
158 | if not filename then | 158 | if not filename then |
159 | return nil, err | 159 | return nil, err |
160 | end | 160 | end |
diff --git a/src/luarocks/cmd/purge.lua b/src/luarocks/cmd/purge.lua index bf037678..c9102876 100644 --- a/src/luarocks/cmd/purge.lua +++ b/src/luarocks/cmd/purge.lua | |||
@@ -29,6 +29,10 @@ The --tree option is mandatory: luarocks purge does not assume a default tree.]] | |||
29 | "rock and remove the other ones. By default it only removes old ".. | 29 | "rock and remove the other ones. By default it only removes old ".. |
30 | "versions if they are not needed as dependencies. This can be ".. | 30 | "versions if they are not needed as dependencies. This can be ".. |
31 | "overridden with the flag --force.") | 31 | "overridden with the flag --force.") |
32 | cmd:flag("--force", "If --old-versions is specified, force removal of ".. | ||
33 | "previously installed versions if it would break dependencies.") | ||
34 | cmd:flag("--force-fast", "Like --force, but performs a forced removal ".. | ||
35 | "without reporting dependency issues.") | ||
32 | end | 36 | end |
33 | 37 | ||
34 | function purge.command(args) | 38 | function purge.command(args) |
diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua index f599f443..dd4b33d1 100644 --- a/src/luarocks/cmd/show.lua +++ b/src/luarocks/cmd/show.lua | |||
@@ -262,7 +262,7 @@ end | |||
262 | -- @return boolean: True if succeeded, nil on errors. | 262 | -- @return boolean: True if succeeded, nil on errors. |
263 | function show.command(args) | 263 | function show.command(args) |
264 | local name = util.adjust_name_and_namespace(args.rock, args) | 264 | local name = util.adjust_name_and_namespace(args.rock, args) |
265 | local version = args.verson | 265 | local version = args.version |
266 | local query = queries.new(name, version) | 266 | local query = queries.new(name, version) |
267 | 267 | ||
268 | local repo, repo_url | 268 | local repo, repo_url |