aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2018-10-30 11:25:48 -0300
committerHisham Muhammad <hisham@gobolinux.org>2018-10-30 11:25:48 -0300
commit63d26aaddf194769902a8d3d12c71241eeec1612 (patch)
tree77e8b6be4b7370e58de9c57c25a770ee2ffb43e6
parentb37835d9375d903d51fe8af67aa70031191675ff (diff)
downloadluarocks-63d26aaddf194769902a8d3d12c71241eeec1612.tar.gz
luarocks-63d26aaddf194769902a8d3d12c71241eeec1612.tar.bz2
luarocks-63d26aaddf194769902a8d3d12c71241eeec1612.zip
Smarter default rockspec, based on current dir basename
This allows the following to work: ``` git clone https://github.com/example/foo cd foo luarocks download --rockspec bar luarocks test # will still use the foo rockspec # regardless of the presence of bar rockspec ```
-rw-r--r--src/luarocks/util.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index 3d8f9738..9aef9049 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -440,6 +440,14 @@ function util.get_default_rockspec()
440 return unnamed_paths[1] 440 return unnamed_paths[1]
441 end 441 end
442 else 442 else
443 local fs = require("luarocks.fs")
444 local dir = require("luarocks.dir")
445 local basename = dir.base_name(fs.current_dir())
446
447 if paths[basename] then
448 return paths[basename]
449 end
450
443 local rock = next(versions) 451 local rock = next(versions)
444 452
445 if rock then 453 if rock then