diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2013-06-19 22:03:40 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2013-06-19 22:03:40 -0300 |
commit | 15922c3632092d08933bc75aeacd772a4621cf89 (patch) | |
tree | 8addd78e7416f03494865c0fc42fdf1536ee0f89 | |
parent | da03cb8e55ccdb6edfeeb42a859a29508f7eddad (diff) | |
download | luarocks-15922c3632092d08933bc75aeacd772a4621cf89.tar.gz luarocks-15922c3632092d08933bc75aeacd772a4621cf89.tar.bz2 luarocks-15922c3632092d08933bc75aeacd772a4621cf89.zip |
More documentation on deps_modes
-rw-r--r-- | src/luarocks/build.lua | 8 | ||||
-rw-r--r-- | src/luarocks/install.lua | 3 | ||||
-rw-r--r-- | src/luarocks/manif.lua | 12 | ||||
-rw-r--r-- | src/luarocks/path.lua | 7 |
4 files changed, 26 insertions, 4 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 83abbf8d..27afe18d 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
@@ -111,8 +111,9 @@ end | |||
111 | -- @param minimal_mode boolean: true if there's no need to fetch, | 111 | -- @param minimal_mode boolean: true if there's no need to fetch, |
112 | -- unpack or change dir (this is used by "luarocks make"). Implies | 112 | -- unpack or change dir (this is used by "luarocks make"). Implies |
113 | -- need_to_fetch = false. | 113 | -- need_to_fetch = false. |
114 | -- @param deps_mode: string: Which trees to check dependencies for: | 114 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, |
115 | -- "none", "one", "order" or "all". | 115 | -- "all" for all trees, "order" for all trees with priority >= the current default, |
116 | -- "none" for no trees. | ||
116 | -- @return boolean or (nil, string, [string]): True if succeeded or | 117 | -- @return boolean or (nil, string, [string]): True if succeeded or |
117 | -- nil and an error message followed by an error code. | 118 | -- nil and an error message followed by an error code. |
118 | function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode) | 119 | function build_rockspec(rockspec_file, need_to_fetch, minimal_mode, deps_mode) |
@@ -275,7 +276,8 @@ end | |||
275 | -- @param need_to_fetch boolean: true if sources need to be fetched, | 276 | -- @param need_to_fetch boolean: true if sources need to be fetched, |
276 | -- false if the rockspec was obtained from inside a source rock. | 277 | -- false if the rockspec was obtained from inside a source rock. |
277 | -- @param deps_mode: string: Which trees to check dependencies for: | 278 | -- @param deps_mode: string: Which trees to check dependencies for: |
278 | -- "none", "one", "order" or "all". | 279 | -- "one" for the current default tree, "all" for all trees, |
280 | -- "order" for all trees with priority >= the current default, "none" for no trees. | ||
279 | -- @return boolean or (nil, string, [string]): True if build was successful, | 281 | -- @return boolean or (nil, string, [string]): True if build was successful, |
280 | -- or false and an error message and an optional error code. | 282 | -- or false and an error message and an optional error code. |
281 | function build_rock(rock_file, need_to_fetch, deps_mode) | 283 | function build_rock(rock_file, need_to_fetch, deps_mode) |
diff --git a/src/luarocks/install.lua b/src/luarocks/install.lua index c2a54482..3960dcb8 100644 --- a/src/luarocks/install.lua +++ b/src/luarocks/install.lua | |||
@@ -24,7 +24,8 @@ or a filename of a locally available rock. | |||
24 | --- Install a binary rock. | 24 | --- Install a binary rock. |
25 | -- @param rock_file string: local or remote filename of a rock. | 25 | -- @param rock_file string: local or remote filename of a rock. |
26 | -- @param deps_mode: string: Which trees to check dependencies for: | 26 | -- @param deps_mode: string: Which trees to check dependencies for: |
27 | -- "none", "one", "order" or "all". | 27 | -- "one" for the current default tree, "all" for all trees, |
28 | -- "order" for all trees with priority >= the current default, "none" for no trees. | ||
28 | -- @return boolean or (nil, string, [string]): True if succeeded or | 29 | -- @return boolean or (nil, string, [string]): True if succeeded or |
29 | -- nil and an error message and an optional error code. | 30 | -- nil and an error message and an optional error code. |
30 | function install_binary_rock(rock_file, deps_mode) | 31 | function install_binary_rock(rock_file, deps_mode) |
diff --git a/src/luarocks/manif.lua b/src/luarocks/manif.lua index 414c3262..0ce539e9 100644 --- a/src/luarocks/manif.lua +++ b/src/luarocks/manif.lua | |||
@@ -185,6 +185,9 @@ end | |||
185 | -- and any dependency inconsistencies or missing dependencies are reported to | 185 | -- and any dependency inconsistencies or missing dependencies are reported to |
186 | -- standard error. | 186 | -- standard error. |
187 | -- @param manifest table: a manifest table. | 187 | -- @param manifest table: a manifest table. |
188 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | ||
189 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
190 | -- "none" for no trees. | ||
188 | local function update_dependencies(manifest, deps_mode) | 191 | local function update_dependencies(manifest, deps_mode) |
189 | assert(type(manifest) == "table") | 192 | assert(type(manifest) == "table") |
190 | assert(type(deps_mode) == "string") | 193 | assert(type(deps_mode) == "string") |
@@ -216,6 +219,9 @@ end | |||
216 | -- @param results table: The search results as returned by search.disk_search. | 219 | -- @param results table: The search results as returned by search.disk_search. |
217 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). | 220 | -- @param manifest table: A manifest table (must contain repository, modules, commands tables). |
218 | -- It will be altered to include the search results. | 221 | -- It will be altered to include the search results. |
222 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | ||
223 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
224 | -- "none" for no trees. | ||
219 | -- @return boolean or (nil, string): true in case of success, or nil followed by an error message. | 225 | -- @return boolean or (nil, string): true in case of success, or nil followed by an error message. |
220 | local function store_results(results, manifest, deps_mode) | 226 | local function store_results(results, manifest, deps_mode) |
221 | assert(type(results) == "table") | 227 | assert(type(results) == "table") |
@@ -253,6 +259,9 @@ end | |||
253 | -- A file called 'manifest' will be written in the root of the given | 259 | -- A file called 'manifest' will be written in the root of the given |
254 | -- repository directory. | 260 | -- repository directory. |
255 | -- @param repo A local repository directory. | 261 | -- @param repo A local repository directory. |
262 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | ||
263 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
264 | -- "none" for the default dependency mode from the configuration. | ||
256 | -- @return boolean or (nil, string): True if manifest was generated, | 265 | -- @return boolean or (nil, string): True if manifest was generated, |
257 | -- or nil and an error message. | 266 | -- or nil and an error message. |
258 | function make_manifest(repo, deps_mode) | 267 | function make_manifest(repo, deps_mode) |
@@ -286,6 +295,9 @@ end | |||
286 | -- @param version string: Version of a package from the repository. | 295 | -- @param version string: Version of a package from the repository. |
287 | -- @param repo string or nil: Pathname of a local repository. If not given, | 296 | -- @param repo string or nil: Pathname of a local repository. If not given, |
288 | -- the default local repository configured as cfg.rocks_dir is used. | 297 | -- the default local repository configured as cfg.rocks_dir is used. |
298 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | ||
299 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
300 | -- "none" for using the default dependency mode from the configuration. | ||
289 | -- @return boolean or (nil, string): True if manifest was generated, | 301 | -- @return boolean or (nil, string): True if manifest was generated, |
290 | -- or nil and an error message. | 302 | -- or nil and an error message. |
291 | function update_manifest(name, version, repo, deps_mode) | 303 | function update_manifest(name, version, repo, deps_mode) |
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index 5e380992..cfe06118 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
@@ -313,6 +313,13 @@ function use_tree(tree) | |||
313 | cfg.deploy_lib_dir = deploy_lib_dir(tree) | 313 | cfg.deploy_lib_dir = deploy_lib_dir(tree) |
314 | end | 314 | end |
315 | 315 | ||
316 | --- Apply a given function to the active rocks trees based on chosen dependency mode. | ||
317 | -- @param deps_mode string: Dependency mode: "one" for the current default tree, | ||
318 | -- "all" for all trees, "order" for all trees with priority >= the current default, | ||
319 | -- "none" for no trees (this function becomes a nop). | ||
320 | -- @param fn function: function to be applied, with the tree dir (string) as the first | ||
321 | -- argument and the remaining varargs of map_trees as the following arguments. | ||
322 | -- @return a table with all results of invocations of fn collected. | ||
316 | function map_trees(deps_mode, fn, ...) | 323 | function map_trees(deps_mode, fn, ...) |
317 | local result = {} | 324 | local result = {} |
318 | if deps_mode == "one" then | 325 | if deps_mode == "one" then |