-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Developer Setup
When somebody installs ZENv for the first time, he/she must run python install.py
. That script does two important things:
- Asks the current user some questions about his/her environment, and saves the answers in
~/.zenvrc
. - Runs a one-time setup script to get the developer up and running.
By default, only one question is asked (the location of the user's code), and the setup script is empty. However, you have the option to customize both steps to your liking, allowing for an incredibly specific install.
When install.py
runs for the first time, it will ask some questions in order to get set up. The results of these questions are then stored in the ~/.zenvrc
file and loaded every time a new terminal is opened. From then on, all of your dev tools and scripts will be able to read those values.
If you want to customize what questions are asked, you can modify the global.properties
file in the properties
directory.
Imagine that we want to keep track of the name that the user uses to SSH into the company servers. We'll store this in a variable called ZENV_SSH_NAME
and access it from our build script later. We just need the user to fill in his or her name during the install.
To make this happen, we add this line to properties/global.properties
:
export ZENV_SSH_NAME=@@$(whoami)@@
This tells install.py
that we want to ask about a variable named ZENV_SSH_NAME
, with a default value of $(whoami)
. So, a user named robink would see a question like this during his install process:
Enter the value for the ZENV_SSH_NAME global variable (robink):
You can also customize the questions asked by adding comments, like so:
# your user name for the company servers
export ZENV_SSH_NAME=@@$(whoami)@@
This produces the prompt:
Enter your user name for the company servers (robink):
If the user then answered that their name was "TheRobinator", their .zenvrc
file would end up containing:
export ZENV_SSH_NAME=TheRobinator
After questions are asked, a one-time setup script is run. This is usually used to download dependencies, create directories, or otherwise make sure the developer's computer is up to speed. This script lives in setupscripts/global.setup.sh
.
For example, imagine that you've got your project running in NodeJS using a Gulp build. You might add something like this to global.setup.sh
:
# Download homebrew for Mac
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install node using brew
sudo brew install node
# Install gulp for building
npm install --global gulp-cli
This will ensure that all dependencies are installed by default, allowing your new developer to skip most of the onboarding process.