Skip to content

Commit

Permalink
Merge pull request #2 from subosito/tool-cache-110
Browse files Browse the repository at this point in the history
tool-cache 1.1.0
  • Loading branch information
subosito committed Aug 26, 2019
2 parents 9267b2d + 1dedc07 commit 8f119fb
Show file tree
Hide file tree
Showing 12 changed files with 690 additions and 780 deletions.
48 changes: 2 additions & 46 deletions lib/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const io = __importStar(require("@actions/io"));
Expand All @@ -25,8 +22,6 @@ const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const restm = __importStar(require("typed-rest-client/RestClient"));
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_DARWIN = process.platform === 'darwin';
const IS_LINUX = process.platform === 'linux';
Expand Down Expand Up @@ -122,50 +117,11 @@ function extractFile(file, destDir) {
throw new Error(`Failed to extract ${file} - it is a directory`);
}
if ('tar.xz' === extName()) {
yield extractTarXz(file, destDir);
yield tc.extractTar(file, destDir, 'x');
}
else {
if (IS_DARWIN) {
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 tc.extractZip(file, destDir);
}
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) {
Expand Down
7 changes: 0 additions & 7 deletions node_modules/@actions/tool-cache/LICENSE.md

This file was deleted.

164 changes: 82 additions & 82 deletions node_modules/@actions/tool-cache/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8f119fb

Please sign in to comment.