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

Fix caching for shared configs using templated paths #91

Closed noizwaves closed 7 months ago

noizwaves commented 7 months ago

Problem

I noticed shared checks that leverage check.paths were always running.

When make_absolute was added previously, one usage of format!("{}/{}", base_dir.display(), glob_str) was left in the code. As a result, these paths were silently excluded from the cache:

{
  "checksums": {
    "dev-database": {
      "/Users/adam.neumann/workspace/hawaiian-ice/db/structure.sql": "abc123"
    }
  }
}

Solution

Use make_absolute everywhere! After doing this, cache is populated as expected:

{
  "checksums": {
    "brewfile": {
      "/Users/adam.neumann/workspace/hawaiian-ice/Brewfile": "abc123"
    },
    "bundle-install": {
      "/Users/adam.neumann/workspace/hawaiian-ice/.ruby-version": "abc123",
      "/Users/adam.neumann/workspace/hawaiian-ice/Gemfile": "abc123",
      "/Users/adam.neumann/workspace/hawaiian-ice/Gemfile.lock": "abc123"
    },
    "dev-database": {
      "/Users/adam.neumann/workspace/hawaiian-ice/db/structure.sql": "abc123"
    },
    "yarn-install": {
      "/Users/adam.neumann/workspace/hawaiian-ice/package.json": "abc123",
      "/Users/adam.neumann/workspace/hawaiian-ice/yarn.lock": "abc123"
    }
  }
}