diff options
-rw-r--r-- | README.md | 14 | ||||
-rwxr-xr-x | makedist | 2 | ||||
-rwxr-xr-x | src/bin/luarocks | 1 | ||||
-rwxr-xr-x | src/bin/luarocks-admin | 1 | ||||
-rw-r--r-- | src/luarocks/add.lua | 2 | ||||
-rw-r--r-- | src/luarocks/admin_remove.lua | 2 | ||||
-rw-r--r-- | src/luarocks/build.lua | 2 | ||||
-rw-r--r-- | src/luarocks/build/builtin.lua | 33 | ||||
-rw-r--r-- | src/luarocks/cfg.lua | 2 | ||||
-rw-r--r-- | src/luarocks/command_line.lua | 4 | ||||
-rw-r--r-- | src/luarocks/fs/win32/tools.lua | 3 | ||||
-rw-r--r-- | src/luarocks/help.lua | 26 | ||||
-rw-r--r-- | src/luarocks/install.lua | 2 | ||||
-rw-r--r-- | src/luarocks/lint.lua | 2 | ||||
-rw-r--r-- | src/luarocks/make.lua | 2 | ||||
-rw-r--r-- | src/luarocks/new_version.lua | 2 | ||||
-rw-r--r-- | src/luarocks/pack.lua | 2 | ||||
-rw-r--r-- | src/luarocks/purge.lua | 2 | ||||
-rw-r--r-- | src/luarocks/search.lua | 2 | ||||
-rw-r--r-- | src/luarocks/show.lua | 2 | ||||
-rw-r--r-- | src/luarocks/tools/patch.lua | 4 | ||||
-rw-r--r-- | src/luarocks/unpack.lua | 2 | ||||
-rw-r--r-- | src/luarocks/util.lua | 18 |
23 files changed, 74 insertions, 58 deletions
@@ -2,12 +2,14 @@ This is LuaRocks, a deployment and management system for Lua modules. | |||
2 | 2 | ||
3 | Main website: [luarocks.org](http://www.luarocks.org) | 3 | Main website: [luarocks.org](http://www.luarocks.org) |
4 | 4 | ||
5 | LuaRocks allows you to install Lua modules as self-contained packages called [*rocks*][1], | 5 | LuaRocks allows you to install Lua modules as self-contained packages called |
6 | which also contain version [dependency][2] information. This information is used both during installation, | 6 | [*rocks*][1], which also contain version [dependency][2] information. This |
7 | so that when one rock is requested all rocks it depends on are installed as well, and at run time, | 7 | information is used both during installation, so that when one rock is |
8 | so that when a module is required, the correct version is loaded. LuaRocks supports both local and | 8 | requested all rocks it depends on are installed as well, and at run time, so |
9 | [remote][3] repositories, and multiple local rocks trees. You can [download][4] and install LuaRocks | 9 | that when a module is required, the correct version is loaded. LuaRocks |
10 | on [Unix][5] and [Windows][6]. | 10 | supports both local and [remote][3] repositories, and multiple local rocks |
11 | trees. You can [download][4] and install LuaRocks on [Unix][5] and | ||
12 | [Windows][6]. | ||
11 | 13 | ||
12 | LuaRocks is free software and uses the same [license][7] as Lua 5.1. | 14 | LuaRocks is free software and uses the same [license][7] as Lua 5.1. |
13 | 15 | ||
@@ -73,4 +73,4 @@ rm -rf makedist Makefile configure lfw win32 | |||
73 | cd .. | 73 | cd .. |
74 | zip -r ../"$out-win32.zip" "$out-win32" | 74 | zip -r ../"$out-win32.zip" "$out-win32" |
75 | cd .. | 75 | cd .. |
76 | rm -rf "release-windows" \ No newline at end of file | 76 | rm -rf "release-windows" |
diff --git a/src/bin/luarocks b/src/bin/luarocks index aaafb905..b64051d4 100755 --- a/src/bin/luarocks +++ b/src/bin/luarocks | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | local command_line = require("luarocks.command_line") | 3 | local command_line = require("luarocks.command_line") |
4 | 4 | ||
5 | program_name = "luarocks" | ||
6 | program_description = "LuaRocks main command-line interface" | 5 | program_description = "LuaRocks main command-line interface" |
7 | 6 | ||
8 | commands = {} | 7 | commands = {} |
diff --git a/src/bin/luarocks-admin b/src/bin/luarocks-admin index 69814459..4c5613ca 100755 --- a/src/bin/luarocks-admin +++ b/src/bin/luarocks-admin | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | local command_line = require("luarocks.command_line") | 3 | local command_line = require("luarocks.command_line") |
4 | 4 | ||
5 | program_name = "luarocks-admin" | ||
6 | program_description = "LuaRocks repository administration interface" | 5 | program_description = "LuaRocks repository administration interface" |
7 | 6 | ||
8 | commands = { | 7 | commands = { |
diff --git a/src/luarocks/add.lua b/src/luarocks/add.lua index 48b9964c..30db9a48 100644 --- a/src/luarocks/add.lua +++ b/src/luarocks/add.lua | |||
@@ -99,7 +99,7 @@ function run(...) | |||
99 | local files = { util.parse_flags(...) } | 99 | local files = { util.parse_flags(...) } |
100 | local flags = table.remove(files, 1) | 100 | local flags = table.remove(files, 1) |
101 | if #files < 1 then | 101 | if #files < 1 then |
102 | return nil, "Argument missing, see help." | 102 | return nil, "Argument missing. "..util.see_help("add", "luarocks-admin") |
103 | end | 103 | end |
104 | local server, server_table = cache.get_upload_server(flags["server"]) | 104 | local server, server_table = cache.get_upload_server(flags["server"]) |
105 | if not server then return nil, server_table end | 105 | if not server then return nil, server_table end |
diff --git a/src/luarocks/admin_remove.lua b/src/luarocks/admin_remove.lua index dc36e16e..c235776f 100644 --- a/src/luarocks/admin_remove.lua +++ b/src/luarocks/admin_remove.lua | |||
@@ -78,7 +78,7 @@ function run(...) | |||
78 | local files = { util.parse_flags(...) } | 78 | local files = { util.parse_flags(...) } |
79 | local flags = table.remove(files, 1) | 79 | local flags = table.remove(files, 1) |
80 | if #files < 1 then | 80 | if #files < 1 then |
81 | return nil, "Argument missing, see help." | 81 | return nil, "Argument missing. "..util.see_help("remove", "luarocks-admin") |
82 | end | 82 | end |
83 | local server, server_table = cache.get_upload_server(flags["server"]) | 83 | local server, server_table = cache.get_upload_server(flags["server"]) |
84 | if not server then return nil, server_table end | 84 | if not server then return nil, server_table end |
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index d61d6611..83abbf8d 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -321,7 +321,7 @@ end | |||
321 | function run(...) | 321 | function run(...) |
322 | local flags, name, version = util.parse_flags(...) | 322 | local flags, name, version = util.parse_flags(...) |
323 | if type(name) ~= "string" then | 323 | if type(name) ~= "string" then |
324 | return nil, "Argument missing, see help." | 324 | return nil, "Argument missing. "..util.see_help("build") |
325 | end | 325 | end |
326 | assert(type(version) == "string" or not version) | 326 | assert(type(version) == "string" or not version) |
327 | 327 | ||
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 3d179b34..9d97d58b 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
@@ -217,8 +217,7 @@ function run(rockspec) | |||
217 | end | 217 | end |
218 | ok = compile_object(object, source, info.defines, info.incdirs) | 218 | ok = compile_object(object, source, info.defines, info.incdirs) |
219 | if not ok then | 219 | if not ok then |
220 | err = "Failed compiling object "..object | 220 | return nil, "Failed compiling object "..object |
221 | break | ||
222 | end | 221 | end |
223 | table.insert(objects, object) | 222 | table.insert(objects, object) |
224 | end | 223 | end |
@@ -231,30 +230,22 @@ function run(rockspec) | |||
231 | built_modules[module_name] = dest | 230 | built_modules[module_name] = dest |
232 | ok = compile_library(module_name, objects, info.libraries, info.libdirs, name) | 231 | ok = compile_library(module_name, objects, info.libraries, info.libdirs, name) |
233 | if not ok then | 232 | if not ok then |
234 | err = "Failed compiling module "..module_name | 233 | return nil, "Failed compiling module "..module_name |
235 | break | ||
236 | end | 234 | end |
237 | end | 235 | end |
238 | end | 236 | end |
239 | if ok then | 237 | for name, dest in pairs(built_modules) do |
240 | for name, dest in pairs(built_modules) do | 238 | fs.make_dir(dest) |
241 | fs.make_dir(dest) | 239 | ok = fs.copy(name, dest) |
242 | ok = fs.copy(name, dest) | 240 | if not ok then |
243 | if not ok then | 241 | return nil, "Failed installing "..name.." in "..dest |
244 | err = "Failed installing "..name.." in "..dest | ||
245 | break | ||
246 | end | ||
247 | end | 242 | end |
248 | end | 243 | end |
249 | if ok then | 244 | if fs.is_dir("lua") then |
250 | if fs.is_dir("lua") then | 245 | ok, err = fs.copy_contents("lua", luadir) |
251 | ok, err = fs.copy_contents("lua", luadir) | 246 | if not ok then |
252 | if not ok then err = "Failed copying contents of 'lua' directory: "..err end | 247 | return nil, "Failed copying contents of 'lua' directory: "..err |
253 | end | 248 | end |
254 | end | 249 | end |
255 | if ok then | 250 | return true |
256 | return true | ||
257 | else | ||
258 | return nil, err | ||
259 | end | ||
260 | end | 251 | end |
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 2f2c7a66..90bed195 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -264,7 +264,7 @@ local defaults = { | |||
264 | } | 264 | } |
265 | 265 | ||
266 | if detected.windows then | 266 | if detected.windows then |
267 | home_config_file = home_config_file:gsub("\\","/") | 267 | home_config_file = home_config_file and home_config_file:gsub("\\","/") |
268 | defaults.fs_use_modules = false | 268 | defaults.fs_use_modules = false |
269 | defaults.arch = "win32-"..proc | 269 | defaults.arch = "win32-"..proc |
270 | defaults.platforms = {"win32", "windows" } | 270 | defaults.platforms = {"win32", "windows" } |
diff --git a/src/luarocks/command_line.lua b/src/luarocks/command_line.lua index 9e499fc2..d16ef8e2 100644 --- a/src/luarocks/command_line.lua +++ b/src/luarocks/command_line.lua | |||
@@ -8,6 +8,8 @@ local path = require("luarocks.path") | |||
8 | local dir = require("luarocks.dir") | 8 | local dir = require("luarocks.dir") |
9 | local deps = require("luarocks.deps") | 9 | local deps = require("luarocks.deps") |
10 | 10 | ||
11 | local program = util.this_program("luarocks") | ||
12 | |||
11 | --- Display an error message and exit. | 13 | --- Display an error message and exit. |
12 | -- @param message string: The error message. | 14 | -- @param message string: The error message. |
13 | local function die(message) | 15 | local function die(message) |
@@ -60,7 +62,7 @@ function run_command(...) | |||
60 | local command | 62 | local command |
61 | 63 | ||
62 | if flags["version"] then | 64 | if flags["version"] then |
63 | util.printout(program_name.." "..cfg.program_version) | 65 | util.printout(program.." "..cfg.program_version) |
64 | util.printout(program_description) | 66 | util.printout(program_description) |
65 | util.printout() | 67 | util.printout() |
66 | os.exit(0) | 68 | os.exit(0) |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index c563b137..033f71be 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
@@ -146,8 +146,7 @@ end | |||
146 | -- plus an error message. | 146 | -- plus an error message. |
147 | function copy_contents(src, dest) | 147 | function copy_contents(src, dest) |
148 | assert(src and dest) | 148 | assert(src and dest) |
149 | if fs.execute_string(fs.quiet("xcopy "..src.."\\*.* "..fs.Q(dest).." /S/E/Y")) then | 149 | if fs.execute_string(fs.quiet(vars.CP.." -a "..src.."\\*.* "..fs.Q(dest))) then |
150 | --if fs.execute_string(fs.quiet(vars.CP.." -a "..src.."\\*.* "..fs.Q(dest))) then | ||
151 | return true | 150 | return true |
152 | else | 151 | else |
153 | return false, "Failed copying "..src.." to "..dest | 152 | return false, "Failed copying "..src.." to "..dest |
diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 19cd7914..2944dfd8 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua | |||
@@ -9,7 +9,9 @@ module("luarocks.help", package.seeall) | |||
9 | local util = require("luarocks.util") | 9 | local util = require("luarocks.util") |
10 | local cfg = require("luarocks.cfg") | 10 | local cfg = require("luarocks.cfg") |
11 | 11 | ||
12 | help_summary = "Help on commands. Type '"..program_name.." help <command>' for more." | 12 | local program = util.this_program("luarocks") |
13 | |||
14 | help_summary = "Help on commands. Type '"..program.." help <command>' for more." | ||
13 | 15 | ||
14 | help_arguments = "[<command>]" | 16 | help_arguments = "[<command>]" |
15 | help = [[ | 17 | help = [[ |
@@ -46,9 +48,9 @@ function run(...) | |||
46 | local sys_file, sys_ok, home_file, home_ok = cfg.which_config() | 48 | local sys_file, sys_ok, home_file, home_ok = cfg.which_config() |
47 | print_banner() | 49 | print_banner() |
48 | print_section("NAME") | 50 | print_section("NAME") |
49 | util.printout("\t"..program_name..[[ - ]]..program_description) | 51 | util.printout("\t"..program..[[ - ]]..program_description) |
50 | print_section("SYNOPSIS") | 52 | print_section("SYNOPSIS") |
51 | util.printout("\t"..program_name..[[ [--from=<server> | --only-from=<server>] [--to=<tree>] [VAR=VALUE]... <command> [<argument>] ]]) | 53 | util.printout("\t"..program..[[ [--from=<server> | --only-from=<server>] [--to=<tree>] [VAR=VALUE]... <command> [<argument>] ]]) |
52 | print_section("GENERAL OPTIONS") | 54 | print_section("GENERAL OPTIONS") |
53 | util.printout([[ | 55 | util.printout([[ |
54 | These apply to all commands, as appropriate: | 56 | These apply to all commands, as appropriate: |
@@ -60,7 +62,8 @@ function run(...) | |||
60 | --only-sources=<url> Restrict downloads to paths matching the | 62 | --only-sources=<url> Restrict downloads to paths matching the |
61 | given URL. | 63 | given URL. |
62 | --tree=<tree> Which tree to operate on. | 64 | --tree=<tree> Which tree to operate on. |
63 | --local Use the tree in the user's home directory.]]) | 65 | --local Use the tree in the user's home directory. |
66 | To enable it, see ']]..program..[[ help path'.]]) | ||
64 | print_section("VARIABLES") | 67 | print_section("VARIABLES") |
65 | util.printout([[ | 68 | util.printout([[ |
66 | Variables from the "variables" table of the configuration file | 69 | Variables from the "variables" table of the configuration file |
@@ -77,22 +80,25 @@ function run(...) | |||
77 | util.printout("\t", command.help_summary) | 80 | util.printout("\t", command.help_summary) |
78 | end | 81 | end |
79 | print_section("CONFIGURATION") | 82 | print_section("CONFIGURATION") |
80 | util.printout([[ | 83 | util.printout("\tSystem configuration file: ".. sys_file .. " (" .. get_status(sys_ok) ..")") |
81 | System configuration file: ]]..sys_file .. " (" .. get_status(sys_ok) ..[[) | 84 | if home_file then |
82 | User configuration file: ]]..home_file .. " (" .. get_status(home_ok) ..")\n") | 85 | util.printout("\tUser configuration file: ".. home_file .. " (" .. get_status(home_ok) ..")\n") |
86 | else | ||
87 | util.printout("\tUser configuration file disabled in this LuaRocks installation.\n") | ||
88 | end | ||
83 | else | 89 | else |
84 | command = command:gsub("-", "_") | 90 | command = command:gsub("-", "_") |
85 | if commands[command] then | 91 | if commands[command] then |
86 | local arguments = commands[command].help_arguments or "<argument>" | 92 | local arguments = commands[command].help_arguments or "<argument>" |
87 | print_banner() | 93 | print_banner() |
88 | print_section("NAME") | 94 | print_section("NAME") |
89 | util.printout("\t"..program_name.." "..command.." - "..commands[command].help_summary) | 95 | util.printout("\t"..program.." "..command.." - "..commands[command].help_summary) |
90 | print_section("SYNOPSIS") | 96 | print_section("SYNOPSIS") |
91 | util.printout("\t"..program_name.." "..command.." "..arguments) | 97 | util.printout("\t"..program.." "..command.." "..arguments) |
92 | print_section("DESCRIPTION") | 98 | print_section("DESCRIPTION") |
93 | util.printout("",(commands[command].help:gsub("\n","\n\t"):gsub("\n\t$",""))) | 99 | util.printout("",(commands[command].help:gsub("\n","\n\t"):gsub("\n\t$",""))) |
94 | print_section("SEE ALSO") | 100 | print_section("SEE ALSO") |
95 | util.printout("","'luarocks help' for general options and configuration.\n") | 101 | util.printout("","'"..program.." help' for general options and configuration.\n") |
96 | else | 102 | else |
97 | return nil, "Unknown command '"..command.."'" | 103 | return nil, "Unknown command '"..command.."'" |
98 | end | 104 | end |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index e633ea23..c2a54482 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
@@ -118,7 +118,7 @@ end | |||
118 | function run(...) | 118 | function run(...) |
119 | local flags, name, version = util.parse_flags(...) | 119 | local flags, name, version = util.parse_flags(...) |
120 | if type(name) ~= "string" then | 120 | if type(name) ~= "string" then |
121 | return nil, "Argument missing, see help." | 121 | return nil, "Argument missing. "..util.see_help("install") |
122 | end | 122 | end |
123 | 123 | ||
124 | local ok, err = fs.check_command_permissions(flags) | 124 | local ok, err = fs.check_command_permissions(flags) |
diff --git a/src/luarocks/lint.lua b/src/luarocks/lint.lua index 61388af6..62ced64d 100644 --- a/src/luarocks/lint.lua +++ b/src/luarocks/lint.lua | |||
@@ -20,7 +20,7 @@ function run(...) | |||
20 | local flags, input = util.parse_flags(...) | 20 | local flags, input = util.parse_flags(...) |
21 | 21 | ||
22 | if not input then | 22 | if not input then |
23 | return nil, "Argument missing, see help." | 23 | return nil, "Argument missing. "..util.see_help("lint") |
24 | end | 24 | end |
25 | 25 | ||
26 | local filename = input | 26 | local filename = input |
diff --git a/src/luarocks/make.lua b/src/luarocks/make.lua index 69c2162f..027b9fa6 100644 --- a/src/luarocks/make.lua +++ b/src/luarocks/make.lua | |||
@@ -55,7 +55,7 @@ function run(...) | |||
55 | end | 55 | end |
56 | end | 56 | end |
57 | if not rockspec:match("rockspec$") then | 57 | if not rockspec:match("rockspec$") then |
58 | return nil, "Invalid argument: 'make' takes a rockspec as a parameter. See help." | 58 | return nil, "Invalid argument: 'make' takes a rockspec as a parameter. "..util.see_help("make") |
59 | end | 59 | end |
60 | 60 | ||
61 | if flags["pack-binary-rock"] then | 61 | if flags["pack-binary-rock"] then |
diff --git a/src/luarocks/new_version.lua b/src/luarocks/new_version.lua index 66802f0b..b91f8aed 100644 --- a/src/luarocks/new_version.lua +++ b/src/luarocks/new_version.lua | |||
@@ -80,7 +80,7 @@ end | |||
80 | function run(...) | 80 | function run(...) |
81 | local flags, input, version, url = util.parse_flags(...) | 81 | local flags, input, version, url = util.parse_flags(...) |
82 | if not input then | 82 | if not input then |
83 | return nil, "Missing arguments: expected program or rockspec. See help." | 83 | return nil, "Missing arguments: expected program or rockspec. "..util.see_help("new_version") |
84 | end | 84 | end |
85 | assert(type(input) == "string") | 85 | assert(type(input) == "string") |
86 | 86 | ||
diff --git a/src/luarocks/pack.lua b/src/luarocks/pack.lua index d8f0b2ef..eaa0e165 100644 --- a/src/luarocks/pack.lua +++ b/src/luarocks/pack.lua | |||
@@ -187,7 +187,7 @@ function run(...) | |||
187 | local flags, arg, version = util.parse_flags(...) | 187 | local flags, arg, version = util.parse_flags(...) |
188 | assert(type(version) == "string" or not version) | 188 | assert(type(version) == "string" or not version) |
189 | if type(arg) ~= "string" then | 189 | if type(arg) ~= "string" then |
190 | return nil, "Argument missing, see help." | 190 | return nil, "Argument missing. "..util.see_help("pack") |
191 | end | 191 | end |
192 | 192 | ||
193 | local file, err | 193 | local file, err |
diff --git a/src/luarocks/purge.lua b/src/luarocks/purge.lua index ca682f7d..6b094061 100644 --- a/src/luarocks/purge.lua +++ b/src/luarocks/purge.lua | |||
@@ -27,7 +27,7 @@ function run(...) | |||
27 | local tree = flags["tree"] | 27 | local tree = flags["tree"] |
28 | 28 | ||
29 | if type(tree) ~= "string" then | 29 | if type(tree) ~= "string" then |
30 | return nil, "The --tree argument is mandatory, see help." | 30 | return nil, "The --tree argument is mandatory. "..util.see_help("purge") |
31 | end | 31 | end |
32 | 32 | ||
33 | local results = {} | 33 | local results = {} |
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 7db88d74..1fc1f9a1 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
@@ -365,7 +365,7 @@ function run(...) | |||
365 | end | 365 | end |
366 | 366 | ||
367 | if type(name) ~= "string" and not flags["all"] then | 367 | if type(name) ~= "string" and not flags["all"] then |
368 | return nil, "Enter name and version or use --all; see help." | 368 | return nil, "Enter name and version or use --all. "..util.see_help("search") |
369 | end | 369 | end |
370 | 370 | ||
371 | local query = make_query(name:lower(), version) | 371 | local query = make_query(name:lower(), version) |
diff --git a/src/luarocks/show.lua b/src/luarocks/show.lua index a6a53d9a..536085a7 100644 --- a/src/luarocks/show.lua +++ b/src/luarocks/show.lua | |||
@@ -73,7 +73,7 @@ end | |||
73 | function run(...) | 73 | function run(...) |
74 | local flags, name, version = util.parse_flags(...) | 74 | local flags, name, version = util.parse_flags(...) |
75 | if not name then | 75 | if not name then |
76 | return nil, "Argument missing, see help." | 76 | return nil, "Argument missing. "..util.see_help("show") |
77 | end | 77 | end |
78 | local results = {} | 78 | local results = {} |
79 | local query = search.make_query(name, version) | 79 | local query = search.make_query(name, version) |
diff --git a/src/luarocks/tools/patch.lua b/src/luarocks/tools/patch.lua index 9a89aa48..04154219 100644 --- a/src/luarocks/tools/patch.lua +++ b/src/luarocks/tools/patch.lua | |||
@@ -295,7 +295,7 @@ function read_patch(filename, data) | |||
295 | -- Accept a space as a terminator, like GNU patch does. | 295 | -- Accept a space as a terminator, like GNU patch does. |
296 | -- Breaks patches containing filenames with spaces... | 296 | -- Breaks patches containing filenames with spaces... |
297 | -- FIXME Figure out what does GNU patch do in those cases. | 297 | -- FIXME Figure out what does GNU patch do in those cases. |
298 | local match = line:match("^--- ([^\t ]+)") | 298 | local match = line:match("^%-%-%- ([^ \t\r\n]+)") |
299 | if not match then | 299 | if not match then |
300 | all_ok = false | 300 | all_ok = false |
301 | warning(format("skipping invalid filename at line %d", lineno+1)) | 301 | warning(format("skipping invalid filename at line %d", lineno+1)) |
@@ -329,7 +329,7 @@ function read_patch(filename, data) | |||
329 | -- Accept a space as a terminator, like GNU patch does. | 329 | -- Accept a space as a terminator, like GNU patch does. |
330 | -- Breaks patches containing filenames with spaces... | 330 | -- Breaks patches containing filenames with spaces... |
331 | -- FIXME Figure out what does GNU patch do in those cases. | 331 | -- FIXME Figure out what does GNU patch do in those cases. |
332 | local re_filename = "^%+%+%+ ([^ \t]+)" | 332 | local re_filename = "^%+%+%+ ([^ \t\r\n]+)" |
333 | local match = line:match(re_filename) | 333 | local match = line:match(re_filename) |
334 | if not match then | 334 | if not match then |
335 | all_ok = false | 335 | all_ok = false |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index 4920d381..1db66bbb 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
@@ -139,7 +139,7 @@ function run(...) | |||
139 | 139 | ||
140 | assert(type(version) == "string" or not version) | 140 | assert(type(version) == "string" or not version) |
141 | if type(name) ~= "string" then | 141 | if type(name) ~= "string" then |
142 | return nil, "Argument missing, see help." | 142 | return nil, "Argument missing. "..util.see_help("unpack") |
143 | end | 143 | end |
144 | 144 | ||
145 | if name:match(".*%.rock") or name:match(".*%.rockspec") then | 145 | if name:match(".*%.rock") or name:match(".*%.rockspec") then |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index c44dc73d..c5095675 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
@@ -9,6 +9,7 @@ local global_env = _G | |||
9 | module("luarocks.util", package.seeall) | 9 | module("luarocks.util", package.seeall) |
10 | 10 | ||
11 | local scheduled_functions = {} | 11 | local scheduled_functions = {} |
12 | local debug = require("debug") | ||
12 | 13 | ||
13 | --- Schedule a function to be executed upon program termination. | 14 | --- Schedule a function to be executed upon program termination. |
14 | -- This is useful for actions such as deleting temporary directories | 15 | -- This is useful for actions such as deleting temporary directories |
@@ -316,6 +317,23 @@ function title(msg, porcelain, underline) | |||
316 | printout() | 317 | printout() |
317 | end | 318 | end |
318 | 319 | ||
320 | function this_program(default) | ||
321 | local i = 1 | ||
322 | local last, cur = default, default | ||
323 | while i do | ||
324 | local dbg = debug.getinfo(i,"S") | ||
325 | if not dbg then break end | ||
326 | last = cur | ||
327 | cur = dbg.source | ||
328 | i=i+1 | ||
329 | end | ||
330 | return last:sub(2) | ||
331 | end | ||
332 | |||
333 | function see_help(command, program) | ||
334 | return "See '"..this_program(program or "luarocks")..' help '..command.."'." | ||
335 | end | ||
336 | |||
319 | -- from http://lua-users.org/wiki/SplitJoin | 337 | -- from http://lua-users.org/wiki/SplitJoin |
320 | -- by PhilippeLhoste | 338 | -- by PhilippeLhoste |
321 | function split_string(str, delim, maxNb) | 339 | function split_string(str, delim, maxNb) |