Skip to content

Commit 1f3a570

Browse files
committed
Readability improvement: rename PipenvCache,PoetryCache "patterns" field to "cacheDependencyPath" to be consistent with base class and cache-factory.
1 parent 6ca8e85 commit 1f3a570

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/cache-distributions/pipenv-cache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import CacheDistributor from './cache-distributor';
88
class PipenvCache extends CacheDistributor {
99
constructor(
1010
private pythonVersion: string,
11-
protected patterns: string = '**/Pipfile.lock'
11+
protected cacheDependencyPath: string = '**/Pipfile.lock'
1212
) {
13-
super('pipenv', patterns);
13+
super('pipenv', cacheDependencyPath);
1414
}
1515

1616
protected async getCacheGlobalDirectories() {
@@ -31,7 +31,7 @@ class PipenvCache extends CacheDistributor {
3131
}
3232

3333
protected async computeKeys() {
34-
const hash = await glob.hashFiles(this.patterns);
34+
const hash = await glob.hashFiles(this.cacheDependencyPath);
3535
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
3636
const restoreKey = undefined;
3737
return {

src/cache-distributions/poetry-cache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ import {logWarning} from '../utils';
1010
class PoetryCache extends CacheDistributor {
1111
constructor(
1212
private pythonVersion: string,
13-
protected patterns: string = '**/poetry.lock',
13+
protected cacheDependencyPath: string = '**/poetry.lock',
1414
protected poetryProjects: Set<string> = new Set<string>()
1515
) {
16-
super('poetry', patterns);
16+
super('poetry', cacheDependencyPath);
1717
}
1818

1919
protected async getCacheGlobalDirectories() {
2020
// Same virtualenvs path may appear for different projects, hence we use a Set
2121
const paths = new Set<string>();
22-
const globber = await glob.create(this.patterns);
22+
const globber = await glob.create(this.cacheDependencyPath);
2323

2424
for await (const file of globber.globGenerator()) {
2525
const basedir = path.dirname(file);
@@ -45,7 +45,7 @@ class PoetryCache extends CacheDistributor {
4545
}
4646

4747
protected async computeKeys() {
48-
const hash = await glob.hashFiles(this.patterns);
48+
const hash = await glob.hashFiles(this.cacheDependencyPath);
4949
// "v2" is here to invalidate old caches of this cache distributor, which were created broken:
5050
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`;
5151
const restoreKey = undefined;

0 commit comments

Comments
 (0)