diff options
-rw-r--r-- | install.bat | 2 | ||||
-rw-r--r-- | src/luarocks/command_line.lua | 6 | ||||
-rw-r--r-- | src/luarocks/dir.lua | 10 | ||||
-rw-r--r-- | src/luarocks/fs.lua | 5 | ||||
-rw-r--r-- | src/luarocks/search.lua | 1 | ||||
-rw-r--r-- | win32/bin/luarocksw.bat | 4 |
6 files changed, 23 insertions, 5 deletions
diff --git a/install.bat b/install.bat index 758c1efc..f6d6f842 100644 --- a/install.bat +++ b/install.bat | |||
@@ -738,8 +738,8 @@ rocks_trees = { | |||
738 | if FORCE_CONFIG then | 738 | if FORCE_CONFIG then |
739 | f:write(" home..[[/luarocks]],\n") | 739 | f:write(" home..[[/luarocks]],\n") |
740 | end | 740 | end |
741 | f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") | ||
742 | f:write(S" { name = [[user]], root = home..[[/luarocks]] },\n") | 741 | f:write(S" { name = [[user]], root = home..[[/luarocks]] },\n") |
742 | f:write(S" { name = [[system]], root = [[$ROCKS_TREE]] },\n") | ||
743 | f:write("}\n") | 743 | f:write("}\n") |
744 | if vars.SCRIPTS_DIR then | 744 | if vars.SCRIPTS_DIR then |
745 | f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") | 745 | f:write(S"scripts_dir=[[$SCRIPTS_DIR]]\n") |
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(...) | |||
61 | 61 | ||
62 | local command | 62 | local command |
63 | 63 | ||
64 | if flags["verbose"] then -- setting it in the config file will kick-in earlier in the process | ||
65 | cfg.verbose = true | ||
66 | local fs = require("luarocks.fs") | ||
67 | fs.verbose() | ||
68 | end | ||
69 | |||
64 | if flags["version"] then | 70 | if flags["version"] then |
65 | util.printout(program.." "..cfg.program_version) | 71 | util.printout(program.." "..cfg.program_version) |
66 | util.printout(program_description) | 72 | util.printout(program_description) |
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index 3c7465bb..e8cd746e 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua | |||
@@ -64,6 +64,14 @@ function split_url(url) | |||
64 | return protocol, pathname | 64 | return protocol, pathname |
65 | end | 65 | end |
66 | 66 | ||
67 | --- Normalize a url or local path. | ||
68 | -- URLs should be in the "protocol://path" format. System independent | ||
69 | -- forward slashes are used, removing trailing and double slashes | ||
70 | -- @param url string: an URL or a local pathname. | ||
71 | -- @return string: Normalized result. | ||
67 | function normalize(name) | 72 | function normalize(name) |
68 | return name:gsub("\\", "/"):gsub("(.)/*$", "%1") | 73 | local protocol, pathname = split_url(name) |
74 | pathname = pathname:gsub("\\", "/"):gsub("(.)/*$", "%1"):gsub("//", "/") | ||
75 | if protocol ~= "file" then pathname = protocol .."://"..pathname end | ||
76 | return pathname | ||
69 | end | 77 | end |
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") | |||
14 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end | 14 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end |
15 | local unpack = table.unpack or unpack | 15 | local unpack = table.unpack or unpack |
16 | 16 | ||
17 | if cfg.verbose then -- patch io.popen and os.execute to display commands in verbose mode | 17 | local old_popen, old_exec |
18 | _M.verbose = function() -- patch io.popen and os.execute to display commands in verbose mode | ||
19 | if old_popen or old_exec then return end | ||
18 | old_popen = io.popen | 20 | old_popen = io.popen |
19 | io.popen = function(one, two) | 21 | io.popen = function(one, two) |
20 | if two == nil then | 22 | if two == nil then |
@@ -36,6 +38,7 @@ if cfg.verbose then -- patch io.popen and os.execute to display commands in verb | |||
36 | return unpack(code, 1, code.n) | 38 | return unpack(code, 1, code.n) |
37 | end | 39 | end |
38 | end | 40 | end |
41 | if cfg.verbose then _M.verbose() end | ||
39 | 42 | ||
40 | local function load_fns(fs_table) | 43 | local function load_fns(fs_table) |
41 | for name, fn in pairs(fs_table) do | 44 | for name, fn in pairs(fs_table) do |
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) | |||
305 | end | 305 | end |
306 | for version, repos in util.sortedpairs(versions, deps.compare_versions) do | 306 | for version, repos in util.sortedpairs(versions, deps.compare_versions) do |
307 | for _, repo in ipairs(repos) do | 307 | for _, repo in ipairs(repos) do |
308 | repo.repo = dir.normalize(repo.repo) | ||
308 | if porcelain then | 309 | if porcelain then |
309 | util.printout(package, version, repo.arch, repo.repo) | 310 | util.printout(package, version, repo.arch, repo.repo) |
310 | else | 311 | else |
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 | |||
34 | 34 | ||
35 | REM execute LuaRocks and wait for results | 35 | REM execute LuaRocks and wait for results |
36 | echo executing: luarocks %* | 36 | echo executing: luarocks %* |
37 | call %MYPATH%luarocks %* | 37 | call "%MYPATH%luarocks" %* |
38 | pause | 38 | pause |
39 | goto END | 39 | goto END |
40 | 40 | ||
41 | :REMOVEALL | 41 | :REMOVEALL |
42 | for /f "delims=-" %%a in ("%~n2") do ( | 42 | for /f "delims=-" %%a in ("%~n2") do ( |
43 | echo executing: luarocks remove %%a | 43 | echo executing: luarocks remove %%a |
44 | %MYPATH%luarocks remove "%%a" | 44 | "%MYPATH%luarocks" remove "%%a" |
45 | pause | 45 | pause |
46 | goto END | 46 | goto END |
47 | ) | 47 | ) |