add logging
This commit is contained in:
parent
ee563bb987
commit
49973291c4
3 changed files with 53 additions and 7 deletions
15
README.org
15
README.org
|
|
@ -10,14 +10,19 @@
|
|||
|
||||
** node_environment
|
||||
|
||||
1. Create a directory =.npm=
|
||||
2. If the file =global_packages.txt= is present, install the packages via *npm* globally in the =.npm= directory
|
||||
3. Run ~npm install~ if a file =package.json= is present
|
||||
4. Add the =.npm= directory to the ~$PATH~ variable
|
||||
1. Create a directory =.npm/bin= if not existent
|
||||
2. Add the =.npm/bin= directory to the ~$PATH~ variable
|
||||
3. Upgrade npm to the latest version
|
||||
4. If the file =global_packages.txt= is present, install the packages via npm into the =.npm= directory
|
||||
5. Run ~npm install~ if a file =package.json= is present
|
||||
|
||||
** python_environment
|
||||
|
||||
1. Create a new python virtualenv in the folder =.venv=
|
||||
1. Create a new python virtualenv in the folder =.venv= if not existent
|
||||
2. Source the virtual environment
|
||||
3. Upgrade pip to the latest version
|
||||
4. If present, install the packages from the file =requirements.txt= via pip
|
||||
|
||||
** rust_environment
|
||||
|
||||
1. Run ~cargo build~ if =Cargo.toml= is present
|
||||
|
|
|
|||
|
|
@ -5,13 +5,35 @@ pkgs.mkShell {
|
|||
nodejs
|
||||
];
|
||||
shellHook = ''
|
||||
mkdir -p .npm
|
||||
function log_header {
|
||||
echo -ne "==> \e[32m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log_subheader {
|
||||
echo -ne "--> \e[33m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log {
|
||||
echo -ne " $1\n"
|
||||
}
|
||||
|
||||
echo ""
|
||||
log_header "node_environment"
|
||||
mkdir -p .npm/bin
|
||||
export PATH=$PWD/.npm/bin:$PATH
|
||||
log_subheader "upgrading npm"
|
||||
npm install -g npm --prefix $PWD/.npm
|
||||
echo ""
|
||||
if [ -s global_packages.txt ]; then
|
||||
log_subheader "found global_packages.txt, installing packages"
|
||||
cat global_packages.txt | xargs npm install -g --prefix $PWD/.npm
|
||||
echo ""
|
||||
fi
|
||||
if [ -s package.json ]; then
|
||||
log_subheader "found package.json, running 'npm install'"
|
||||
npm install
|
||||
echo ""
|
||||
fi
|
||||
export PATH=$PWD/.npm/bin:$PATH
|
||||
log_header "package versions"
|
||||
log "node $(node --version)"
|
||||
log "npm $(npm --version)"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,32 @@ pkgs.mkShell {
|
|||
python3Packages.virtualenv
|
||||
];
|
||||
shellHook = ''
|
||||
function log_header {
|
||||
echo -ne "==> \e[32m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log_subheader {
|
||||
echo -ne "--> \e[33m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log {
|
||||
echo -ne " $1\n"
|
||||
}
|
||||
|
||||
echo ""
|
||||
log_header "python_environment"
|
||||
if [ ! -d .venv ]; then
|
||||
python -m venv .venv
|
||||
fi
|
||||
source .venv/bin/activate
|
||||
log_subheader "upgrading pip"
|
||||
pip install --upgrade pip
|
||||
echo ""
|
||||
if [ -s requirements.txt ]; then
|
||||
log_subheader "found requirements.txt, installing packages"
|
||||
pip install -r requirements.txt
|
||||
echo ""
|
||||
fi
|
||||
log_header "package versions"
|
||||
log "$(python --version)"
|
||||
log "$(pip --version)"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue