Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions init-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ show_help() {
echo " --help/-h: Show this help message."
}

initialize_r() {
initialise_r() {
if [ "$FORCE" = true ] || [ ! -f "renv.lock" ]; then
Rscript -e 'renv::init(bare = FALSE)'
Rscript -e 'renv::install("rmarkdown")'
Rscript -e 'renv::snapshot(type = "all")'
fi
}

initialize_python() {
initialise_python() {
if [ "$FORCE" = true ] || [ ! -f "requirements.txt" ]; then
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install jupyter
python3 -m pip install jupyter papermill
python3 -m pip freeze > requirements.txt
fi
}

initialize_julia() {
initialise_julia() {
if [ "$FORCE" = true ] || [ ! -f "Project.toml" ]; then
julia -e 'using Pkg; Pkg.activate("."); Pkg.instantiate()'
julia --project=. -e 'using Pkg; Pkg.add("IJulia")'
Expand Down Expand Up @@ -62,18 +62,18 @@ done

case $WHAT in
all)
initialize_r
initialize_python
initialize_julia
initialise_r
initialise_python
initialise_julia
;;
r)
initialize_r
initialise_r
;;
python)
initialize_python
initialise_python
;;
julia)
initialize_julia
initialise_julia
;;
*)
echo "Unknown option for --what: $WHAT"
Expand Down