diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2011-12-21 16:22:39 -0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2011-12-21 16:22:39 -0200 |
| commit | 46825ad1dca508b70eeb77619c46c11afd46d5ec (patch) | |
| tree | 01a3df17c16ef79a0bb5647814a4d22025e82bff | |
| parent | 1bd5267ed3706571d61dc420c0575709091021fb (diff) | |
| download | luarocks-46825ad1dca508b70eeb77619c46c11afd46d5ec.tar.gz luarocks-46825ad1dca508b70eeb77619c46c11afd46d5ec.tar.bz2 luarocks-46825ad1dca508b70eeb77619c46c11afd46d5ec.zip | |
Fix all documentation warnings reported by LDoc.
| -rw-r--r-- | src/luarocks/build/make.lua | 3 | ||||
| -rw-r--r-- | src/luarocks/deps.lua | 3 | ||||
| -rw-r--r-- | src/luarocks/fetch.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/fs/lua.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/fs/unix/tools.lua | 52 | ||||
| -rw-r--r-- | src/luarocks/fs/win32/tools.lua | 48 | ||||
| -rw-r--r-- | src/luarocks/manif.lua | 13 | ||||
| -rw-r--r-- | src/luarocks/manif_core.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/path.lua | 124 | ||||
| -rw-r--r-- | src/luarocks/persist.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/search.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/type_check.lua | 6 | ||||
| -rw-r--r-- | src/luarocks/unpack.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/util.lua | 2 |
14 files changed, 140 insertions, 122 deletions
diff --git a/src/luarocks/build/make.lua b/src/luarocks/build/make.lua index 80c0d4f4..c4b21578 100644 --- a/src/luarocks/build/make.lua +++ b/src/luarocks/build/make.lua | |||
| @@ -7,6 +7,9 @@ local util = require("luarocks.util") | |||
| 7 | local cfg = require("luarocks.cfg") | 7 | local cfg = require("luarocks.cfg") |
| 8 | 8 | ||
| 9 | --- Call "make" with given target and variables | 9 | --- Call "make" with given target and variables |
| 10 | -- @param make_cmd string: the make command to be used (typically | ||
| 11 | -- configured through variables.MAKE in the config files, or | ||
| 12 | -- the appropriate platform-specific default). | ||
| 10 | -- @param pass boolean: If true, run make; if false, do nothing. | 13 | -- @param pass boolean: If true, run make; if false, do nothing. |
| 11 | -- @param target string: The make target; an empty string indicates | 14 | -- @param target string: The make target; an empty string indicates |
| 12 | -- the default target. | 15 | -- the default target. |
diff --git a/src/luarocks/deps.lua b/src/luarocks/deps.lua index 227ce9f8..9cc9f2c4 100644 --- a/src/luarocks/deps.lua +++ b/src/luarocks/deps.lua | |||
| @@ -606,12 +606,15 @@ end | |||
| 606 | --- Recursively scan dependencies, to build a transitive closure of all | 606 | --- Recursively scan dependencies, to build a transitive closure of all |
| 607 | -- dependent packages. | 607 | -- dependent packages. |
| 608 | -- @param results table: The results table being built. | 608 | -- @param results table: The results table being built. |
| 609 | -- @param missing table: The table of missing dependencies being recursively built. | ||
| 610 | -- @param manifest table: The manifest table containing dependencies. | ||
| 609 | -- @param name string: Package name. | 611 | -- @param name string: Package name. |
| 610 | -- @param version string: Package version. | 612 | -- @param version string: Package version. |
| 611 | -- @return (table, table): The results and a table of missing dependencies. | 613 | -- @return (table, table): The results and a table of missing dependencies. |
| 612 | function scan_deps(results, missing, manifest, name, version) | 614 | function scan_deps(results, missing, manifest, name, version) |
| 613 | assert(type(results) == "table") | 615 | assert(type(results) == "table") |
| 614 | assert(type(missing) == "table") | 616 | assert(type(missing) == "table") |
| 617 | assert(type(manifest) == "table") | ||
| 615 | assert(type(name) == "string") | 618 | assert(type(name) == "string") |
| 616 | assert(type(version) == "string") | 619 | assert(type(version) == "string") |
| 617 | 620 | ||
diff --git a/src/luarocks/fetch.lua b/src/luarocks/fetch.lua index 80ca4400..bdb448c7 100644 --- a/src/luarocks/fetch.lua +++ b/src/luarocks/fetch.lua | |||
| @@ -122,7 +122,7 @@ end | |||
| 122 | 122 | ||
| 123 | --- Back-end function that actually loads the local rockspec. | 123 | --- Back-end function that actually loads the local rockspec. |
| 124 | -- Performs some validation and postprocessing of the rockspec contents. | 124 | -- Performs some validation and postprocessing of the rockspec contents. |
| 125 | -- @param file string: The local filename of the rockspec file. | 125 | -- @param filename string: The local filename of the rockspec file. |
| 126 | -- @return table or (nil, string): A table representing the rockspec | 126 | -- @return table or (nil, string): A table representing the rockspec |
| 127 | -- or nil followed by an error message. | 127 | -- or nil followed by an error message. |
| 128 | function load_local_rockspec(filename) | 128 | function load_local_rockspec(filename) |
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 2a176259..29b71c55 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
| @@ -595,6 +595,7 @@ end | |||
| 595 | 595 | ||
| 596 | --- Apply a patch. | 596 | --- Apply a patch. |
| 597 | -- @param patchname string: The filename of the patch. | 597 | -- @param patchname string: The filename of the patch. |
| 598 | -- @param patchdata string or nil: The actual patch as a string. | ||
| 598 | function apply_patch(patchname, patchdata) | 599 | function apply_patch(patchname, patchdata) |
| 599 | local p, all_ok = patch.read_patch(patchname, patchdata) | 600 | local p, all_ok = patch.read_patch(patchname, patchdata) |
| 600 | if not all_ok then | 601 | if not all_ok then |
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index 73f01518..5e91439b 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
| @@ -11,7 +11,7 @@ local dir_stack = {} | |||
| 11 | local vars = cfg.variables | 11 | local vars = cfg.variables |
| 12 | 12 | ||
| 13 | --- Run the given command. | 13 | --- Run the given command. |
| 14 | -- The command is executed in the current directory in the dir stack. | 14 | -- The command is executed in the current directory in the directory stack. |
| 15 | -- @param cmd string: No quoting/escaping is applied to the command. | 15 | -- @param cmd string: No quoting/escaping is applied to the command. |
| 16 | -- @return boolean: true if command succeeds (status code 0), false | 16 | -- @return boolean: true if command succeeds (status code 0), false |
| 17 | -- otherwise. | 17 | -- otherwise. |
| @@ -25,26 +25,26 @@ function execute_string(cmd) | |||
| 25 | end | 25 | end |
| 26 | 26 | ||
| 27 | --- Obtain current directory. | 27 | --- Obtain current directory. |
| 28 | -- Uses the module's internal dir stack. | 28 | -- Uses the module's internal directory stack. |
| 29 | -- @return string: the absolute pathname of the current directory. | 29 | -- @return string: the absolute pathname of the current directory. |
| 30 | function current_dir() | 30 | function current_dir() |
| 31 | local pipe = io.popen(vars.PWD) | 31 | local pipe = io.popen(vars.PWD) |
| 32 | local current = pipe:read("*l") | 32 | local current = pipe:read("*l") |
| 33 | pipe:close() | 33 | pipe:close() |
| 34 | for _, d in ipairs(dir_stack) do | 34 | for _, directory in ipairs(dir_stack) do |
| 35 | current = fs.absolute_name(d, current) | 35 | current = fs.absolute_name(directory, current) |
| 36 | end | 36 | end |
| 37 | return current | 37 | return current |
| 38 | end | 38 | end |
| 39 | 39 | ||
| 40 | --- Change the current directory. | 40 | --- Change the current directory. |
| 41 | -- Uses the module's internal dir stack. This does not have exact | 41 | -- Uses the module's internal directory stack. This does not have exact |
| 42 | -- semantics of chdir, as it does not handle errors the same way, | 42 | -- semantics of chdir, as it does not handle errors the same way, |
| 43 | -- but works well for our purposes for now. | 43 | -- but works well for our purposes for now. |
| 44 | -- @param d string: The directory to switch to. | 44 | -- @param directory string: The directory to switch to. |
| 45 | function change_dir(d) | 45 | function change_dir(directory) |
| 46 | assert(type(d) == "string") | 46 | assert(type(directory) == "string") |
| 47 | table.insert(dir_stack, d) | 47 | table.insert(dir_stack, directory) |
| 48 | end | 48 | end |
| 49 | 49 | ||
| 50 | --- Change directory to root. | 50 | --- Change directory to root. |
| @@ -54,44 +54,44 @@ function change_dir_to_root() | |||
| 54 | table.insert(dir_stack, "/") | 54 | table.insert(dir_stack, "/") |
| 55 | end | 55 | end |
| 56 | 56 | ||
| 57 | --- Change working directory to the previous in the dir stack. | 57 | --- Change working directory to the previous in the directory stack. |
| 58 | function pop_dir() | 58 | function pop_dir() |
| 59 | local d = table.remove(dir_stack) | 59 | local directory = table.remove(dir_stack) |
| 60 | return d ~= nil | 60 | return directory ~= nil |
| 61 | end | 61 | end |
| 62 | 62 | ||
| 63 | --- Create a directory if it does not already exist. | 63 | --- Create a directory if it does not already exist. |
| 64 | -- If any of the higher levels in the path name does not exist | 64 | -- If any of the higher levels in the path name does not exist |
| 65 | -- too, they are created as well. | 65 | -- too, they are created as well. |
| 66 | -- @param d string: pathname of directory to create. | 66 | -- @param directory string: pathname of directory to create. |
| 67 | -- @return boolean: true on success, false on failure. | 67 | -- @return boolean: true on success, false on failure. |
| 68 | function make_dir(d) | 68 | function make_dir(directory) |
| 69 | assert(d) | 69 | assert(directory) |
| 70 | return fs.execute(vars.MKDIR.." -p", d) | 70 | return fs.execute(vars.MKDIR.." -p", directory) |
| 71 | end | 71 | end |
| 72 | 72 | ||
| 73 | --- Remove a directory if it is empty. | 73 | --- Remove a directory if it is empty. |
| 74 | -- Does not return errors (for example, if directory is not empty or | 74 | -- Does not return errors (for example, if directory is not empty or |
| 75 | -- if already does not exist) | 75 | -- if already does not exist) |
| 76 | -- @param dir string: pathname of directory to remove. | 76 | -- @param directory string: pathname of directory to remove. |
| 77 | function remove_dir_if_empty(d) | 77 | function remove_dir_if_empty(directory) |
| 78 | assert(d) | 78 | assert(directory) |
| 79 | fs.execute_string(vars.RMDIR.." "..fs.Q(d).." 1> /dev/null 2> /dev/null") | 79 | fs.execute_string(vars.RMDIR.." "..fs.Q(directory).." 1> /dev/null 2> /dev/null") |
| 80 | end | 80 | end |
| 81 | 81 | ||
| 82 | --- Remove a directory if it is empty. | 82 | --- Remove a directory if it is empty. |
| 83 | -- Does not return errors (for example, if directory is not empty or | 83 | -- Does not return errors (for example, if directory is not empty or |
| 84 | -- if already does not exist) | 84 | -- if already does not exist) |
| 85 | -- @param dir string: pathname of directory to remove. | 85 | -- @param directory string: pathname of directory to remove. |
| 86 | function remove_dir_tree_if_empty(d) | 86 | function remove_dir_tree_if_empty(directory) |
| 87 | assert(d) | 87 | assert(directory) |
| 88 | fs.execute_string(vars.RMDIR.." -p "..fs.Q(d).." 1> /dev/null 2> /dev/null") | 88 | fs.execute_string(vars.RMDIR.." -p "..fs.Q(directory).." 1> /dev/null 2> /dev/null") |
| 89 | end | 89 | end |
| 90 | 90 | ||
| 91 | --- Copy a file. | 91 | --- Copy a file. |
| 92 | -- @param src string: Pathname of source | 92 | -- @param src string: Pathname of source |
| 93 | -- @param dest string: Pathname of destination | 93 | -- @param dest string: Pathname of destination |
| 94 | -- @param perms string or nil: Permissions for destination file, | 94 | -- @param perm string or nil: Permissions for destination file, |
| 95 | -- @return boolean or (boolean, string): true on success, false on failure, | 95 | -- @return boolean or (boolean, string): true on success, false on failure, |
| 96 | -- plus an error message. | 96 | -- plus an error message. |
| 97 | function copy(src, dest, perm) | 97 | function copy(src, dest, perm) |
| @@ -205,7 +205,7 @@ function exists(file) | |||
| 205 | return fs.execute(vars.TEST, "-r", file) | 205 | return fs.execute(vars.TEST, "-r", file) |
| 206 | end | 206 | end |
| 207 | 207 | ||
| 208 | --- Test is file/dir is writable. | 208 | --- Test is file/directory is writable. |
| 209 | -- @param file string: filename to test | 209 | -- @param file string: filename to test |
| 210 | -- @return boolean: true if file exists, false otherwise. | 210 | -- @return boolean: true if file exists, false otherwise. |
| 211 | function is_writable(file) | 211 | function is_writable(file) |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 5b7634cf..2ad84371 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
| @@ -42,14 +42,14 @@ function exists(file) | |||
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | --- Obtain current directory. | 44 | --- Obtain current directory. |
| 45 | -- Uses the module's internal dir stack. | 45 | -- Uses the module's internal directory stack. |
| 46 | -- @return string: the absolute pathname of the current directory. | 46 | -- @return string: the absolute pathname of the current directory. |
| 47 | function current_dir() | 47 | function current_dir() |
| 48 | local pipe = io.popen(vars.PWD) | 48 | local pipe = io.popen(vars.PWD) |
| 49 | local current = pipe:read("*l") | 49 | local current = pipe:read("*l") |
| 50 | pipe:close() | 50 | pipe:close() |
| 51 | for _, d in ipairs(dir_stack) do | 51 | for _, directory in ipairs(dir_stack) do |
| 52 | current = fs.absolute_name(d, current) | 52 | current = fs.absolute_name(directory, current) |
| 53 | end | 53 | end |
| 54 | return current | 54 | return current |
| 55 | end | 55 | end |
| @@ -82,13 +82,13 @@ function get_md5(file) | |||
| 82 | end | 82 | end |
| 83 | 83 | ||
| 84 | --- Change the current directory. | 84 | --- Change the current directory. |
| 85 | -- Uses the module's internal dir stack. This does not have exact | 85 | -- Uses the module's internal directory stack. This does not have exact |
| 86 | -- semantics of chdir, as it does not handle errors the same way, | 86 | -- semantics of chdir, as it does not handle errors the same way, |
| 87 | -- but works well for our purposes for now. | 87 | -- but works well for our purposes for now. |
| 88 | -- @param d string: The directory to switch to. | 88 | -- @param directory string: The directory to switch to. |
| 89 | function change_dir(d) | 89 | function change_dir(directory) |
| 90 | assert(type(d) == "string") | 90 | assert(type(directory) == "string") |
| 91 | table.insert(dir_stack, d) | 91 | table.insert(dir_stack, directory) |
| 92 | end | 92 | end |
| 93 | 93 | ||
| 94 | --- Change directory to root. | 94 | --- Change directory to root. |
| @@ -98,14 +98,14 @@ function change_dir_to_root() | |||
| 98 | table.insert(dir_stack, "/") | 98 | table.insert(dir_stack, "/") |
| 99 | end | 99 | end |
| 100 | 100 | ||
| 101 | --- Change working directory to the previous in the dir stack. | 101 | --- Change working directory to the previous in the directory stack. |
| 102 | function pop_dir() | 102 | function pop_dir() |
| 103 | local d = table.remove(dir_stack) | 103 | local directory = table.remove(dir_stack) |
| 104 | return d ~= nil | 104 | return directory ~= nil |
| 105 | end | 105 | end |
| 106 | 106 | ||
| 107 | --- Run the given command. | 107 | --- Run the given command. |
| 108 | -- The command is executed in the current directory in the dir stack. | 108 | -- The command is executed in the current directory in the directory stack. |
| 109 | -- @param cmd string: No quoting/escaping is applied to the command. | 109 | -- @param cmd string: No quoting/escaping is applied to the command. |
| 110 | -- @return boolean: true if command succeeds (status code 0), false | 110 | -- @return boolean: true if command succeeds (status code 0), false |
| 111 | -- otherwise. | 111 | -- otherwise. |
| @@ -128,30 +128,30 @@ end | |||
| 128 | --- Create a directory if it does not already exist. | 128 | --- Create a directory if it does not already exist. |
| 129 | -- If any of the higher levels in the path name does not exist | 129 | -- If any of the higher levels in the path name does not exist |
| 130 | -- too, they are created as well. | 130 | -- too, they are created as well. |
| 131 | -- @param d string: pathname of directory to create. | 131 | -- @param directory string: pathname of directory to create. |
| 132 | -- @return boolean: true on success, false on failure. | 132 | -- @return boolean: true on success, false on failure. |
| 133 | function make_dir(d) | 133 | function make_dir(directory) |
| 134 | assert(d) | 134 | assert(directory) |
| 135 | fs.execute(vars.MKDIR.." "..fs.Q(d).." 1> NUL 2> NUL") | 135 | fs.execute(vars.MKDIR.." "..fs.Q(directory).." 1> NUL 2> NUL") |
| 136 | return 1 | 136 | return 1 |
| 137 | end | 137 | end |
| 138 | 138 | ||
| 139 | --- Remove a directory if it is empty. | 139 | --- Remove a directory if it is empty. |
| 140 | -- Does not return errors (for example, if directory is not empty or | 140 | -- Does not return errors (for example, if directory is not empty or |
| 141 | -- if already does not exist) | 141 | -- if already does not exist) |
| 142 | -- @param d string: pathname of directory to remove. | 142 | -- @param directory string: pathname of directory to remove. |
| 143 | function remove_dir_if_empty(d) | 143 | function remove_dir_if_empty(directory) |
| 144 | assert(d) | 144 | assert(directory) |
| 145 | fs.execute_string(vars.RMDIR.." "..fs.Q(d).." 1> NUL 2> NUL") | 145 | fs.execute_string(vars.RMDIR.." "..fs.Q(directory).." 1> NUL 2> NUL") |
| 146 | end | 146 | end |
| 147 | 147 | ||
| 148 | --- Remove a directory if it is empty. | 148 | --- Remove a directory if it is empty. |
| 149 | -- Does not return errors (for example, if directory is not empty or | 149 | -- Does not return errors (for example, if directory is not empty or |
| 150 | -- if already does not exist) | 150 | -- if already does not exist) |
| 151 | -- @param dir string: pathname of directory to remove. | 151 | -- @param directory string: pathname of directory to remove. |
| 152 | function remove_dir_tree_if_empty(d) | 152 | function remove_dir_tree_if_empty(directory) |
| 153 | assert(d) | 153 | assert(directory) |
| 154 | fs.execute_string(vars.RMDIR.." "..fs.Q(d).." 1> NUL 2> NUL") | 154 | fs.execute_string(vars.RMDIR.." "..fs.Q(directory).." 1> NUL 2> NUL") |
| 155 | end | 155 | end |
| 156 | 156 | ||
| 157 | --- Copy a file. | 157 | --- Copy a file. |
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 44a21f91..9cacc3ff 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
| @@ -172,12 +172,11 @@ local function sort_package_matching_table(tbl) | |||
| 172 | end | 172 | end |
| 173 | end | 173 | end |
| 174 | 174 | ||
| 175 | --- Process the dependencies of a package to determine its dependency | 175 | --- Process the dependencies of a manifest table to determine its dependency |
| 176 | -- chain for loading modules. | 176 | -- chains for loading modules. The manifest dependencies information is filled |
| 177 | -- @param name string: Package name. | 177 | -- and any dependency inconsistencies or missing dependencies are reported to |
| 178 | -- @param version string: Package version. | 178 | -- standard error. |
| 179 | -- @return (table, table): A table listing dependencies as string-string pairs | 179 | -- @param manifest table: a manifest table. |
| 180 | -- of names and versions, and a similar table of missing dependencies. | ||
| 181 | local function update_dependencies(manifest) | 180 | local function update_dependencies(manifest) |
| 182 | for pkg, versions in pairs(manifest.repository) do | 181 | for pkg, versions in pairs(manifest.repository) do |
| 183 | for version, repos in pairs(versions) do | 182 | for version, repos in pairs(versions) do |
| @@ -205,6 +204,8 @@ end | |||
| 205 | --- Store search results in a manifest table. | 204 | --- Store search results in a manifest table. |
| 206 | -- @param results table: The search results as returned by search.disk_search. | 205 | -- @param results table: The search results as returned by search.disk_search. |
| 207 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). | 206 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). |
| 207 | -- It will be altered to include the search results. | ||
| 208 | -- @return boolean or (nil, string): true in case of success, or nil followed by an error message. | ||
| 208 | local function store_results(results, manifest) | 209 | local function store_results(results, manifest) |
| 209 | assert(type(results) == "table") | 210 | assert(type(results) == "table") |
| 210 | assert(type(manifest) == "table") | 211 | assert(type(manifest) == "table") |
diff --git a/src/luarocks/manif_core.lua b/src/luarocks/manif_core.lua index 2e1a9518..40f16898 100644 --- a/src/luarocks/manif_core.lua +++ b/src/luarocks/manif_core.lua | |||
| @@ -15,6 +15,7 @@ manifest_cache = {} | |||
| 15 | -- and stores it in the manifest cache. | 15 | -- and stores it in the manifest cache. |
| 16 | -- @param file string: The local filename of the manifest file. | 16 | -- @param file string: The local filename of the manifest file. |
| 17 | -- @param repo_url string: The repository identifier. | 17 | -- @param repo_url string: The repository identifier. |
| 18 | -- @param quick boolean: If given, skips type checking. | ||
| 18 | function manifest_loader(file, repo_url, quick) | 19 | function manifest_loader(file, repo_url, quick) |
| 19 | local manifest, err = persist.load_into_table(file) | 20 | local manifest, err = persist.load_into_table(file) |
| 20 | if not manifest then | 21 | if not manifest then |
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index 9b7f6bc7..99127235 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
| @@ -25,12 +25,12 @@ function rockspec_name_from_rock(rock_name) | |||
| 25 | return base_name:match("(.*)%.[^.]*.rock") .. ".rockspec" | 25 | return base_name:match("(.*)%.[^.]*.rock") .. ".rockspec" |
| 26 | end | 26 | end |
| 27 | 27 | ||
| 28 | function rocks_dir(repo) | 28 | function rocks_dir(tree) |
| 29 | if type(repo) == "string" then | 29 | if type(tree) == "string" then |
| 30 | return dir.path(repo, "lib", "luarocks", "rocks") | 30 | return dir.path(tree, "lib", "luarocks", "rocks") |
| 31 | else | 31 | else |
| 32 | assert(type(repo) == "table") | 32 | assert(type(tree) == "table") |
| 33 | return repo.rocks_dir or dir.path(repo.root, "lib", "luarocks", "rocks") | 33 | return tree.rocks_dir or dir.path(tree.root, "lib", "luarocks", "rocks") |
| 34 | end | 34 | end |
| 35 | end | 35 | end |
| 36 | 36 | ||
| @@ -41,156 +41,156 @@ function root_dir(rocks_dir) | |||
| 41 | return rocks_dir:match("(.*)" .. suffix .. "$") | 41 | return rocks_dir:match("(.*)" .. suffix .. "$") |
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | function deploy_bin_dir(repo) | 44 | function deploy_bin_dir(tree) |
| 45 | if type(repo) == "string" then | 45 | if type(tree) == "string" then |
| 46 | return dir.path(repo, "bin") | 46 | return dir.path(tree, "bin") |
| 47 | else | 47 | else |
| 48 | assert(type(repo) == "table") | 48 | assert(type(tree) == "table") |
| 49 | return repo.bin_dir or dir.path(repo.root, "bin") | 49 | return tree.bin_dir or dir.path(tree.root, "bin") |
| 50 | end | 50 | end |
| 51 | end | 51 | end |
| 52 | 52 | ||
| 53 | function deploy_lua_dir(repo) | 53 | function deploy_lua_dir(tree) |
| 54 | if type(repo) == "string" then | 54 | if type(tree) == "string" then |
| 55 | return dir.path(repo, cfg.lua_modules_path) | 55 | return dir.path(tree, cfg.lua_modules_path) |
| 56 | else | 56 | else |
| 57 | assert(type(repo) == "table") | 57 | assert(type(tree) == "table") |
| 58 | return repo.lua_dir or dir.path(repo.root, cfg.lua_modules_path) | 58 | return tree.lua_dir or dir.path(tree.root, cfg.lua_modules_path) |
| 59 | end | 59 | end |
| 60 | end | 60 | end |
| 61 | 61 | ||
| 62 | function deploy_lib_dir(repo) | 62 | function deploy_lib_dir(tree) |
| 63 | if type(repo) == "string" then | 63 | if type(tree) == "string" then |
| 64 | return dir.path(repo, cfg.lib_modules_path) | 64 | return dir.path(tree, cfg.lib_modules_path) |
| 65 | else | 65 | else |
| 66 | assert(type(repo) == "table") | 66 | assert(type(tree) == "table") |
| 67 | return repo.lib_dir or dir.path(repo.root, cfg.lib_modules_path) | 67 | return tree.lib_dir or dir.path(tree.root, cfg.lib_modules_path) |
| 68 | end | 68 | end |
| 69 | end | 69 | end |
| 70 | 70 | ||
| 71 | function manifest_file(repo) | 71 | function manifest_file(tree) |
| 72 | if type(repo) == "string" then | 72 | if type(tree) == "string" then |
| 73 | return dir.path(repo, "lib", "luarocks", "rocks", "manifest") | 73 | return dir.path(tree, "lib", "luarocks", "rocks", "manifest") |
| 74 | else | 74 | else |
| 75 | assert(type(repo) == "table") | 75 | assert(type(tree) == "table") |
| 76 | return (repo.rocks_dir and dir.path(repo.rocks_dir, "manifest")) or dir.path(repo.root, "lib", "luarocks", "rocks", "manifest") | 76 | return (tree.rocks_dir and dir.path(tree.rocks_dir, "manifest")) or dir.path(tree.root, "lib", "luarocks", "rocks", "manifest") |
| 77 | end | 77 | end |
| 78 | end | 78 | end |
| 79 | 79 | ||
| 80 | --- Get the repository directory for all versions of a package. | 80 | --- Get the directory for all versions of a package in a tree. |
| 81 | -- @param name string: The package name. | 81 | -- @param name string: The package name. |
| 82 | -- @return string: The resulting path -- does not guarantee that | 82 | -- @return string: The resulting path -- does not guarantee that |
| 83 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 83 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 84 | -- the package (and by extension, the path) exists. | 84 | -- the package (and by extension, the path) exists. |
| 85 | function versions_dir(name, repo) | 85 | function versions_dir(name, tree) |
| 86 | assert(type(name) == "string") | 86 | assert(type(name) == "string") |
| 87 | repo = repo or cfg.root_dir | 87 | tree = tree or cfg.root_dir |
| 88 | return dir.path(rocks_dir(repo), name) | 88 | return dir.path(rocks_dir(tree), name) |
| 89 | end | 89 | end |
| 90 | 90 | ||
| 91 | --- Get the local installation directory (prefix) for a package. | 91 | --- Get the local installation directory (prefix) for a package. |
| 92 | -- @param name string: The package name. | 92 | -- @param name string: The package name. |
| 93 | -- @param version string: The package version. | 93 | -- @param version string: The package version. |
| 94 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 94 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 95 | -- @return string: The resulting path -- does not guarantee that | 95 | -- @return string: The resulting path -- does not guarantee that |
| 96 | -- the package (and by extension, the path) exists. | 96 | -- the package (and by extension, the path) exists. |
| 97 | function install_dir(name, version, repo) | 97 | function install_dir(name, version, tree) |
| 98 | assert(type(name) == "string") | 98 | assert(type(name) == "string") |
| 99 | assert(type(version) == "string") | 99 | assert(type(version) == "string") |
| 100 | repo = repo or cfg.root_dir | 100 | tree = tree or cfg.root_dir |
| 101 | return dir.path(rocks_dir(repo), name, version) | 101 | return dir.path(rocks_dir(tree), name, version) |
| 102 | end | 102 | end |
| 103 | 103 | ||
| 104 | --- Get the local filename of the rockspec of an installed rock. | 104 | --- Get the local filename of the rockspec of an installed rock. |
| 105 | -- @param name string: The package name. | 105 | -- @param name string: The package name. |
| 106 | -- @param version string: The package version. | 106 | -- @param version string: The package version. |
| 107 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 107 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 108 | -- @return string: The resulting path -- does not guarantee that | 108 | -- @return string: The resulting path -- does not guarantee that |
| 109 | -- the package (and by extension, the file) exists. | 109 | -- the package (and by extension, the file) exists. |
| 110 | function rockspec_file(name, version, repo) | 110 | function rockspec_file(name, version, tree) |
| 111 | assert(type(name) == "string") | 111 | assert(type(name) == "string") |
| 112 | assert(type(version) == "string") | 112 | assert(type(version) == "string") |
| 113 | repo = repo or cfg.root_dir | 113 | tree = tree or cfg.root_dir |
| 114 | return dir.path(rocks_dir(repo), name, version, name.."-"..version..".rockspec") | 114 | return dir.path(rocks_dir(tree), name, version, name.."-"..version..".rockspec") |
| 115 | end | 115 | end |
| 116 | 116 | ||
| 117 | --- Get the local filename of the rock_manifest file of an installed rock. | 117 | --- Get the local filename of the rock_manifest file of an installed rock. |
| 118 | -- @param name string: The package name. | 118 | -- @param name string: The package name. |
| 119 | -- @param version string: The package version. | 119 | -- @param version string: The package version. |
| 120 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 120 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 121 | -- @return string: The resulting path -- does not guarantee that | 121 | -- @return string: The resulting path -- does not guarantee that |
| 122 | -- the package (and by extension, the file) exists. | 122 | -- the package (and by extension, the file) exists. |
| 123 | function rock_manifest_file(name, version, repo) | 123 | function rock_manifest_file(name, version, tree) |
| 124 | assert(type(name) == "string") | 124 | assert(type(name) == "string") |
| 125 | assert(type(version) == "string") | 125 | assert(type(version) == "string") |
| 126 | repo = repo or cfg.root_dir | 126 | tree = tree or cfg.root_dir |
| 127 | return dir.path(rocks_dir(repo), name, version, "rock_manifest") | 127 | return dir.path(rocks_dir(tree), name, version, "rock_manifest") |
| 128 | end | 128 | end |
| 129 | 129 | ||
| 130 | --- Get the local installation directory for C libraries of a package. | 130 | --- Get the local installation directory for C libraries of a package. |
| 131 | -- @param name string: The package name. | 131 | -- @param name string: The package name. |
| 132 | -- @param version string: The package version. | 132 | -- @param version string: The package version. |
| 133 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 133 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 134 | -- @return string: The resulting path -- does not guarantee that | 134 | -- @return string: The resulting path -- does not guarantee that |
| 135 | -- the package (and by extension, the path) exists. | 135 | -- the package (and by extension, the path) exists. |
| 136 | function lib_dir(name, version, repo) | 136 | function lib_dir(name, version, tree) |
| 137 | assert(type(name) == "string") | 137 | assert(type(name) == "string") |
| 138 | assert(type(version) == "string") | 138 | assert(type(version) == "string") |
| 139 | repo = repo or cfg.root_dir | 139 | tree = tree or cfg.root_dir |
| 140 | return dir.path(rocks_dir(repo), name, version, "lib") | 140 | return dir.path(rocks_dir(tree), name, version, "lib") |
| 141 | end | 141 | end |
| 142 | 142 | ||
| 143 | --- Get the local installation directory for Lua modules of a package. | 143 | --- Get the local installation directory for Lua modules of a package. |
| 144 | -- @param name string: The package name. | 144 | -- @param name string: The package name. |
| 145 | -- @param version string: The package version. | 145 | -- @param version string: The package version. |
| 146 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 146 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 147 | -- @return string: The resulting path -- does not guarantee that | 147 | -- @return string: The resulting path -- does not guarantee that |
| 148 | -- the package (and by extension, the path) exists. | 148 | -- the package (and by extension, the path) exists. |
| 149 | function lua_dir(name, version, repo) | 149 | function lua_dir(name, version, tree) |
| 150 | assert(type(name) == "string") | 150 | assert(type(name) == "string") |
| 151 | assert(type(version) == "string") | 151 | assert(type(version) == "string") |
| 152 | repo = repo or cfg.root_dir | 152 | tree = tree or cfg.root_dir |
| 153 | return dir.path(rocks_dir(repo), name, version, "lua") | 153 | return dir.path(rocks_dir(tree), name, version, "lua") |
| 154 | end | 154 | end |
| 155 | 155 | ||
| 156 | --- Get the local installation directory for documentation of a package. | 156 | --- Get the local installation directory for documentation of a package. |
| 157 | -- @param name string: The package name. | 157 | -- @param name string: The package name. |
| 158 | -- @param version string: The package version. | 158 | -- @param version string: The package version. |
| 159 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 159 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 160 | -- @return string: The resulting path -- does not guarantee that | 160 | -- @return string: The resulting path -- does not guarantee that |
| 161 | -- the package (and by extension, the path) exists. | 161 | -- the package (and by extension, the path) exists. |
| 162 | function doc_dir(name, version, repo) | 162 | function doc_dir(name, version, tree) |
| 163 | assert(type(name) == "string") | 163 | assert(type(name) == "string") |
| 164 | assert(type(version) == "string") | 164 | assert(type(version) == "string") |
| 165 | repo = repo or cfg.root_dir | 165 | tree = tree or cfg.root_dir |
| 166 | return dir.path(rocks_dir(repo), name, version, "doc") | 166 | return dir.path(rocks_dir(tree), name, version, "doc") |
| 167 | end | 167 | end |
| 168 | 168 | ||
| 169 | --- Get the local installation directory for configuration files of a package. | 169 | --- Get the local installation directory for configuration files of a package. |
| 170 | -- @param name string: The package name. | 170 | -- @param name string: The package name. |
| 171 | -- @param version string: The package version. | 171 | -- @param version string: The package version. |
| 172 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 172 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 173 | -- @return string: The resulting path -- does not guarantee that | 173 | -- @return string: The resulting path -- does not guarantee that |
| 174 | -- the package (and by extension, the path) exists. | 174 | -- the package (and by extension, the path) exists. |
| 175 | function conf_dir(name, version, repo) | 175 | function conf_dir(name, version, tree) |
| 176 | assert(type(name) == "string") | 176 | assert(type(name) == "string") |
| 177 | assert(type(version) == "string") | 177 | assert(type(version) == "string") |
| 178 | repo = repo or cfg.root_dir | 178 | tree = tree or cfg.root_dir |
| 179 | return dir.path(rocks_dir(repo), name, version, "conf") | 179 | return dir.path(rocks_dir(tree), name, version, "conf") |
| 180 | end | 180 | end |
| 181 | 181 | ||
| 182 | --- Get the local installation directory for command-line scripts | 182 | --- Get the local installation directory for command-line scripts |
| 183 | -- of a package. | 183 | -- of a package. |
| 184 | -- @param name string: The package name. | 184 | -- @param name string: The package name. |
| 185 | -- @param version string: The package version. | 185 | -- @param version string: The package version. |
| 186 | -- @param rocks_dir string or nil: If given, specifies the local repository to use. | 186 | -- @param tree string or nil: If given, specifies the local tree to use. |
| 187 | -- @return string: The resulting path -- does not guarantee that | 187 | -- @return string: The resulting path -- does not guarantee that |
| 188 | -- the package (and by extension, the path) exists. | 188 | -- the package (and by extension, the path) exists. |
| 189 | function bin_dir(name, version, repo) | 189 | function bin_dir(name, version, tree) |
| 190 | assert(type(name) == "string") | 190 | assert(type(name) == "string") |
| 191 | assert(type(version) == "string") | 191 | assert(type(version) == "string") |
| 192 | repo = repo or cfg.root_dir | 192 | tree = tree or cfg.root_dir |
| 193 | return dir.path(rocks_dir(repo), name, version, "bin") | 193 | return dir.path(rocks_dir(tree), name, version, "bin") |
| 194 | end | 194 | end |
| 195 | 195 | ||
| 196 | --- Extract name, version and arch of a rock filename, | 196 | --- Extract name, version and arch of a rock filename, |
diff --git a/src/luarocks/persist.lua b/src/luarocks/persist.lua index c809b51c..91c28a32 100644 --- a/src/luarocks/persist.lua +++ b/src/luarocks/persist.lua | |||
| @@ -34,6 +34,7 @@ end | |||
| 34 | -- are keys (tables are handled recursively). | 34 | -- are keys (tables are handled recursively). |
| 35 | -- @param out userdata: a file object, open for writing. | 35 | -- @param out userdata: a file object, open for writing. |
| 36 | -- @param tbl table: the table to be written. | 36 | -- @param tbl table: the table to be written. |
| 37 | -- @param level number: the indentation level | ||
| 37 | local function write_table(out, tbl, level) | 38 | local function write_table(out, tbl, level) |
| 38 | out:write("{") | 39 | out:write("{") |
| 39 | local sep = "\n" | 40 | local sep = "\n" |
diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 127bba19..9671d15b 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua | |||
| @@ -331,8 +331,8 @@ end | |||
| 331 | -- user possibilities if it couldn't narrow down a single match. | 331 | -- user possibilities if it couldn't narrow down a single match. |
| 332 | -- @param action function: A function that takes a .src.rock or | 332 | -- @param action function: A function that takes a .src.rock or |
| 333 | -- .rockspec URL as a parameter. | 333 | -- .rockspec URL as a parameter. |
| 334 | -- @string name string: A rock name | 334 | -- @param name string: A rock name |
| 335 | -- @string version string or nil: A version number may also be given. | 335 | -- @param version string or nil: A version number may also be given. |
| 336 | -- @return The result of the action function, or nil and an error message. | 336 | -- @return The result of the action function, or nil and an error message. |
| 337 | function act_on_src_or_rockspec(action, name, version) | 337 | function act_on_src_or_rockspec(action, name, version) |
| 338 | assert(type(action) == "function") | 338 | assert(type(action) == "function") |
diff --git a/src/luarocks/type_check.lua b/src/luarocks/type_check.lua index 57340675..282198f6 100644 --- a/src/luarocks/type_check.lua +++ b/src/luarocks/type_check.lua | |||
| @@ -156,6 +156,9 @@ local type_check_table | |||
| 156 | -- @param item any: The object being checked. | 156 | -- @param item any: The object being checked. |
| 157 | -- @param expected any: The reference object. In case of a table, | 157 | -- @param expected any: The reference object. In case of a table, |
| 158 | -- its is structured as a type reference table. | 158 | -- its is structured as a type reference table. |
| 159 | -- @param context string: A string indicating the "context" where the | ||
| 160 | -- error occurred (such as the name of the table the item is a part of), | ||
| 161 | -- to be used by error messages. | ||
| 159 | -- @return boolean or (nil, string): true if type checking | 162 | -- @return boolean or (nil, string): true if type checking |
| 160 | -- succeeded, or nil and an error message if it failed. | 163 | -- succeeded, or nil and an error message if it failed. |
| 161 | -- @see type_check_table | 164 | -- @see type_check_table |
| @@ -205,6 +208,9 @@ end | |||
| 205 | -- @param tbl table: The table to be type checked. | 208 | -- @param tbl table: The table to be type checked. |
| 206 | -- @param types table: The reference table, containing | 209 | -- @param types table: The reference table, containing |
| 207 | -- values for recognized fields in the checked table. | 210 | -- values for recognized fields in the checked table. |
| 211 | -- @param context string: A string indicating the "context" where the | ||
| 212 | -- error occurred (such as the name of the table the item is a part of), | ||
| 213 | -- to be used by error messages. | ||
| 208 | -- @return boolean or (nil, string): true if type checking | 214 | -- @return boolean or (nil, string): true if type checking |
| 209 | -- succeeded, or nil and an error message if it failed. | 215 | -- succeeded, or nil and an error message if it failed. |
| 210 | type_check_table = function(tbl, types, context) | 216 | type_check_table = function(tbl, types, context) |
diff --git a/src/luarocks/unpack.lua b/src/luarocks/unpack.lua index dacafa31..6ea7353d 100644 --- a/src/luarocks/unpack.lua +++ b/src/luarocks/unpack.lua | |||
| @@ -45,6 +45,8 @@ end | |||
| 45 | --- Load a .rock file to the given directory and unpack it inside it. | 45 | --- Load a .rock file to the given directory and unpack it inside it. |
| 46 | -- @param rock_file string: The URL for a .rock file. | 46 | -- @param rock_file string: The URL for a .rock file. |
| 47 | -- @param dir_name string: The directory where to unpack. | 47 | -- @param dir_name string: The directory where to unpack. |
| 48 | -- @param kind string: the kind of rock file, as in the second-level | ||
| 49 | -- extension in the rock filename (eg. "src", "all", "linux-x86") | ||
| 48 | -- @return table or (nil, string): the loaded rockspec table or | 50 | -- @return table or (nil, string): the loaded rockspec table or |
| 49 | -- nil and an error message. | 51 | -- nil and an error message. |
| 50 | local function unpack_rock(rock_file, dir_name, kind) | 52 | local function unpack_rock(rock_file, dir_name, kind) |
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua index 24c2accb..4495c024 100644 --- a/src/luarocks/util.lua +++ b/src/luarocks/util.lua | |||
| @@ -26,7 +26,7 @@ end | |||
| 26 | 26 | ||
| 27 | --- Unschedule a function. | 27 | --- Unschedule a function. |
| 28 | -- This is useful for cancelling a rollback of a completed operation. | 28 | -- This is useful for cancelling a rollback of a completed operation. |
| 29 | -- @param table: The token representing the scheduled function that was | 29 | -- @param item table: The token representing the scheduled function that was |
| 30 | -- returned from the schedule_function call. | 30 | -- returned from the schedule_function call. |
| 31 | function remove_scheduled_function(item) | 31 | function remove_scheduled_function(item) |
| 32 | for k, v in pairs(scheduled_functions) do | 32 | for k, v in pairs(scheduled_functions) do |
