aboutsummaryrefslogtreecommitdiff
path: root/spec/util
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-04-05 15:50:45 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-04-11 14:38:06 -0300
commit835d21e98e95e0ed2b6b028ddb06fe87427e5488 (patch)
tree1873e77e938a013b60ef106e1fa063f41ce159c2 /spec/util
parent660f088cf936dcaa65a1c7eb2793df78777ad924 (diff)
downloadluarocks-835d21e98e95e0ed2b6b028ddb06fe87427e5488.tar.gz
luarocks-835d21e98e95e0ed2b6b028ddb06fe87427e5488.tar.bz2
luarocks-835d21e98e95e0ed2b6b028ddb06fe87427e5488.zip
Add support for namespaces.
For details of the new feature, see https://github.com/luarocks/luarocks/wiki/Namespaces This ended up being a huge commit because of some major refactoring motivated by the new feature: * new modules for some object types: * `luarocks.queries` - all functions that look for rocks in local or remote repositories now use objects constructed by this module: query objects contain the name, namespace and query constraints. Dependencies in a rockspec are also stored as query objects. * `luarocks.results` - all individual results produces from queries are returned in this format: result objects contain the name, namespace, version, arch and repo. * the `results` object was renamed to `result_tree`, to better reflect that it is not an array of `result` objects. * `luarocks.vers` was removed, its functionality was moved to better locations. Specifically on namespaces: * Commands that take a rock `name` can now take `namespace/name` (and alternately `--flags=namespace` so that URLs can be also installed with a nominal namespace). * Rocks installed from a namespace now create a `rock_namespace` file alongside `rock_manifest`, which is used when matching namespaced dependencies against locally-installed rocks. * Using namespaced dependencies in a rockspec, requires `rockspec_format = "3.0"`. * Tests under the `#namespaces` hashtag, all using a local repository.
Diffstat (limited to 'spec/util')
-rw-r--r--spec/util/mock-server.lua3
-rw-r--r--spec/util/test_env.lua2
2 files changed, 3 insertions, 2 deletions
diff --git a/spec/util/mock-server.lua b/spec/util/mock-server.lua
index 77d32927..30586c98 100644
--- a/spec/util/mock-server.lua
+++ b/spec/util/mock-server.lua
@@ -70,7 +70,8 @@ server:add_resource("/file/{name:[^/]+}", {
70 path = "/", 70 path = "/",
71 produces = "text/plain", 71 produces = "text/plain",
72 handler = function(query, name) 72 handler = function(query, name)
73 local fd = io.open("../spec/fixtures/"..name, "r") 73 local basedir = arg[1] or "../spec/fixtures"
74 local fd = io.open(basedir .. "/" .. name, "r")
74 if not fd then 75 if not fd then
75 return restserver.response():status(404) 76 return restserver.response():status(404)
76 end 77 end
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua
index 23ca5c77..94008913 100644
--- a/spec/util/test_env.lua
+++ b/spec/util/test_env.lua
@@ -175,7 +175,7 @@ local function execute_output(command, print_command, env_variables)
175 local file = assert(io.popen(command)) 175 local file = assert(io.popen(command))
176 local output = file:read('*all') 176 local output = file:read('*all')
177 file:close() 177 file:close()
178 return output:gsub("\n","") -- output adding new line, need to be removed 178 return (output:gsub("\r\n", "\n"):gsub("\n$", "")) -- remove final newline
179end 179end
180 180
181--- Set test_env.LUA_V or test_env.LUAJIT_V based 181--- Set test_env.LUA_V or test_env.LUAJIT_V based