From 059f2e77912b847ce8aaf832ac460319ab24e6c5 Mon Sep 17 00:00:00 2001 From: Paul Merlin Date: Sun, 14 Jun 2020 18:46:49 +0200 Subject: [PATCH] Rename cache.ts to cache-wrapper.ts --- __tests__/{cache.test.ts => cache-wrapper.test.ts} | 10 +++++----- src/{cache.ts => cache-wrapper.ts} | 0 src/main.ts | 6 +++--- src/post.ts | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) rename __tests__/{cache.test.ts => cache-wrapper.test.ts} (74%) rename src/{cache.ts => cache-wrapper.ts} (100%) diff --git a/__tests__/cache.test.ts b/__tests__/cache-wrapper.test.ts similarity index 74% rename from __tests__/cache.test.ts rename to __tests__/cache-wrapper.test.ts index 54343f5..77bde7a 100644 --- a/__tests__/cache.test.ts +++ b/__tests__/cache-wrapper.test.ts @@ -1,10 +1,10 @@ -import * as cache from '../src/cache' +import * as cacheWrapper from '../src/cache-wrapper' import * as path from 'path' describe('cache', () => { describe('can extract gradle wrapper slug', () => { it('from wrapper properties file', async () => { - const version = cache.extractGradleWrapperSlugFrom( + const version = cacheWrapper.extractGradleWrapperSlugFrom( path.resolve( '__tests__/data/basic/gradle/wrapper/gradle-wrapper.properties' ) @@ -12,19 +12,19 @@ describe('cache', () => { expect(version).toBe('6.5-bin') }) it('for -bin dist', async () => { - const version = cache.extractGradleWrapperSlugFromDistUri( + const version = cacheWrapper.extractGradleWrapperSlugFromDistUri( 'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-bin.zip' ) expect(version).toBe('6.5-bin') }) it('for -all dist', async () => { - const version = cache.extractGradleWrapperSlugFromDistUri( + const version = cacheWrapper.extractGradleWrapperSlugFromDistUri( 'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.5-all.zip' ) expect(version).toBe('6.5-all') }) it('for milestone', async () => { - const version = cache.extractGradleWrapperSlugFromDistUri( + const version = cacheWrapper.extractGradleWrapperSlugFromDistUri( 'distributionUrl=https\\://services.gradle.org/distributions/gradle-6.6-milestone-1-all.zip' ) expect(version).toBe('6.6-milestone-1-all') diff --git a/src/cache.ts b/src/cache-wrapper.ts similarity index 100% rename from src/cache.ts rename to src/cache-wrapper.ts diff --git a/src/main.ts b/src/main.ts index 1afc35f..53ecd90 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,7 +2,7 @@ import * as core from '@actions/core' import * as path from 'path' import {parseArgsStringToArgv} from 'string-argv' -import * as cache from './cache' +import * as cacheWrapper from './cache-wrapper' import * as execution from './execution' import * as gradlew from './gradlew' import * as provision from './provision' @@ -41,7 +41,7 @@ async function resolveGradleExecutable(baseDirectory: string): Promise { const gradleExecutable = inputOrNull('gradle-executable') if (gradleExecutable !== null) { if (gradleExecutable.endsWith(gradlew.wrapperFilename())) { - await cache.restoreCachedWrapperDist( + await cacheWrapper.restoreCachedWrapperDist( path.resolve(gradleExecutable, '..') ) } @@ -54,7 +54,7 @@ async function resolveGradleExecutable(baseDirectory: string): Promise { ? path.join(baseDirectory, wrapperDirectory) : baseDirectory - await cache.restoreCachedWrapperDist(gradlewDirectory) + await cacheWrapper.restoreCachedWrapperDist(gradlewDirectory) return path.resolve(gradlewDirectory, gradlew.wrapperFilename()) } diff --git a/src/post.ts b/src/post.ts index bc3dfc2..10da840 100644 --- a/src/post.ts +++ b/src/post.ts @@ -1,8 +1,8 @@ -import * as cache from './cache' +import * as cacheWrapper from './cache-wrapper' // Invoked by GitHub Actions export async function run(): Promise { - await cache.cacheWrapperDist() + await cacheWrapper.cacheWrapperDist() } run()