diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2017-10-08 16:26:47 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-08 16:26:47 -0300 |
| commit | e46fd3ea1c597c57f69376eb7a136133c3fa393e (patch) | |
| tree | c7cb6fc83945525eb4a86bf56f77760278d3c7c9 | |
| parent | 5aa06d43a86754f30347813803f2a9eb6f99a611 (diff) | |
| download | luarocks-e46fd3ea1c597c57f69376eb7a136133c3fa393e.tar.gz luarocks-e46fd3ea1c597c57f69376eb7a136133c3fa393e.tar.bz2 luarocks-e46fd3ea1c597c57f69376eb7a136133c3fa393e.zip | |
Adds --dev flag for development-branch sub-repositories. (#736)
This adds support for easily requesting `dev` modules from
LuaRocks.org, as in:
```
luarocks install --dev luafilesystem
```
The list of URLs configured in `rocks_servers` is prepended
with a list containing "/dev" in their paths.
| -rw-r--r-- | CHANGELOG.md | 4 | ||||
| -rw-r--r-- | src/luarocks/cmd/help.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/command_line.lua | 17 | ||||
| -rw-r--r-- | src/luarocks/core/vers.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 1 |
5 files changed, 23 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 68b90be7..6ecb336d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md | |||
| @@ -6,6 +6,10 @@ What's new in LuaRocks 3.0 | |||
| 6 | For example, if you have `/some/dir/lua/5.1/` in your `$LUA_PATH` and | 6 | For example, if you have `/some/dir/lua/5.1/` in your `$LUA_PATH` and |
| 7 | you are running Lua 5.2, `luarocks.loader` and the `luarocks` command-line | 7 | you are running Lua 5.2, `luarocks.loader` and the `luarocks` command-line |
| 8 | tool will convert it to `/some/dir/lua/5.2/`. | 8 | tool will convert it to `/some/dir/lua/5.2/`. |
| 9 | * New flag `--dev`, for enabling development-branch sub-repositories. | ||
| 10 | This adds support for easily requesting `dev` modules from LuaRocks.org, as in: | ||
| 11 | `luarocks install --dev luafilesystem`. The list of URLs configured | ||
| 12 | in `rocks_servers` is prepended with a list containing "/dev" in their paths. | ||
| 9 | 13 | ||
| 10 | Rockspec 3.0 | 14 | Rockspec 3.0 |
| 11 | ------------ | 15 | ------------ |
diff --git a/src/luarocks/cmd/help.lua b/src/luarocks/cmd/help.lua index b986534c..d58fdcc0 100644 --- a/src/luarocks/cmd/help.lua +++ b/src/luarocks/cmd/help.lua | |||
| @@ -52,6 +52,8 @@ function help.command(flags, command) | |||
| 52 | util.printout([[ | 52 | util.printout([[ |
| 53 | These apply to all commands, as appropriate: | 53 | These apply to all commands, as appropriate: |
| 54 | 54 | ||
| 55 | --dev Enable the sub-repositories in rocks servers | ||
| 56 | for rockspecs of in-development versions | ||
| 55 | --server=<server> Fetch rocks/rockspecs from this server | 57 | --server=<server> Fetch rocks/rockspecs from this server |
| 56 | (takes priority over config file) | 58 | (takes priority over config file) |
| 57 | --only-server=<server> Fetch rocks/rockspecs from this server only | 59 | --only-server=<server> Fetch rocks/rockspecs from this server only |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 6a1cc519..9d33fe15 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
| @@ -10,6 +10,7 @@ local path = require("luarocks.path") | |||
| 10 | local dir = require("luarocks.dir") | 10 | local dir = require("luarocks.dir") |
| 11 | local deps = require("luarocks.deps") | 11 | local deps = require("luarocks.deps") |
| 12 | local fs = require("luarocks.fs") | 12 | local fs = require("luarocks.fs") |
| 13 | local fun = require("luarocks.fun") | ||
| 13 | 14 | ||
| 14 | local program = util.this_program("luarocks") | 15 | local program = util.this_program("luarocks") |
| 15 | 16 | ||
| @@ -172,11 +173,23 @@ function command_line.run_command(...) | |||
| 172 | cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir | 173 | cfg.variables.SCRIPTS_DIR = cfg.deploy_bin_dir |
| 173 | 174 | ||
| 174 | if flags["server"] then | 175 | if flags["server"] then |
| 175 | local protocol, path = dir.split_url(flags["server"]) | 176 | local protocol, pathname = dir.split_url(flags["server"]) |
| 176 | table.insert(cfg.rocks_servers, 1, protocol.."://"..path) | 177 | table.insert(cfg.rocks_servers, 1, protocol.."://"..pathname) |
| 178 | end | ||
| 179 | |||
| 180 | if flags["dev"] then | ||
| 181 | local append_dev = function(s) return dir.path(s, "dev") end | ||
| 182 | local dev_servers = fun.traverse(cfg.rocks_servers, append_dev) | ||
| 183 | cfg.rocks_servers = fun.concat(dev_servers, cfg.rocks_servers) | ||
| 177 | end | 184 | end |
| 178 | 185 | ||
| 179 | if flags["only-server"] then | 186 | if flags["only-server"] then |
| 187 | if flags["dev"] then | ||
| 188 | die("--only-server cannot be used with --dev") | ||
| 189 | end | ||
| 190 | if flags["server"] then | ||
| 191 | die("--only-server cannot be used with --server") | ||
| 192 | end | ||
| 180 | cfg.rocks_servers = { flags["only-server"] } | 193 | cfg.rocks_servers = { flags["only-server"] } |
| 181 | end | 194 | end |
| 182 | 195 | ||
diff --git a/src/luarocks/core/vers.lua b/src/luarocks/core/vers.lua index 1c016bbb..864cc5b5 100644 --- a/src/luarocks/core/vers.lua +++ b/src/luarocks/core/vers.lua | |||
| @@ -6,6 +6,7 @@ local require = nil | |||
| 6 | -------------------------------------------------------------------------------- | 6 | -------------------------------------------------------------------------------- |
| 7 | 7 | ||
| 8 | local deltas = { | 8 | local deltas = { |
| 9 | dev = 120000000, | ||
| 9 | scm = 110000000, | 10 | scm = 110000000, |
| 10 | cvs = 100000000, | 11 | cvs = 100000000, |
| 11 | rc = -1000, | 12 | rc = -1000, |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 0af23df6..1bc24be7 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -89,6 +89,7 @@ local supported_flags = { | |||
| 89 | ["deps"] = true, | 89 | ["deps"] = true, |
| 90 | ["deps-mode"] = "<mode>", | 90 | ["deps-mode"] = "<mode>", |
| 91 | ["detailed"] = "\"<text>\"", | 91 | ["detailed"] = "\"<text>\"", |
| 92 | ["dev"] = true, | ||
| 92 | ["force"] = true, | 93 | ["force"] = true, |
| 93 | ["force-fast"] = true, | 94 | ["force-fast"] = true, |
| 94 | ["from"] = "<server>", | 95 | ["from"] = "<server>", |
