New J.U.S.T.
- new_just
Create a new just project
There are many moving pieces to set up a working just project and use all the features. Just getting started is hard, without knowing where to start. This script will create all the files necessary to have a new docker compose based just project up and running.
Usage
By default, new_just
will prompt the user for questions on the initial
setup parameters. Default values are supplied for all questions, and enter
can be pressed to accept all the defaults. All of the questions can be set
using environment variables, making them scriptable.
After new_just
is called, a few git commands need to be called. This is not
done for you, in case it will break your existing repository. These
commands are printed out on stdout, while everything else is printed on
stderr, making them scriptable.
If any of the files written to exist, they are not overwritten, and a warning message is printed out.
See also
new_just new_just PROJECT_DIR
, new_just new_just PROJECT_NAME
, new_just new_just PROJECT_PREFIX
new_just new_just REPO_NAME
, new_just new_just JUSTFILE
, new_just new_just SETUPFILE
new_just new_just VSI_DIR
- docker_add_quote_escape
Escapes arbitrary filename for Dockerfile
ADD ["filename", "dest"]
syntax, not including outer "
- Arguments:
$1
- Filename to be escaped
- docker_env_quote_escape
Escapes arbitrary value for Dockerfile
ENV var="value"
syntax, not including outer "
- Arguments:
$1
- Value to be escaped
- new_just
The main new_just function. The script to be in a function, or else streaming curl
to bash won’t work.
- PROJECT_DIR
The project directory is typically the root directory of the main git repository. This is where all the just files will be stored by default.
The value can be customized when prompted by new_just
. The default value
is the current working directory. The question can be skipped by setting
the environment variable PROJECT_DIR
to the desired value.
- PROJECT_NAME
The PROJECT_NAME
is used to set the project environment file name used by
just_functions.bsh source_environment_files
. Specifically: ${PROJECT_DIR}/${PROJECT_NAME}.env
PROJECT_NAME
is also used for for determining other default values.
The value can be customized when prompted by new_just
. The default value
is basename of the PROJECT_DIR
. The question can be skipped by setting the
environment variable PROJECT_NAME
to the desired value.
- PROJECT_PREFIX
The prefix of environment variables for this project
Used to set the value of JUST_PROJECT_PREFIX
. Must contain only valid bash
variable-name characters: [A-Z0-9_]+
Does not need the trailing _ included, this will always be added when it is used.
The value can be customized when prompted by new_just. The default value is
uppercase of the PROJECT_NAME
. The question can be skipped by setting the
environment variable PROJECT_PREFIX
to the desired value.
See also
- JUSTFILE
Name of the justfile used
The default just file in just is “Justfile”. If this is changed, the only
way to inform just of this is by setting it in the SETUPFILE
. This will be
added to the SETUPFILE
by new_just
if anything other than the default is
used.
The value can be customized when prompted by new_just
. The default value
is Justfile
. The question can be skipped by setting the environment variable
JUSTFILE
to the desired value.
See also
SETUPFILE
, just/Justfile
- USE_VSI_COMMON
Flag to include vsi_common
vsi_common can either be included as a submodule, in which case setup.env is needed, or the just executable needs to be installed and vsi_common is not needed.
- SETUPFILE
Name of the setup file sourced to setup just environment
The setup file is used to make the minimal necessary changes to the environment so that just works. This includes adding paths and setting a few environment variables. This is meant to be as unobtrusive as possible.
This file needs to be sourced every time a new terminal session is opened. The only time the setup script is not needed is when using juste.
The value can be customized when prompted by new_just
. The default value is
setup.env
. The question can be skipped by setting the environment variable
SETUPFILE
to the desired value.
See also
juste
- VSI_DIR
Location of the vsi_common submodule
The vsi_common repository is necessary for virtually all of the just capabilities. The correct way to deal with this is to add vsi_common as a submodule for your main project. This tells just were this submodule is located.
The value can be customized when prompted by new_just
. The default value is
external/vsi_common. The question can be skipped by setting the environment
variable VSI_DIR
to the desired value.
Docker Stuff
- USE_DOCKER
Flag to turn on all the docker features
- USE_PIP_TOOLS
Flag to turn on setting up pip-tools
- APP_NAME
The name of the test app generated. Used for the name of the first service populated for you.
- REPO_NAME
When docker images are built, they need to be named, or else the only way to access them is inconveniently though sha256 checksums.
The REPO_NAME
should be an untagged docker repository name. Tag names will
be added for each service. Docker image names must match the regex
[a-zA-Z0-9][a-zA-Z0-9_.-]*
or else docker will error
The value can be customized when prompted by new_just
. The default value is
lowercase of the PROJECT_NAME
. The question can be skipped by setting the
environment variable REPO_NAME
to the desired value.
- PYTHON_PACKAGE
Name of the default python package created
- USE_TUTORIAL
Flag to turn on tutorial comments