diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-06 09:02:11 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-11 14:38:06 -0300 |
| commit | e91d86ed1e41724b857cc80b7f433926a319e2ef (patch) | |
| tree | e4840c87f6488922b2af3cb13e820e807516861b | |
| parent | 95f929dfd3618a8efcb7f1bccbda046d623f0a47 (diff) | |
| download | luarocks-e91d86ed1e41724b857cc80b7f433926a319e2ef.tar.gz luarocks-e91d86ed1e41724b857cc80b7f433926a319e2ef.tar.bz2 luarocks-e91d86ed1e41724b857cc80b7f433926a319e2ef.zip | |
show: make --deps aware of namespaces
| -rw-r--r-- | spec/show_spec.lua | 41 | ||||
| -rw-r--r-- | src/luarocks/cmd/show.lua | 5 |
2 files changed, 29 insertions, 17 deletions
diff --git a/spec/show_spec.lua b/spec/show_spec.lua index 234a8a33..abf9a93b 100644 --- a/spec/show_spec.lua +++ b/spec/show_spec.lua | |||
| @@ -1,70 +1,79 @@ | |||
| 1 | local test_env = require("spec.util.test_env") | 1 | local test_env = require("spec.util.test_env") |
| 2 | local run = test_env.run | 2 | local run = test_env.run |
| 3 | local testing_paths = test_env.testing_paths | ||
| 3 | 4 | ||
| 4 | test_env.unload_luarocks() | 5 | test_env.unload_luarocks() |
| 5 | 6 | ||
| 6 | describe("LuaRocks show tests #blackbox #b_show", function() | 7 | describe("LuaRocks show #blackbox #b_show", function() |
| 7 | 8 | ||
| 8 | before_each(function() | 9 | before_each(function() |
| 9 | test_env.setup_specs() | 10 | test_env.setup_specs() |
| 10 | end) | 11 | end) |
| 11 | 12 | ||
| 12 | it("LuaRocks show with no flags/arguments", function() | 13 | it("with no flags/arguments", function() |
| 13 | assert.is_false(run.luarocks_bool("show")) | 14 | assert.is_false(run.luarocks_bool("show")) |
| 14 | end) | 15 | end) |
| 15 | 16 | ||
| 16 | describe("LuaRocks show basic tests with flags", function() | 17 | describe("basic tests with flags", function() |
| 17 | it("LuaRocks show invalid", function() | 18 | it("invalid", function() |
| 18 | assert.is_false(run.luarocks_bool("show invalid")) | 19 | assert.is_false(run.luarocks_bool("show invalid")) |
| 19 | end) | 20 | end) |
| 20 | 21 | ||
| 21 | it("LuaRocks show luacov", function() | 22 | it("luacov", function() |
| 22 | local output = run.luarocks("show luacov") | 23 | local output = run.luarocks("show luacov") |
| 23 | assert.is.truthy(output:match("LuaCov")) | 24 | assert.is.truthy(output:match("LuaCov")) |
| 24 | end) | 25 | end) |
| 25 | 26 | ||
| 26 | it("LuaRocks show luacov with uppercase name", function() | 27 | it("luacov with uppercase name", function() |
| 27 | local output = run.luarocks("show LuaCov") | 28 | local output = run.luarocks("show LuaCov") |
| 28 | assert.is.truthy(output:match("LuaCov")) | 29 | assert.is.truthy(output:match("LuaCov")) |
| 29 | end) | 30 | end) |
| 30 | 31 | ||
| 31 | it("LuaRocks show modules of luacov", function() | 32 | it("modules of luacov", function() |
| 32 | local output = run.luarocks("show --modules luacov") | 33 | local output = run.luarocks("show --modules luacov") |
| 33 | assert.match("luacov.*luacov.defaults.*luacov.reporter.*luacov.reporter.default.*luacov.runner.*luacov.stats.*luacov.tick", output) | 34 | assert.match("luacov.*luacov.defaults.*luacov.reporter.*luacov.reporter.default.*luacov.runner.*luacov.stats.*luacov.tick", output) |
| 34 | end) | 35 | end) |
| 35 | 36 | ||
| 36 | it("LuaRocks show dependencies of luacov", function() | 37 | it("--deps", function() |
| 37 | local output = run.luarocks("show --deps luacov") | 38 | assert(run.luarocks_bool("build has_namespaced_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) |
| 39 | local output = run.luarocks("show --deps has_namespaced_dep") | ||
| 40 | assert.match("a_user/a_rock", output) | ||
| 41 | end) | ||
| 42 | |||
| 43 | it("list dependencies", function() | ||
| 44 | assert(run.luarocks_bool("build has_namespaced_dep --server=" .. testing_paths.fixtures_dir .. "/a_repo" )) | ||
| 45 | local output = run.luarocks("show has_namespaced_dep") | ||
| 46 | assert.match("a_user/a_rock.*2.0", output) | ||
| 38 | end) | 47 | end) |
| 39 | 48 | ||
| 40 | it("LuaRocks show rockspec of luacov", function() | 49 | it("rockspec of luacov", function() |
| 41 | local output = run.luarocks("show --rockspec luacov") | 50 | local output = run.luarocks("show --rockspec luacov") |
| 42 | assert.is.truthy(output:match("luacov--0.11.0--1.rockspec")) | 51 | assert.is.truthy(output:match("luacov--0.11.0--1.rockspec")) |
| 43 | end) | 52 | end) |
| 44 | 53 | ||
| 45 | it("LuaRocks show mversion of luacov", function() | 54 | it("mversion of luacov", function() |
| 46 | local output = run.luarocks("show --mversion luacov") | 55 | local output = run.luarocks("show --mversion luacov") |
| 47 | assert.is.truthy(output:match("0.11.0--1")) | 56 | assert.is.truthy(output:match("0.11.0--1")) |
| 48 | end) | 57 | end) |
| 49 | 58 | ||
| 50 | it("LuaRocks show rock tree of luacov", function() | 59 | it("rock tree of luacov", function() |
| 51 | local output = run.luarocks("show --rock-tree luacov") | 60 | local output = run.luarocks("show --rock-tree luacov") |
| 52 | end) | 61 | end) |
| 53 | 62 | ||
| 54 | it("LuaRocks show rock directory of luacov", function() | 63 | it("rock directory of luacov", function() |
| 55 | local output = run.luarocks("show --rock-dir luacov") | 64 | local output = run.luarocks("show --rock-dir luacov") |
| 56 | end) | 65 | end) |
| 57 | 66 | ||
| 58 | it("LuaRocks show issues URL of luacov", function() | 67 | it("issues URL of luacov", function() |
| 59 | local output = run.luarocks("show --issues luacov") | 68 | local output = run.luarocks("show --issues luacov") |
| 60 | end) | 69 | end) |
| 61 | 70 | ||
| 62 | it("LuaRocks show labels of luacov", function() | 71 | it("labels of luacov", function() |
| 63 | local output = run.luarocks("show --labels luacov") | 72 | local output = run.luarocks("show --labels luacov") |
| 64 | end) | 73 | end) |
| 65 | end) | 74 | end) |
| 66 | 75 | ||
| 67 | it("LuaRocks show old version of luacov", function() | 76 | it("old version of luacov", function() |
| 68 | run.luarocks("install luacov 0.11.0") | 77 | run.luarocks("install luacov 0.11.0") |
| 69 | run.luarocks_bool("show luacov 0.11.0") | 78 | run.luarocks_bool("show luacov 0.11.0") |
| 70 | end) | 79 | end) |
diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua index 9f8bc472..bed210d2 100644 --- a/src/luarocks/cmd/show.lua +++ b/src/luarocks/cmd/show.lua | |||
| @@ -108,7 +108,10 @@ function show.command(flags, name, version) | |||
| 108 | elseif flags["issues"] then util.printout(descript.issues_url) | 108 | elseif flags["issues"] then util.printout(descript.issues_url) |
| 109 | elseif flags["labels"] then util.printout(descript.labels and table.concat(descript.labels, "\n")) | 109 | elseif flags["labels"] then util.printout(descript.labels and table.concat(descript.labels, "\n")) |
| 110 | elseif flags["modules"] then util.printout(keys_as_string(minfo.modules, "\n")) | 110 | elseif flags["modules"] then util.printout(keys_as_string(minfo.modules, "\n")) |
| 111 | elseif flags["deps"] then util.printout(keys_as_string(minfo.dependencies or {})) | 111 | elseif flags["deps"] then |
| 112 | for _, dep in ipairs(rockspec.dependencies) do | ||
| 113 | util.printout(tostring(dep)) | ||
| 114 | end | ||
| 112 | elseif flags["rockspec"] then util.printout(rockspec_file) | 115 | elseif flags["rockspec"] then util.printout(rockspec_file) |
| 113 | elseif flags["mversion"] then util.printout(version) | 116 | elseif flags["mversion"] then util.printout(version) |
| 114 | else | 117 | else |
