remove unused hacks
This commit is contained in:
@@ -14,9 +14,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
result["default"] = mod;
|
result["default"] = mod;
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const io = __importStar(require("@actions/io"));
|
const io = __importStar(require("@actions/io"));
|
||||||
@@ -25,8 +22,6 @@ const fs = __importStar(require("fs"));
|
|||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const restm = __importStar(require("typed-rest-client/RestClient"));
|
const restm = __importStar(require("typed-rest-client/RestClient"));
|
||||||
const semver = __importStar(require("semver"));
|
const semver = __importStar(require("semver"));
|
||||||
const v4_1 = __importDefault(require("uuid/v4"));
|
|
||||||
const exec_1 = require("@actions/exec/lib/exec");
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const IS_DARWIN = process.platform === 'darwin';
|
const IS_DARWIN = process.platform === 'darwin';
|
||||||
const IS_LINUX = process.platform === 'linux';
|
const IS_LINUX = process.platform === 'linux';
|
||||||
@@ -122,52 +117,13 @@ function extractFile(file, destDir) {
|
|||||||
throw new Error(`Failed to extract ${file} - it is a directory`);
|
throw new Error(`Failed to extract ${file} - it is a directory`);
|
||||||
}
|
}
|
||||||
if ('tar.xz' === extName()) {
|
if ('tar.xz' === extName()) {
|
||||||
yield extractTarXz(file, destDir);
|
yield tc.extractTar(file, destDir, 'x');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (IS_DARWIN) {
|
yield tc.extractZip(file, destDir);
|
||||||
yield extractZipDarwin(file, destDir);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield 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
|
|
||||||
*/
|
|
||||||
function extractTarXz(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!file) {
|
|
||||||
throw new Error("parameter 'file' is required");
|
|
||||||
}
|
|
||||||
dest = dest || (yield _createExtractFolder(dest));
|
|
||||||
const tarPath = yield io.which('tar', true);
|
|
||||||
yield exec_1.exec(`"${tarPath}"`, ['xC', dest, '-f', file]);
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.extractTarXz = extractTarXz;
|
|
||||||
function _createExtractFolder(dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!dest) {
|
|
||||||
dest = path.join(tempDirectory, v4_1.default());
|
|
||||||
}
|
|
||||||
yield io.mkdirP(dest);
|
|
||||||
return dest;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function extractZipDarwin(file, dest) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
|
||||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function determineVersion(version, channel) {
|
function determineVersion(version, channel) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (version.endsWith('.x') || version === '') {
|
if (version.endsWith('.x') || version === '') {
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import * as fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as restm from 'typed-rest-client/RestClient';
|
import * as restm from 'typed-rest-client/RestClient';
|
||||||
import * as semver from 'semver';
|
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_WINDOWS = process.platform === 'win32';
|
||||||
const IS_DARWIN = process.platform === 'darwin';
|
const IS_DARWIN = process.platform === 'darwin';
|
||||||
@@ -130,58 +128,12 @@ async function extractFile(file: string, destDir: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('tar.xz' === extName()) {
|
if ('tar.xz' === extName()) {
|
||||||
await extractTarXz(file, destDir);
|
await tc.extractTar(file, destDir, 'x');
|
||||||
} else {
|
} else {
|
||||||
if (IS_DARWIN) {
|
await tc.extractZip(file, destDir);
|
||||||
await extractZipDarwin(file, destDir);
|
|
||||||
} else {
|
|
||||||
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(
|
async function determineVersion(
|
||||||
version: string,
|
version: string,
|
||||||
channel: string
|
channel: string
|
||||||
|
|||||||
Reference in New Issue
Block a user