Skip to content

Checkouts and their Environments

Max edited this page Apr 6, 2016 · 2 revisions

Checkouts

A checkout is a folder within your workspace folder that contains a git repository. Each one has two major features:

  • The name, which is the name of the folder it resides in. This is used to select the checkout using the use command.
  • The type, which is the name of the remote git repository, without forks. For example, the repo at https://github.com/github/scripts-to-rule-them-all has type 'scripts-to-rule-them-all'. The ZENv repo type is just zenv.

ZENv allows you to create different environments for each checkout type. This means that multiple checkouts of the same repository will have the same environment.

Swapping between checkouts

When a developer starts using ZENv, he or she only has the default global environment available (that you set up in Custom Developer Setup). If the dev wants access to a specific set of tools and settings having to do with one project, he or she can run the use command, which will load the sub-environment.

For example:

cd "$ZENV_WORKSPACE"  # This is the dev's answer to 'where do you put your code?' in global setup
git clone https://github.com/github/scripts-to-rule-them-all example
use example

A Checkout's Environment

Properties

When you use a checkout for the first time, ZENv will create a properties file in that checkout's folder named work.properties, using the properties/<checkout type>.work.properties file as the template and asking questions to fill in values.

Sound familiar? It's the same process you used during Custom Developer Setup with different files.

When a developer switches their current checkout using the use command, the work.properties file will execute in their environment, updating their set of environment variables.

First-time setup

After the work.properties file is created, the checkout will run a first-time setup script, just like what happens with the global environment. This script lives in setupscripts/<checkout type>.setup.sh.

Paths

When a developer switches checkouts, the $PATH variable is modified. Each checkout has access to its own private set of tools, contained in bin/<checkout_type>/, in addition to the ones that are in bin. To create project-specific tools, just add them to the subfolder named after your checkout's type.

Clone this wiki locally