diff options
| author | mpeterv <petjamelnik@yandex.ru> | 2014-03-21 11:56:31 +0400 |
|---|---|---|
| committer | mpeterv <petjamelnik@yandex.ru> | 2014-03-21 11:56:31 +0400 |
| commit | 8498916df098bfcf17947537427cc1fffdeea2a5 (patch) | |
| tree | 841974f23a6300ce138f20faef31ea67ed41d98b /src | |
| parent | d9c799153ebf5645cf7d7a8fe473c5aff32ec4d3 (diff) | |
| parent | 397659cc5cb30569b33cc9c0ab220f85379bc97f (diff) | |
| download | luarocks-8498916df098bfcf17947537427cc1fffdeea2a5.tar.gz luarocks-8498916df098bfcf17947537427cc1fffdeea2a5.tar.bz2 luarocks-8498916df098bfcf17947537427cc1fffdeea2a5.zip | |
Merge branch 'master' of https://github.com/keplerproject/luarocks into lua52_compat
Conflicts:
src/bin/luarocks
src/luarocks/fs/unix/tools.lua
src/luarocks/path.lua
Fixed:
src/luarocks/path_cmd.lua: moved meta-data from path.lua
Makefile: added path_cmd.lua to the list of installed files
Diffstat (limited to 'src')
| -rwxr-xr-x | src/bin/luarocks | 2 | ||||
| -rw-r--r-- | src/luarocks/fs/unix/tools.lua | 12 | ||||
| -rw-r--r-- | src/luarocks/manif.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/path_cmd.lua (renamed from src/luarocks/path_command.lua) | 20 |
4 files changed, 20 insertions, 16 deletions
diff --git a/src/bin/luarocks b/src/bin/luarocks index 9c190175..b85fbc7c 100755 --- a/src/bin/luarocks +++ b/src/bin/luarocks | |||
| @@ -16,7 +16,7 @@ commands = { | |||
| 16 | remove = "luarocks.remove", | 16 | remove = "luarocks.remove", |
| 17 | make = "luarocks.make", | 17 | make = "luarocks.make", |
| 18 | download = "luarocks.download", | 18 | download = "luarocks.download", |
| 19 | path = "luarocks.path_command", | 19 | path = "luarocks.path_cmd", |
| 20 | show = "luarocks.show", | 20 | show = "luarocks.show", |
| 21 | new_version = "luarocks.new_version", | 21 | new_version = "luarocks.new_version", |
| 22 | lint = "luarocks.lint", | 22 | lint = "luarocks.lint", |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index a288dd60..8a71171d 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
| @@ -19,9 +19,13 @@ end | |||
| 19 | -- Uses the module's internal directory stack. | 19 | -- Uses the module's internal directory stack. |
| 20 | -- @return string: the absolute pathname of the current directory. | 20 | -- @return string: the absolute pathname of the current directory. |
| 21 | function tools.current_dir() | 21 | function tools.current_dir() |
| 22 | local pipe = io.popen(vars.PWD) | 22 | local current = cfg.cache_pwd |
| 23 | local current = pipe:read("*l") | 23 | if not current then |
| 24 | pipe:close() | 24 | local pipe = io.popen(fs.Q(vars.PWD)) |
| 25 | current = pipe:read("*l") | ||
| 26 | pipe:close() | ||
| 27 | cfg.cache_pwd = current | ||
| 28 | end | ||
| 25 | for _, directory in ipairs(dir_stack) do | 29 | for _, directory in ipairs(dir_stack) do |
| 26 | current = fs.absolute_name(directory, current) | 30 | current = fs.absolute_name(directory, current) |
| 27 | end | 31 | end |
| @@ -34,7 +38,7 @@ end | |||
| 34 | -- @return boolean: true if command succeeds (status code 0), false | 38 | -- @return boolean: true if command succeeds (status code 0), false |
| 35 | -- otherwise. | 39 | -- otherwise. |
| 36 | function tools.execute_string(cmd) | 40 | function tools.execute_string(cmd) |
| 37 | local code = os.execute(command_at(fs.current_dir(), cmd)) | 41 | local code, err = os.execute(command_at(fs.current_dir(), cmd)) |
| 38 | if code == 0 or code == true then | 42 | if code == 0 or code == true then |
| 39 | return true | 43 | return true |
| 40 | else | 44 | else |
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index d160d2db..f1d1629c 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
| @@ -133,7 +133,7 @@ function manif.load_manifest(repo_url) | |||
| 133 | local err, errcode | 133 | local err, errcode |
| 134 | for _, filename in ipairs(filenames) do | 134 | for _, filename in ipairs(filenames) do |
| 135 | pathname, err, errcode = fetch_manifest_from(repo_url, filename) | 135 | pathname, err, errcode = fetch_manifest_from(repo_url, filename) |
| 136 | if pathname or errcode == "network" then | 136 | if pathname then |
| 137 | break | 137 | break |
| 138 | end | 138 | end |
| 139 | end | 139 | end |
diff --git a/src/luarocks/path_command.lua b/src/luarocks/path_cmd.lua index 4e52bdc9..d52f985a 100644 --- a/src/luarocks/path_command.lua +++ b/src/luarocks/path_cmd.lua | |||
| @@ -1,16 +1,16 @@ | |||
| 1 | 1 | ||
| 2 | --- Module implementing the LuaRocks "path" command. | 2 | --- @module luarocks.path_cmd |
| 3 | -- Return the currently configured package path. | 3 | -- Driver for the `luarocks path` command. |
| 4 | local path_command = {} | 4 | local path_cmd = {} |
| 5 | 5 | ||
| 6 | local path = require("luarocks.path") | ||
| 7 | local cfg = require("luarocks.cfg") | ||
| 8 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
| 9 | local deps = require("luarocks.deps") | 7 | local deps = require("luarocks.deps") |
| 8 | local cfg = require("luarocks.cfg") | ||
| 9 | local path = require("luarocks.path") | ||
| 10 | 10 | ||
| 11 | path_command.help_summary = "Return the currently configured package path." | 11 | path_cmd.help_summary = "Return the currently configured package path." |
| 12 | path_command.help_arguments = "" | 12 | path_cmd.help_arguments = "" |
| 13 | path_command.help = [[ | 13 | path_cmd.help = [[ |
| 14 | Returns the package path currently configured for this installation | 14 | Returns the package path currently configured for this installation |
| 15 | of LuaRocks, formatted as shell commands to update LUA_PATH and | 15 | of LuaRocks, formatted as shell commands to update LUA_PATH and |
| 16 | LUA_CPATH. (On Unix systems, you may run: eval `luarocks path`) | 16 | LUA_CPATH. (On Unix systems, you may run: eval `luarocks path`) |
| @@ -18,7 +18,7 @@ LUA_CPATH. (On Unix systems, you may run: eval `luarocks path`) | |||
| 18 | 18 | ||
| 19 | --- Driver function for "path" command. | 19 | --- Driver function for "path" command. |
| 20 | -- @return boolean This function always succeeds. | 20 | -- @return boolean This function always succeeds. |
| 21 | function path_command.run(...) | 21 | function path_cmd.run(...) |
| 22 | local flags = util.parse_flags(...) | 22 | local flags = util.parse_flags(...) |
| 23 | local deps_mode = deps.get_deps_mode(flags) | 23 | local deps_mode = deps.get_deps_mode(flags) |
| 24 | 24 | ||
| @@ -55,4 +55,4 @@ function path_command.run(...) | |||
| 55 | return true | 55 | return true |
| 56 | end | 56 | end |
| 57 | 57 | ||
| 58 | return path_command | 58 | return path_cmd |
