Skip to content

Commit

Permalink
Refactor devcontainer setup and enhance installation script
Browse files Browse the repository at this point in the history
- Updated the postCreateCommand in .devcontainer/devcontainer.json to remove the SSH permissions command for a cleaner setup process.
- Enhanced the install-task.sh script to include debug mode, create the ~/.local/bin directory, and ensure it is added to the PATH, improving usability and installation verification for the Task command.
  • Loading branch information
jonesrussell committed Dec 23, 2024
1 parent 25ee8ca commit 7777516
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
5 changes: 1 addition & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
],

"postCreateCommand": "chmod +x scripts/setup/* && scripts/setup/install-gems.sh && scripts/setup/install-task.sh && chmod 600 /home/vscode/.ssh/*",
"postCreateCommand": "chmod +x scripts/setup/* && scripts/setup/install-gems.sh && scripts/setup/install-task.sh",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
Expand All @@ -53,9 +53,6 @@
"version": "latest",
"dotnetVersion": "latest"
},
"ghcr.io/devcontainers/features/ruby:1": {
"version": "latest"
},
"ghcr.io/itsmechlark/features/act:1": {
"version": "latest"
},
Expand Down
19 changes: 19 additions & 0 deletions scripts/setup/install-task.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
#!/bin/bash
set -x # Enable debug mode to print commands as they execute

echo "Creating ~/.local/bin directory if it doesn't exist..."
sudo mkdir -p ~/.local/bin
sudo chown vscode:vscode ~/.local/bin
sudo chmod 755 ~/.local/bin

echo "Installing Task..."
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin

echo "Checking if ~/.local/bin is in PATH..."
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
echo "Adding ~/.local/bin to PATH in ~/.zshrc"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"
fi

echo "Verifying task installation..."
which task || echo "Task not found in PATH"
task --version || echo "Task command not working"

0 comments on commit 7777516

Please sign in to comment.