diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-04-20 13:14:36 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-05-07 19:27:37 -0300 |
| commit | 129207c5088d0c7a4143de20844a898267b471de (patch) | |
| tree | b9f95ddfeb32854951d7bc765f8492941875c65e /src | |
| parent | 4566c9bb20b8986d511c61c1f96bb2333e07bb1d (diff) | |
| download | luarocks-129207c5088d0c7a4143de20844a898267b471de.tar.gz luarocks-129207c5088d0c7a4143de20844a898267b471de.tar.bz2 luarocks-129207c5088d0c7a4143de20844a898267b471de.zip | |
rockspec format: add `test_dependencies`
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cmd/show.lua | 13 | ||||
| -rw-r--r-- | src/luarocks/fetch.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/test.lua | 10 | ||||
| -rw-r--r-- | src/luarocks/type/rockspec.lua | 11 |
4 files changed, 34 insertions, 2 deletions
diff --git a/src/luarocks/cmd/show.lua b/src/luarocks/cmd/show.lua index b76ff778..ffac440b 100644 --- a/src/luarocks/cmd/show.lua +++ b/src/luarocks/cmd/show.lua | |||
| @@ -22,6 +22,7 @@ With these flags, return only the desired information: | |||
| 22 | --modules all modules provided by this package as used by require() | 22 | --modules all modules provided by this package as used by require() |
| 23 | --deps packages this package depends on | 23 | --deps packages this package depends on |
| 24 | --build-deps build-only dependencies for this package | 24 | --build-deps build-only dependencies for this package |
| 25 | --test-deps dependencies for testing this package | ||
| 25 | --rockspec the full path of the rockspec file | 26 | --rockspec the full path of the rockspec file |
| 26 | --mversion the package version | 27 | --mversion the package version |
| 27 | --rock-tree local tree where rock is installed | 28 | --rock-tree local tree where rock is installed |
| @@ -118,6 +119,10 @@ function show.command(flags, name, version) | |||
| 118 | for _, dep in ipairs(rockspec.build_dependencies) do | 119 | for _, dep in ipairs(rockspec.build_dependencies) do |
| 119 | util.printout(tostring(dep)) | 120 | util.printout(tostring(dep)) |
| 120 | end | 121 | end |
| 122 | elseif flags["test-deps"] then | ||
| 123 | for _, dep in ipairs(rockspec.test_dependencies) do | ||
| 124 | util.printout(tostring(dep)) | ||
| 125 | end | ||
| 121 | elseif flags["rockspec"] then util.printout(rockspec_file) | 126 | elseif flags["rockspec"] then util.printout(rockspec_file) |
| 122 | elseif flags["mversion"] then util.printout(version) | 127 | elseif flags["mversion"] then util.printout(version) |
| 123 | else | 128 | else |
| @@ -162,6 +167,14 @@ function show.command(flags, name, version) | |||
| 162 | end | 167 | end |
| 163 | end | 168 | end |
| 164 | 169 | ||
| 170 | if #rockspec.test_dependencies > 0 then | ||
| 171 | util.printout() | ||
| 172 | util.printout("Tests depend on:") | ||
| 173 | for _, dep in ipairs(rockspec.test_dependencies) do | ||
| 174 | util.printout("\t"..tostring(dep).." "..installed_rock_label(dep, flags["tree"])) | ||
| 175 | end | ||
| 176 | end | ||
| 177 | |||
| 165 | local direct_deps = {} | 178 | local direct_deps = {} |
| 166 | if #rockspec.dependencies > 0 then | 179 | if #rockspec.dependencies > 0 then |
| 167 | util.printout() | 180 | util.printout() |
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 08998986..9ea2b487 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -240,6 +240,7 @@ function fetch.load_local_rockspec(filename, quick) | |||
| 240 | util.platform_overrides(rockspec.build) | 240 | util.platform_overrides(rockspec.build) |
| 241 | util.platform_overrides(rockspec.dependencies) | 241 | util.platform_overrides(rockspec.dependencies) |
| 242 | util.platform_overrides(rockspec.build_dependencies) | 242 | util.platform_overrides(rockspec.build_dependencies) |
| 243 | util.platform_overrides(rockspec.test_dependencies) | ||
| 243 | util.platform_overrides(rockspec.external_dependencies) | 244 | util.platform_overrides(rockspec.external_dependencies) |
| 244 | util.platform_overrides(rockspec.source) | 245 | util.platform_overrides(rockspec.source) |
| 245 | util.platform_overrides(rockspec.hooks) | 246 | util.platform_overrides(rockspec.hooks) |
| @@ -288,6 +289,7 @@ function fetch.load_local_rockspec(filename, quick) | |||
| 288 | 289 | ||
| 289 | convert_dependencies(rockspec, "dependencies") | 290 | convert_dependencies(rockspec, "dependencies") |
| 290 | convert_dependencies(rockspec, "build_dependencies") | 291 | convert_dependencies(rockspec, "build_dependencies") |
| 292 | convert_dependencies(rockspec, "test_dependencies") | ||
| 291 | 293 | ||
| 292 | if not quick then | 294 | if not quick then |
| 293 | path.configure_paths(rockspec) | 295 | path.configure_paths(rockspec) |
diff --git a/src/luarocks/test.lua b/src/luarocks/test.lua index 2a64a5d8..c7e3e013 100644 --- a/src/luarocks/test.lua +++ b/src/luarocks/test.lua | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | local test = {} | 2 | local test = {} |
| 3 | 3 | ||
| 4 | local fetch = require("luarocks.fetch") | 4 | local fetch = require("luarocks.fetch") |
| 5 | local deps = require("luarocks.deps") | ||
| 5 | 6 | ||
| 6 | local test_types = { | 7 | local test_types = { |
| 7 | "busted", | 8 | "busted", |
| @@ -49,7 +50,14 @@ function test.run_test_suite(rockspec_arg, args) | |||
| 49 | if not test_type then | 50 | if not test_type then |
| 50 | return nil, err | 51 | return nil, err |
| 51 | end | 52 | end |
| 52 | 53 | ||
| 54 | if next(rockspec.test_dependencies) then | ||
| 55 | local ok, err, errcode = deps.fulfill_dependencies(rockspec, "test_dependencies", "all") | ||
| 56 | if err then | ||
| 57 | return nil, err, errcode | ||
| 58 | end | ||
| 59 | end | ||
| 60 | |||
| 53 | local mod_name = "luarocks.test." .. test_type | 61 | local mod_name = "luarocks.test." .. test_type |
| 54 | local pok, test_mod = pcall(require, mod_name) | 62 | local pok, test_mod = pcall(require, mod_name) |
| 55 | if not pok then | 63 | if not pok then |
diff --git a/src/luarocks/type/rockspec.lua b/src/luarocks/type/rockspec.lua index bb36cfc3..16ab911c 100644 --- a/src/luarocks/type/rockspec.lua +++ b/src/luarocks/type/rockspec.lua | |||
| @@ -57,6 +57,15 @@ local rockspec_types = { | |||
| 57 | _pattern = "%s*([a-zA-Z0-9%.%-%_]*/?[a-zA-Z0-9][a-zA-Z0-9%.%-%_]*)%s*([^/]*)", | 57 | _pattern = "%s*([a-zA-Z0-9%.%-%_]*/?[a-zA-Z0-9][a-zA-Z0-9%.%-%_]*)%s*([^/]*)", |
| 58 | }, | 58 | }, |
| 59 | }, | 59 | }, |
| 60 | test_dependencies = { | ||
| 61 | _version = "3.0", | ||
| 62 | platforms = {}, -- recursively defined below | ||
| 63 | _any = { | ||
| 64 | _type = "string", | ||
| 65 | _name = "a valid dependency string", | ||
| 66 | _pattern = "%s*([a-zA-Z0-9%.%-%_]*/?[a-zA-Z0-9][a-zA-Z0-9%.%-%_]*)%s*([^/]*)", | ||
| 67 | }, | ||
| 68 | }, | ||
| 60 | supported_platforms = { | 69 | supported_platforms = { |
| 61 | _any = string_1, | 70 | _any = string_1, |
| 62 | }, | 71 | }, |
| @@ -125,7 +134,7 @@ type_rockspec.order = {"rockspec_format", "package", "version", | |||
| 125 | { "description", {"summary", "detailed", "homepage", "license" } }, | 134 | { "description", {"summary", "detailed", "homepage", "license" } }, |
| 126 | "supported_platforms", "dependencies", "build_dependencies", "external_dependencies", | 135 | "supported_platforms", "dependencies", "build_dependencies", "external_dependencies", |
| 127 | { "build", {"type", "modules", "copy_directories", "platforms"} }, | 136 | { "build", {"type", "modules", "copy_directories", "platforms"} }, |
| 128 | { "test", {"type"} }, | 137 | "test_dependencies", { "test", {"type"} }, |
| 129 | "hooks"} | 138 | "hooks"} |
| 130 | 139 | ||
| 131 | rockspec_types.build.platforms._any = rockspec_types.build | 140 | rockspec_types.build.platforms._any = rockspec_types.build |
