Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mustard-mh committed Jan 10, 2025
1 parent 25a0204 commit 76c0d05
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions components/ide/jetbrains/toolbox/README.md
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@ Provides a way to connect to Gitpod Classic workspaces within the JetBrains Tool

## How to Develop with Gitpod Flex

- Start an environment on [Gitpod Flex](https://app.gitpod.io) with current repository
- Connect to the environment via **JetBrains Gateway** (because we want to restart Toolbox) SSH feature (user: gitpod_devcontainer)
- Copy flex-sync.sh locally and chmod +x
- Copy flex-sync.sh locally and chmod +x, the script is written for macOS, please adjust it if you're using other OS
- Exec `./flex-sync.sh <env_host>`

```sh
@@ -22,28 +23,37 @@ LOCAL_DIR="$HOME/Library/Caches/JetBrains/Toolbox/plugins"
REMOTE_DIR="/workspace/gitpod/components/ide/jetbrains/toolbox/build/flex"
DEVCONTAINER_HOST="gitpod_devcontainer@$REMOTE_HOST"

ssh $DEVCONTAINER_HOST "apt-get update && apt-get install -y rsync inotify-tools"
echo "Preparing..."

echo "Watching for changes in $DEVCONTAINER_HOST:$REMOTE_DIR"
ssh $DEVCONTAINER_HOST "apt-get update && apt-get install -y rsync inotify-tools" > /dev/null

ssh $DEVCONTAINER_HOST "inotifywait -m -r -e modify,create,delete,move $REMOTE_DIR" | \
while read path action file; do
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Change detected: $action $file"
# Make sure remote is build
sleep 3
function sync_and_restart() {
rsync -avz --delete "$DEVCONTAINER_HOST:$REMOTE_DIR/" "$LOCAL_DIR/"

echo "[$(date '+%Y-%m-%d %H:%M:%S')] Change synced"
pkill -f 'JetBrains Toolbox' || true
echo debugClean > $HOME/Library/Logs/JetBrains/Toolbox/toolbox.log
code $HOME/Library/Logs/JetBrains/Toolbox/toolbox.log
# In case Toolbox refuses to start
echo "Restarting Toolbox in 3 seconds"
sleep 3
open /Applications/JetBrains\ Toolbox.app
}

echo "Initing..."

sync_and_restart

echo "Watching for changes in $DEVCONTAINER_HOST:$REMOTE_DIR"

ssh $DEVCONTAINER_HOST "inotifywait -m -r -e modify,create,delete,move $REMOTE_DIR" | \
while read path action file; do
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Change detected: $action $file"
# Make sure remote is build
sleep 3
sync_and_restart
done
```

## How to Develop
## How to Develop locally

### Requires
- Java 21

0 comments on commit 76c0d05

Please sign in to comment.