On 25 June 2013 11:27, Gary V. Vaughan <g...@vaughan.pe> wrote: > Hi Hisham, > > I'm having trouble developing the next version of my Lua packages > while the previous (stable) release are installed as rocks... and > where both stable (installed) and development (in working dir) > need access to the rocks tree for the packages they in turn depend > on. > > Let's say I run bin/specl from my dev tree, which contains: > > require 'specl.util' > > I want that link to pick up the dev version of that file from > lib/specl/util.lua (in the dev tree), but when I run: > > LUA_PATH='./lib/?.lua;;' bin/specl > > ...the require function actually loads the (incompatible) stable > version from the rocks tree, in /usr/local/share/lua/5.2/specl/util.lua, > because luarocks has pushed my LUA_PATH setting too far down the > package.path IMHO: > > $ LUA_PATH='./lib/?.lua;;' lua5.2 /usr/local/bin/luarocks path > > export LUA_PATH='/usr/local/share/lua/5.2/?.lua;\ <<< loads from here > /usr/local/share/lua/5.2/?/init.lua;\ > /Users/gary/.luarocks/share/lua/5.2/?.lua;\ > /Users/gary/.luarocks/share/lua/5.2/?/init.lua;\ > /usr/local/luarocks/HEAD/share/lua/5.2//?.lua;\ > /usr/local/luarocks/2.0.12/share/lua/5.2//?/init.lua;\ > ./lib/?.lua;\ <<< instead of here > /usr/local/lib/lua/5.2/?.lua; > /usr/local/lib/lua/5.2/?/init.lua; > ./?.lua;' > > (indented for clarity) > > I think luarocks should add it's additional directories just before the > system path, marked by ;; in my LUA_PATH setting. Have I installed > luarocks incorrectly? Or is there another way to add my working tree > paths to the *front* of LUA_PATH? > > If not, then it seems like `luarocks path` is broken :(
Well, the point of `luarocks path` _is_ to ensure that the LuaRocks-installed modules are found. I see no other way of doing that. Is your bin/specl script resetting the package.path? I would expect something like this to work to your liking: $ luarocks path export LUA_PATH="/paths/set/by/luarocks/..." $ eval `luarocks path` $ echo $LUA_PATH /paths/set/by/luarocks/... $ LUA_PATH="./lib/?.lua;$LUA_PATH" lua -e 'print(package.path)' ./lib/?.lua;/paths/set/by/luarocks/... $ LUA_PATH="./lib/?.lua;$LUA_PATH" bin/specl # works as intended?... Am I missing something? -- Hisham http://hisham.hm/ ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Luarocks-developers mailing list Luarocks-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/luarocks-developers