diff options
-rw-r--r-- | src/luarocks/cfg.lua | 12 | ||||
-rw-r--r-- | src/luarocks/path_cmd.lua | 2 | ||||
-rw-r--r-- | test/testing.lua | 1 | ||||
-rwxr-xr-x | test/testing.sh | 1 |
4 files changed, 12 insertions, 4 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index 0099ec3a..f01fd205 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua | |||
@@ -666,17 +666,23 @@ function cfg.make_paths_from_tree(tree) | |||
666 | return lua_path, lib_path, bin_path | 666 | return lua_path, lib_path, bin_path |
667 | end | 667 | end |
668 | 668 | ||
669 | function cfg.package_paths() | 669 | function cfg.package_paths(current) |
670 | local new_path, new_cpath, new_bin = {}, {}, {} | 670 | local new_path, new_cpath, new_bin = {}, {}, {} |
671 | for _,tree in ipairs(cfg.rocks_trees) do | 671 | local function add_tree_to_paths(tree) |
672 | local lua_path, lib_path, bin_path = cfg.make_paths_from_tree(tree) | 672 | local lua_path, lib_path, bin_path = cfg.make_paths_from_tree(tree) |
673 | table.insert(new_path, lua_path.."/?.lua") | 673 | table.insert(new_path, lua_path.."/?.lua") |
674 | table.insert(new_path, lua_path.."/?/init.lua") | 674 | table.insert(new_path, lua_path.."/?/init.lua") |
675 | table.insert(new_cpath, lib_path.."/?."..cfg.lib_extension) | 675 | table.insert(new_cpath, lib_path.."/?."..cfg.lib_extension) |
676 | table.insert(new_bin, bin_path) | 676 | table.insert(new_bin, bin_path) |
677 | end | 677 | end |
678 | if current then | ||
679 | add_tree_to_paths(current) | ||
680 | end | ||
681 | for _,tree in ipairs(cfg.rocks_trees) do | ||
682 | add_tree_to_paths(tree) | ||
683 | end | ||
678 | if extra_luarocks_module_dir then | 684 | if extra_luarocks_module_dir then |
679 | table.insert(new_path, extra_luarocks_module_dir) | 685 | table.insert(new_path, extra_luarocks_module_dir) |
680 | end | 686 | end |
681 | return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator) | 687 | return table.concat(new_path, ";"), table.concat(new_cpath, ";"), table.concat(new_bin, cfg.export_path_separator) |
682 | end | 688 | end |
diff --git a/src/luarocks/path_cmd.lua b/src/luarocks/path_cmd.lua index 2bee4cb5..ecd6d4b1 100644 --- a/src/luarocks/path_cmd.lua +++ b/src/luarocks/path_cmd.lua | |||
@@ -37,7 +37,7 @@ function path_cmd.run(...) | |||
37 | local flags = util.parse_flags(...) | 37 | local flags = util.parse_flags(...) |
38 | local deps_mode = deps.get_deps_mode(flags) | 38 | local deps_mode = deps.get_deps_mode(flags) |
39 | 39 | ||
40 | local lr_path, lr_cpath, lr_bin = cfg.package_paths() | 40 | local lr_path, lr_cpath, lr_bin = cfg.package_paths(flags["tree"]) |
41 | local path_sep = cfg.export_path_separator | 41 | local path_sep = cfg.export_path_separator |
42 | 42 | ||
43 | if flags["lr-path"] then | 43 | if flags["lr-path"] then |
diff --git a/test/testing.lua b/test/testing.lua index 6d4b4b05..c37293ee 100644 --- a/test/testing.lua +++ b/test/testing.lua | |||
@@ -266,6 +266,7 @@ local tests = { | |||
266 | test_path_lr_path = function() return run "$luarocks path --lr-path" end, | 266 | test_path_lr_path = function() return run "$luarocks path --lr-path" end, |
267 | test_path_lr_cpath = function() return run "$luarocks path --lr-cpath" end, | 267 | test_path_lr_cpath = function() return run "$luarocks path --lr-cpath" end, |
268 | test_path_lr_bin = function() return run "$luarocks path --lr-bin" end, | 268 | test_path_lr_bin = function() return run "$luarocks path --lr-bin" end, |
269 | test_path_with_tree = function() return run "$luarocks path --tree=lua_modules" end, | ||
269 | fail_purge_missing_tree = function() return run '$luarocks purge --tree="$testing_tree"' end, | 270 | fail_purge_missing_tree = function() return run '$luarocks purge --tree="$testing_tree"' end, |
270 | test_purge = function() return run '$luarocks purge --tree="$testing_sys_tree"' end, | 271 | test_purge = function() return run '$luarocks purge --tree="$testing_sys_tree"' end, |
271 | test_remove = function() | 272 | test_remove = function() |
diff --git a/test/testing.sh b/test/testing.sh index 95b3243c..305168c8 100755 --- a/test/testing.sh +++ b/test/testing.sh | |||
@@ -449,6 +449,7 @@ test_path() { $luarocks path --bin; } | |||
449 | test_path_lr_path() { $luarocks path --lr-path; } | 449 | test_path_lr_path() { $luarocks path --lr-path; } |
450 | test_path_lr_cpath() { $luarocks path --lr-cpath; } | 450 | test_path_lr_cpath() { $luarocks path --lr-cpath; } |
451 | test_path_lr_bin() { $luarocks path --lr-bin; } | 451 | test_path_lr_bin() { $luarocks path --lr-bin; } |
452 | test_path_with_tree() { $luarocks path --tree=lua_modules; } | ||
452 | 453 | ||
453 | fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; } | 454 | fail_purge_missing_tree() { $luarocks purge --tree="$testing_tree"; } |
454 | fail_purge_tree_notstring() { $luarocks purge --tree=1; } | 455 | fail_purge_tree_notstring() { $luarocks purge --tree=1; } |