Skip to content

Commit

Permalink
feat(devbox): Only install plugins if needed
Browse files Browse the repository at this point in the history
# Issue

On starting the devbox all CF plugins were installed, regardless if
already installed or not, wasting time and screenspace.

# Fix

Check if already installed (comparing the checksums) before installing.
  • Loading branch information
silvestre committed Aug 9, 2024
1 parent 4784bc6 commit c6bea0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@
},
"shell": {
"init_hook": [
"cf install-plugin -f $(which app-autoscaler-cli-plugin)",
"cf install-plugin -f $(which log-cache-cli)"
"install_plugin_if_needed() {",
" sum=$(sha1sum $(which $1) | cut -d ' ' -f 1)",
" cf plugins --checksum | grep -q $sum || cf install-plugin -f $(which $1)",
"}",
"install_plugin_if_needed 'app-autoscaler-cli-plugin'",
"install_plugin_if_needed 'log-cache-cli'"
]
}
}
1 change: 1 addition & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@
},
"ruby@latest": {
"last_modified": "2024-07-07T07:43:47Z",
"plugin_version": "0.0.2",
"resolved": "github:NixOS/nixpkgs/b60793b86201040d9dee019a05089a9150d08b5b#ruby_3_3",
"source": "devbox-search",
"version": "3.3.2",
Expand Down

0 comments on commit c6bea0f

Please sign in to comment.