aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 16:26:47 -0300
committerGitHub <noreply@github.com>2017-10-08 16:26:47 -0300
commite46fd3ea1c597c57f69376eb7a136133c3fa393e (patch)
treec7cb6fc83945525eb4a86bf56f77760278d3c7c9 /src
parent5aa06d43a86754f30347813803f2a9eb6f99a611 (diff)
downloadluarocks-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.
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/cmd/help.lua2
-rw-r--r--src/luarocks/command_line.lua17
-rw-r--r--src/luarocks/core/vers.lua1
-rw-r--r--src/luarocks/util.lua1
4 files changed, 19 insertions, 2 deletions
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")
10local dir = require("luarocks.dir") 10local dir = require("luarocks.dir")
11local deps = require("luarocks.deps") 11local deps = require("luarocks.deps")
12local fs = require("luarocks.fs") 12local fs = require("luarocks.fs")
13local fun = require("luarocks.fun")
13 14
14local program = util.this_program("luarocks") 15local 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
8local deltas = { 8local 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>",