Module luarocks.manif
Functions for querying and manipulating manifest files.
Functions
get_versions (name, manifest) | Get all versions of a package listed in a manifest file. |
load_local_manifest (repo_url) | Load a local manifest describing a repository. |
load_manifest (repo_url) | Load a local or remote manifest describing a repository. |
make_manifest (repo) | Scan a LuaRocks repository and output a manifest file. |
manifest_loader (file, repo_url, quick) | Back-end function that actually loads the manifest and stores it in the manifest cache. |
save_manifest (repo, manifest) | Commit manifest to disk in given local repository. |
sort_package_matching_table (tbl) | Sort items of a package matching table by version number (higher versions first). |
sort_pkgs (a, b) | Sort function for ordering rock identifiers in a manifest's modules table. |
store_package_items (itemsfn, pkg, version, tbl) | Output a table listing items of a package. |
store_results (results, manifest) | Store search results in a manifest table. |
update_dependencies (manifest, name, version) | Process the dependencies of a package to determine its dependency chain for loading modules. |
update_manifest (name, version, repo) | Load a manifest file from a local repository and add to the repository information with regard to the given name and version. |
Functions
- get_versions (name, manifest)
-
Get all versions of a package listed in a manifest file.
Parameters
- name: string: a package name.
- manifest: table or nil: a manifest table; if not given, the default local manifest table is used.
Return value:
table: An array of strings listing installed versions of a package. - load_local_manifest (repo_url)
-
Load a local manifest describing a repository. All functions that use manifest tables assume they were obtained through either this function or load_manifest.
Parameters
- repo_url: string: URL or pathname for the repository.
Return value:
table or (nil, string): A table representing the manifest, or nil followed by an error message. - load_manifest (repo_url)
-
Load a local or remote manifest describing a repository. All functions that use manifest tables assume they were obtained through either this function or load_local_manifest.
Parameters
- repo_url: string: URL or pathname for the repository.
Return value:
table or (nil, string): A table representing the manifest, or nil followed by an error message. - make_manifest (repo)
-
Scan a LuaRocks repository and output a manifest file. A file called 'manifest' will be written in the root of the given repository directory.
Parameters
- repo: A local repository directory.
Return value:
boolean or (nil, string): True if manifest was generated, or nil and an error message. - manifest_loader (file, repo_url, quick)
-
Back-end function that actually loads the manifest and stores it in the manifest cache.
Parameters
- file: string: The local filename of the manifest file.
- repo_url: string: The repository identifier.
- quick:
- save_manifest (repo, manifest)
-
Commit manifest to disk in given local repository.
Parameters
- repo: string: The directory of the local repository.
- manifest: table: The manifest table
Return value:
boolean or (nil, string): true if successful, or nil and a message in case of errors. - sort_package_matching_table (tbl)
-
Sort items of a package matching table by version number (higher versions first).
Parameters
- tbl: table: the package matching table: keys should be strings and values arrays of strings with packages names in "name/version" format.
- sort_pkgs (a, b)
-
Sort function for ordering rock identifiers in a manifest's modules table. Rocks are ordered alphabetically by name, and then by version which greater first.
Parameters
- a: string: Version to compare.
- b: string: Version to compare.
Return value:
boolean: The comparison result, according to the rule outlined above. - store_package_items (itemsfn, pkg, version, tbl)
-
Output a table listing items of a package.
Parameters
- itemsfn: function: a function for obtaining items of a package. pkg and version will be passed to it; it should return a table with items as keys.
- pkg: string: package name
- version: string: package version
- tbl: table: the package matching table: keys should be item names and values arrays of strings with packages names in "name/version" format.
- store_results (results, manifest)
-
Store search results in a manifest table.
Parameters
- results: table: The search results as returned by search.disk_search.
- manifest: table: A manifest table (must contain repository, modules, commands tables).
- update_dependencies (manifest, name, version)
-
Process the dependencies of a package to determine its dependency chain for loading modules.
Parameters
- manifest:
- name: string: Package name.
- version: string: Package version.
Return value:
(table, table): A table listing dependencies as string-string pairs of names and versions, and a similar table of missing dependencies. - update_manifest (name, version, repo)
-
Load a manifest file from a local repository and add to the repository information with regard to the given name and version. A file called 'manifest' will be written in the root of the given repository directory.
Parameters
- name: string: Name of a package from the repository.
- version: string: Version of a package from the repository.
- repo: string or nil: Pathname of a local repository. If not given, the default local repository configured as cfg.rocks_dir is used.
Return value:
boolean or (nil, string): True if manifest was generated, or nil and an error message.