Module luarocks.manif

Module for handling manifest files and tables. Manifest files describe the contents of a LuaRocks tree or server. They are loaded into manifest tables, which are then used for performing searches, matching dependencies, etc.

Functions

find_current_provider (file, root) Given a path of a deployed file, figure out which rock name and version correspond to it in the tree manifest.
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.
save_table (where, name, tbl) Commit a table to disk in given local path.
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) Process the dependencies of a manifest table to determine its dependency chains 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

find_current_provider (file, root)
Given a path of a deployed file, figure out which rock name and version correspond to it in the tree manifest.

Parameters

  • file: string: The full path of a deployed file.
  • root: string or nil: A local root dir for a rocks tree. If not given, the default is used.

Return value:

string, string: name and version of the provider rock.
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, [string]): A table representing the manifest, or nil followed by an error message and an optional error code.
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.
save_table (where, name, tbl)
Commit a table to disk in given local path.

Parameters

  • where: string: The directory where the table should be saved.
  • name: string: The filename.
  • tbl: table: The table to be saved.

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). It will be altered to include the search results.

Return value:

boolean or (nil, string): true in case of success, or nil followed by an error message.
update_dependencies (manifest)
Process the dependencies of a manifest table to determine its dependency chains for loading modules. The manifest dependencies information is filled and any dependency inconsistencies or missing dependencies are reported to standard error.

Parameters

  • manifest: table: a manifest table.
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.

Valid XHTML 1.0!