From 63d26aaddf194769902a8d3d12c71241eeec1612 Mon Sep 17 00:00:00 2001
From: Hisham Muhammad <hisham@gobolinux.org>
Date: Tue, 30 Oct 2018 11:25:48 -0300
Subject: 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
```
---
 src/luarocks/util.lua | 8 ++++++++
 1 file changed, 8 insertions(+)

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()
          return unnamed_paths[1]
       end
    else
+      local fs = require("luarocks.fs")
+      local dir = require("luarocks.dir")
+      local basename = dir.base_name(fs.current_dir())
+
+      if paths[basename] then
+         return paths[basename]
+      end
+
       local rock = next(versions)
 
       if rock then
-- 
cgit v1.2.3-55-g6feb