Rez Cookbook
Matt Mower
The Rez Cookbook is an optional library of functionality that you can include into your games. It is hosted via a Github repository.
Getting Started
To start run the command:
rez cookbook init
Which will initialize the local end of the cookbook (the cookbook.toml file).
To see what cookbook libs are available:
rez cookbook list
You will see something like:
Fetching module list from mmower/rez-cookbook... Available modules (mmower/rez-cookbook @ v0.1.5): mmower/actions [lib] Flexible, inverse-parser, actions generator to reduce/remove hard-coded links. (by Matt Mower, since 0.1.0) mmower/source_explorer [pragma] Creates a mini-site within the game to explore the games source. (by Matt Mower, since 0.1.3) mmower/git_buildnum [pragma] Adds a BUILD_NUM const from the git commit count. (by Matt Mower, since 0.1.4) mmower/svg_icons [pragma] Converts local .svg icons into inlined @assets (by Matt Mower, since 0.1.5)
The Cookbook contains both librarys (.rez` files) and pragma definitions (.lua files).
Using a Library
To add a library to your game:
rez cookbook add mmower/action
This will download the library file into lib/cookbook and create (or update) lib/cookbook.rez which will load all of your installed cookbook libraries.
Now in your game add:
%(../lib/cookbook.rez)
And the library you have added will be automatically included into your game.
Using a pragma:
To add a @pragma to your game:
rez cookbook add mmower/svg_icons
This will download the .lua file implementing the pragma. In general your @pragma
directive should use the full name of the cookbook entry, e.g.
@pragma(after_process_ast) mmower/svg_icons ("assets/img/icons")
This differs from local pragmas in the game pragma folder which do not have a prefix.
Updating Libraries
The command:
rez cookbook status
Will tell you when the cookbook has been updated either with a new library or an updated version of an existing library.
When a new version of the library is available use:
rez cookbook update
To download and install it into lib/cookbook.
To see what commands are available:
rez cookbook
Submitting Libraries or Pragmas
To submit a library for the Cookbook it needs to be added to the Github repo.
-
clone the cookbook repository
-
in your working copy create a folder for your libraries (mine is
mmower) -
add the library or pragma (e.g.
actions.rez) to your folder -
update
index.jsonwith your new module details, set the type appropriately -
commit a change with your new library included.
-
submit a PR with your change
Follow a similar process for updating an existing library but do not change index.json.