From 52cd32aca3b9dca4ec2632d4e8c80de1a47da5ab Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 22 Dec 2013 07:49:58 +0100 Subject: fixed bug where context menu options did not support paths containing spaces --- win32/bin/luarocksw.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win32/bin/luarocksw.bat b/win32/bin/luarocksw.bat index 313508d4..8ac02920 100644 --- a/win32/bin/luarocksw.bat +++ b/win32/bin/luarocksw.bat @@ -34,14 +34,14 @@ if [%1]==[removeall] goto REMOVEALL REM execute LuaRocks and wait for results echo executing: luarocks %* -call %MYPATH%luarocks %* +call "%MYPATH%luarocks" %* pause goto END :REMOVEALL for /f "delims=-" %%a in ("%~n2") do ( echo executing: luarocks remove %%a - %MYPATH%luarocks remove "%%a" + "%MYPATH%luarocks" remove "%%a" pause goto END ) -- cgit v1.2.3-55-g6feb From c04e89b2084843256117dfe045393391a7384a74 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 22 Dec 2013 08:25:09 +0100 Subject: adds flag `--verbose` as equivalent for config file `verbose = true` --- src/luarocks/command_line.lua | 6 ++++++ src/luarocks/fs.lua | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 63b918b5..059b7a1c 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua @@ -61,6 +61,12 @@ function run_command(...) local command + if flags["verbose"] then -- setting it in the config file will kick-in earlier in the process + cfg.verbose = true + local fs = require("luarocks.fs") + fs.verbose() + end + if flags["version"] then util.printout(program.." "..cfg.program_version) util.printout(program_description) diff --git a/src/luarocks/fs.lua b/src/luarocks/fs.lua index 2d799da2..b281eb14 100644 --- a/src/luarocks/fs.lua +++ b/src/luarocks/fs.lua @@ -14,7 +14,9 @@ local cfg = require("luarocks.cfg") local pack = table.pack or function(...) return { n = select("#", ...), ... } end local unpack = table.unpack or unpack -if cfg.verbose then -- patch io.popen and os.execute to display commands in verbose mode +local old_popen, old_exec +_M.verbose = function() -- patch io.popen and os.execute to display commands in verbose mode + if old_popen or old_exec then return end old_popen = io.popen io.popen = function(one, two) if two == nil then @@ -36,6 +38,7 @@ if cfg.verbose then -- patch io.popen and os.execute to display commands in verb return unpack(code, 1, code.n) end end +if cfg.verbose then _M.verbose() end local function load_fns(fs_table) for name, fn in pairs(fs_table) do -- cgit v1.2.3-55-g6feb From df91dc76f867cc2c79bab1b086a5ed7e607b1d97 Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 22 Dec 2013 09:03:18 +0100 Subject: Normalizes paths displayed from `search` module, used for searching and listing installed rocks --- src/luarocks/dir.lua | 2 +- src/luarocks/search.lua | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index 3c7465bb..5174fadc 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua @@ -65,5 +65,5 @@ function split_url(url) end function normalize(name) - return name:gsub("\\", "/"):gsub("(.)/*$", "%1") + return name:gsub("\\", "/"):gsub("(.)/*$", "%1"):gsub("//", "/") end diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 356e06e8..76ea6815 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua @@ -305,6 +305,7 @@ function print_results(results, porcelain) end for version, repos in util.sortedpairs(versions, deps.compare_versions) do for _, repo in ipairs(repos) do + repo.repo = dir.normalize(repo.repo) if porcelain then util.printout(package, version, repo.arch, repo.repo) else -- cgit v1.2.3-55-g6feb From c0563374ba47b554db92dfab949281c55210c3aa Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 22 Dec 2013 09:29:08 +0100 Subject: take urls into account besides local paths --- src/luarocks/dir.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index 5174fadc..e8cd746e 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua @@ -64,6 +64,14 @@ function split_url(url) return protocol, pathname end +--- Normalize a url or local path. +-- URLs should be in the "protocol://path" format. System independent +-- forward slashes are used, removing trailing and double slashes +-- @param url string: an URL or a local pathname. +-- @return string: Normalized result. function normalize(name) - return name:gsub("\\", "/"):gsub("(.)/*$", "%1"):gsub("//", "/") + local protocol, pathname = split_url(name) + pathname = pathname:gsub("\\", "/"):gsub("(.)/*$", "%1"):gsub("//", "/") + if protocol ~= "file" then pathname = protocol .."://"..pathname end + return pathname end -- cgit v1.2.3-55-g6feb From 82e065ce8367da30e9e9804b9bb033375592612a Mon Sep 17 00:00:00 2001 From: Thijs Schreijer Date: Sun, 22 Dec 2013 09:42:52 +0100 Subject: fixed wrong tree order in config file; order was user - system. Now corrected to system - user. So installations default to system tree. --- install.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.bat b/install.bat index 758c1efc..f6d6f842 100644 --- a/install.bat +++ b/install.bat @@ -738,8 +738,8 @@ rocks_trees = { if FORCE_CONFIG then f:write(" home..[[/luarocks]],\n") end -f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") f:write(S" { name = [[user]], root = home..[[/luarocks]] },\n") +f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") f:write("}\n") if vars.SCRIPTS_DIR then f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") -- cgit v1.2.3-55-g6feb