Module luarocks.search

Module implementing the LuaRocks "search" command.

Queries LuaRocks servers.

Functions

disk_search (repo, query, results, table:) Perform search on a local repository.
manifest_search (results, repo, query) Perform search on a rocks server.
search_repos (query) Search on all configured rocks servers.
make_query (name, version) Prepare a query in dependency table format.
find_suitable_rock (query, no_binary) Attempt to get a single URL for a given search.
print_results (results, show_repo, long) Print a list of rocks/rockspecs on standard output.
act_on_src_or_rockspec (action, name, version) Given a name and optionally a version, try to find in the rocks servers a single .src.rock or .rockspec file that satisfies the request, and run the given function on it; or display to the user possibilities if it couldn't narrow down a single match.
run (name, version, ...) Driver function for "search" command.


Functions

disk_search (repo, query, results, table:)
Perform search on a local repository.

Parameters:

  • repo: string: The pathname of the local repository.
  • query: table: A table describing the query in dependency format (for example, {name = "filesystem", exact_name = false, constraints = {op = "~>", version = {1,0}}}, arch = "rockspec"). If the arch field is omitted, the local architecture (cfg.arch) is used. The special value "any" is also recognized, returning all matches regardless of architecture.
  • results: table or nil: If given, this table will store the results; if not given, a new table will be created.
  • table:: The results table, where keys are package names and versions are tables matching version strings to an array of servers. If a table was given in the "results" parameter, that is the result value.
manifest_search (results, repo, query)
Perform search on a rocks server.

Parameters:

  • results: table: The results table, where keys are package names and versions are tables matching version strings to an array of servers.
  • repo: string: The URL of the rocks server.
  • query: table: A table describing the query in dependency format (for example, {name = "filesystem", exact_name = false, constraints = {op = "~>", version = {1,0}}}, arch = "rockspec"). If the arch field is omitted, the local architecture (cfg.arch) is used. The special value "any" is also recognized, returning all matches regardless of architecture.

Returns:

    true or, in case of errors, nil and an error message.
search_repos (query)
Search on all configured rocks servers.

Parameters:

  • query: table: A dependency query.

Returns:

    table or (nil, string): A table where keys are package names and values are tables matching version strings to an array of rocks servers; if no results are found, an empty table is returned. In case of errors, nil and and error message are returned.
make_query (name, version)
Prepare a query in dependency table format.

Parameters:

  • name: string: The query name.
  • version: string or nil:

Returns:

    table: A query in table format
find_suitable_rock (query, no_binary)
Attempt to get a single URL for a given search.

Parameters:

  • query: table: A dependency query.
  • no_binary:

Returns:

    string or table or (nil, string): URL for matching rock if a single one was found, a table of candidates if it could not narrow to a single result, or nil followed by an error message.
print_results (results, show_repo, long)
Print a list of rocks/rockspecs on standard output.

Parameters:

  • results: table: A table where keys are package names and versions are tables matching version strings to an array of rocks servers.
  • show_repo: boolean or nil: Whether to show repository
  • long: boolean or nil: Whether to show module files information or not. Default is true.
act_on_src_or_rockspec (action, name, version)
Given a name and optionally a version, try to find in the rocks servers a single .src.rock or .rockspec file that satisfies the request, and run the given function on it; or display to the user possibilities if it couldn't narrow down a single match.

Parameters:

  • action: function: A function that takes a .src.rock or .rockspec URL as a parameter.
  • name:
  • version:

Returns:

    The result of the action function, or nil and an error message.
run (name, version, ...)
Driver function for "search" command.

Parameters:

  • name: string: A substring of a rock name to search.
  • version: string or nil: a version may also be passed.
  • ...:

Returns:

    boolean or (nil, string): True if build was successful; nil and an error message otherwise.
generated by LDoc 0.5