Skip to content

Commit

Permalink
AL: add workdir fix
Browse files Browse the repository at this point in the history
  • Loading branch information
adalundhe committed Feb 18, 2024
1 parent 1378ee9 commit d55b44f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
4 changes: 3 additions & 1 deletion resources/golang/.envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if [[ -e "$HOME/go.mod" ]]; then
WORKDIR_PATH=${WORKDIR_PATH:-"$HOME"}

if [[ -e "$WORKDIR_PATH/go.mod" ]]; then
go mod tidy
else
echo "Ready to go!"
Expand Down
4 changes: 3 additions & 1 deletion resources/node/.envrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
if [[ -e "$HOME/package.json" ]]; then
WORKDIR_PATH=${WORKDIR_PATH:-"$HOME"}

if [[ -e "$WORKDIR_PATH/package.json" ]]; then
pnpm install
else
echo "Ready to go!"
Expand Down
6 changes: 4 additions & 2 deletions resources/php/.envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
if [[ -e "$HOME/composer.json" && ! -e "$HOME/composer.lock" ]]; then
WORKDIR_PATH=${WORKDIR_PATH:-"$HOME"}

if [[ -e "$WORKDIR_PATH/composer.json" && ! -e "$WORKDIR_PATH/composer.lock" ]]; then
php composer.phar update
elif [[ -e "$HOME/compose.lock" ]]; then
elif [[ -e "$WORKDIR_PATH/compose.lock" ]]; then
php composer.phar install
else
echo "Ready to go!"
Expand Down
12 changes: 7 additions & 5 deletions resources/python/.envrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
if [[ -e "$HOME/poetry.lock" && -e "$HOME/pyproject.toml" ]]; then
WORKDIR_PATH=${WORKDIR_PATH:-"$HOME"}

if [[ -e "$WORKDIR_PATH/poetry.lock" && -e "$WORKDIR_PATH/pyproject.toml" ]]; then
poetry lock \
&& poetry install \
&& poetry shell

elif [[ -e "$HOME/requirements.txt" ]]; then
python -m venv "$HOME/.venv "&& \
source "$HOME/.venv/bin/activate" && \
pip install -r "$HOME/requirements.txt"
elif [[ -e "$WORKDIR_PATH/requirements.txt" ]]; then
python -m venv "$WORKDIR_PATH/.venv "&& \
source "$WORKDIR_PATH/.venv/bin/activate" && \
pip install -r "$WORKDIR_PATH/requirements.txt"
else
echo "Ready to go!"
fi
9 changes: 6 additions & 3 deletions resources/rust/.envrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
if [[ ! -e "$HOME/.cargo" ]]; then
WORKDIR_PATH=${WORKDIR_PATH:-"$HOME"}


if [[ ! -e "$WORKDIR_PATH/.cargo" ]]; then
echo "Rust not found! Installing rust for $USER"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "Rust installed! Let's go!"
else
echo "Rust install found!"
fi

if [[ -e "$HOME/Cargo.toml" ]]; then
cargo install --path $HOME
if [[ -e "$WORKDIR_PATH/Cargo.toml" ]]; then
cargo install --path $WORKDIR_PATH
else
echo "Ready to go!"
fi

0 comments on commit d55b44f

Please sign in to comment.