oscope-dev / scope

Scoping user machines
https://oscope-dev.github.io/scope/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Skip fix if cache is successful (not if failure) #62

Closed noizwaves closed 8 months ago

noizwaves commented 8 months ago

Problem

Currently, scope doctor run seems to ignore the path cache results and always runs fixes. This can be slow, especially for some fix commands:

❯ scope doctor run
 INFO Check was successful, group: "homebrew", name: "homebrew"
 INFO Check was successful, group: "github-ssh", name: "github-ssh"
 INFO Check was successful, group: "aws-sso", name: "aws-sso"
 INFO Check was successful, group: "node-version", name: "node-version"
Installing from the API is now the default behaviour!
You can save space and time by running:
  brew untap homebrew/core
  brew untap homebrew/cask
Already up-to-date.
Using homebrew/bundle
Using homebrew/cask
Using homebrew/core
Using homebrew/services
Using gusto/gusto
Using imagemagick@6
Using postgresql@14
Using wkhtmltopdf
Using rbenv
Using ghostscript
Using redis
Using nvm
Using gusto/gusto/pdftk
Using chromedriver
Using pkg-config
Using shellcheck
Using shared-mime-info
Using libsodium
Using overmind
Using libvips
Using mupdf
Homebrew Bundle complete! 21 Brewfile dependencies now installed.
 INFO Check initially failed, fix was successful, group: "brewfile", name: "brew-bundle"
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.35s.
 INFO Check initially failed, fix was successful, group: "yarn-install", name: "yarn-install"
...

Solution

Remove the negation that maps an unsuccessful file cache result to a successful cache result. Now:

❯ ~/workspace/scope/target/debug/scope doctor run
 INFO Check was successful, group: "homebrew", name: "homebrew"
 INFO Check was successful, group: "github-ssh", name: "github-ssh"
 INFO Check was successful, group: "aws-sso", name: "aws-sso"
 INFO Check was successful, group: "node-version", name: "node-version"
 INFO Check was successful, group: "brewfile", name: "brew-bundle"
 INFO Check was successful, group: "yarn-install", name: "yarn-install"
 INFO Check was successful, group: "redis", name: "redis"
 INFO Check was successful, group: "rbenv", name: "rbenv"
 INFO Check was successful, group: "postgres", name: "postgres"
 INFO Check was successful, group: "ruby-version", name: "ruby-version"
 INFO Check was successful, group: "dev-databases", name: "dev-databases-exist"
 INFO Check was successful, group: "dev-databases", name: "dev-databases-schema"
 INFO Check was successful, group: "dev-databases", name: "dev-databases-migrations"
 INFO Check was successful, group: "bundler", name: "bundler"
 INFO Check was successful, group: "bundle-install", name: "bundle-install"