From 3b3e184171fa8b224b3cfe7da257683f5193543c Mon Sep 17 00:00:00 2001 From: Sam Pinkus Date: Wed, 8 Jan 2025 16:01:51 +1000 Subject: [PATCH] Readability improvement: rename PipenvCache,PoetryCache "patterns" field to "cacheDependencyPath" to be consistent with base class and cache-factory. --- src/cache-distributions/pipenv-cache.ts | 6 +++--- src/cache-distributions/poetry-cache.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cache-distributions/pipenv-cache.ts b/src/cache-distributions/pipenv-cache.ts index 8ddcbed8..79674c20 100644 --- a/src/cache-distributions/pipenv-cache.ts +++ b/src/cache-distributions/pipenv-cache.ts @@ -8,9 +8,9 @@ import CacheDistributor from './cache-distributor'; class PipenvCache extends CacheDistributor { constructor( private pythonVersion: string, - protected patterns: string = '**/Pipfile.lock' + protected cacheDependencyPath: string = '**/Pipfile.lock' ) { - super('pipenv', patterns); + super('pipenv', cacheDependencyPath); } protected async getCacheGlobalDirectories() { @@ -31,7 +31,7 @@ class PipenvCache extends CacheDistributor { } protected async computeKeys() { - const hash = await glob.hashFiles(this.patterns); + const hash = await glob.hashFiles(this.cacheDependencyPath); const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; const restoreKey = undefined; return { diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index cd3a189b..90739dbc 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -10,16 +10,16 @@ import {logWarning} from '../utils'; class PoetryCache extends CacheDistributor { constructor( private pythonVersion: string, - protected patterns: string = '**/poetry.lock', + protected cacheDependencyPath: string = '**/poetry.lock', protected poetryProjects: Set = new Set() ) { - super('poetry', patterns); + super('poetry', cacheDependencyPath); } protected async getCacheGlobalDirectories() { // Same virtualenvs path may appear for different projects, hence we use a Set const paths = new Set(); - const globber = await glob.create(this.patterns); + const globber = await glob.create(this.cacheDependencyPath); for await (const file of globber.globGenerator()) { const basedir = path.dirname(file); @@ -45,7 +45,7 @@ class PoetryCache extends CacheDistributor { } protected async computeKeys() { - const hash = await glob.hashFiles(this.patterns); + const hash = await glob.hashFiles(this.cacheDependencyPath); // "v2" is here to invalidate old caches of this cache distributor, which were created broken: const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`; const restoreKey = undefined;