remove unused hacks

This commit is contained in:
Alif Rachmawadi
2019-08-26 10:59:10 +07:00
parent e4b52bc94d
commit 1dedc0776a
2 changed files with 4 additions and 96 deletions

View File

@@ -5,8 +5,6 @@ import * as fs from 'fs';
import * as path from 'path';
import * as restm from 'typed-rest-client/RestClient';
import * as semver from 'semver';
import uuidV4 from 'uuid/v4';
import {exec} from '@actions/exec/lib/exec';
const IS_WINDOWS = process.platform === 'win32';
const IS_DARWIN = process.platform === 'darwin';
@@ -130,58 +128,12 @@ async function extractFile(file: string, destDir: string): Promise<void> {
}
if ('tar.xz' === extName()) {
await extractTarXz(file, destDir);
await tc.extractTar(file, destDir, 'x');
} else {
if (IS_DARWIN) {
await extractZipDarwin(file, destDir);
} else {
await tc.extractZip(file, destDir);
}
await tc.extractZip(file, destDir);
}
}
/**
* Extract a tar.xz
*
* @param file path to the tar.xz
* @param dest destination directory. Optional.
* @returns path to the destination directory
*/
export async function extractTarXz(
file: string,
dest?: string
): Promise<string> {
if (!file) {
throw new Error("parameter 'file' is required");
}
dest = dest || (await _createExtractFolder(dest));
const tarPath: string = await io.which('tar', true);
await exec(`"${tarPath}"`, ['xC', dest, '-f', file]);
return dest;
}
async function _createExtractFolder(dest?: string): Promise<string> {
if (!dest) {
dest = path.join(tempDirectory, uuidV4());
}
await io.mkdirP(dest);
return dest;
}
async function extractZipDarwin(file: string, dest: string): Promise<void> {
const unzipPath = path.join(
__dirname,
'..',
'scripts',
'externals',
'unzip-darwin'
);
await exec(`"${unzipPath}"`, [file], {cwd: dest});
}
async function determineVersion(
version: string,
channel: string