Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function acquireRWindows(version: string): Promise {
let fileName: string = getFileNameWindows(version);
let downloadUrl: string = getDownloadUrlWindows(version);
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
await io.mv(downloadPath, path.join(tempDirectory, fileName));
} catch (error) {
core.debug(error);
throw `Failed to download version ${version}: ${error}`;
}
//
// Install
//
let extPath: string = tempDirectory;
if (!extPath) {
throw new Error("Temp directory not set");
}
try {
await exec.exec(path.join(tempDirectory, fileName), [
} catch (error) {
throw `Failed to install texinfo package: ${error}`;
}
}
const fileName = "install-unx.sh";
const downloadUrl = "https://yihui.name/gh/tinytex/tools/install-unx.sh";
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
} catch (error) {
throw `Failed to download TinyTex: ${error}`;
}
await io.mv(downloadPath, path.join(tempDirectory, fileName));
await exec.exec("sh", [path.join(tempDirectory, fileName)]);
let binPath: string;
// The binaries are in TinyTeX/bin/*/, where the wildcard is the
// architecture, but we should always take the first one.
if (IS_MAC) {
binPath = path.join(process.env["HOME"] || "/", "Library/TinyTeX/bin");
} else {
binPath = path.join(process.env["HOME"] || "/", ".TinyTeX/bin");
}
const arch = fs.readdirSync(binPath)[0];
core.addPath(path.join(binPath, arch));
async function acquireRUbuntu(version: string): Promise {
//
// Download - a tool installer intimately knows how to get the tool (and construct urls)
//
let fileName: string = getFileNameUbuntu(version);
let downloadUrl: string = getDownloadUrlUbuntu(fileName);
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
await io.mv(downloadPath, path.join(tempDirectory, fileName));
} catch (error) {
core.debug(error);
throw `Failed to download version ${version}: ${error}`;
}
//
// Install
//
let extPath: string = tempDirectory;
if (!extPath) {
throw new Error("Temp directory not set");
}
try {
await exec.exec("sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq");
export async function downloadMinikube(version: string) {
let url: string = getDownloadUrl(version);
console.info('Downloading Minikube from ' + url);
let downloadPath: string | null = null;
downloadPath = await tc.downloadTool(url);
const binPath: string = '/home/runner/bin';
await io.mkdirP(binPath);
await exec.exec('chmod', ['+x', downloadPath]);
await io.mv(downloadPath, path.join(binPath, 'minikube'));
core.addPath(binPath);
}
async function installTinyTexWindows() {
const fileName = "install-windows.bat";
const downloadUrl = "https://yihui.name/gh/tinytex/tools/install-windows.bat";
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
} catch (error) {
throw `Failed to download TinyTex: ${error}`;
}
await io.mv(downloadPath, path.join(tempDirectory, fileName));
exec.exec(path.join(tempDirectory, fileName));
core.addPath(
path.join(process.env["APPDATA"] || "C:\\", "TinyTeX", "bin", "win32")
);
}
);
const clojureLibDir = path.join(libDir, 'clojure');
const clojureLibexecDir = path.join(clojureLibDir, 'libexec');
await tc.extractTar(file, destinationFolder);
const sourceDir = path.join(destinationFolder, 'clojure-tools');
await io.mkdirP(binDir);
await io.mkdirP(manDir);
await io.mkdirP(clojureLibexecDir);
await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
let downloadedJar: string = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
await io.mv(
path.join(sourceDir, downloadedJar),
clojureLibexecDir
);
await readWriteAsync(
path.join(sourceDir, 'clojure'),
'"$CLOJURE_INSTALL_DIR"'
);
await io.mv(path.join(sourceDir, 'clj'), binDir);
await io.mv(path.join(sourceDir, 'clojure'), binDir);
await io.mv(path.join(sourceDir, 'clojure.1'), manDir);
await io.mv(path.join(sourceDir, 'clj.1'), manDir);
return path.join(destinationFolder, 'clojure');
} else {
throw new Error(`Not a file`);
}
const fileName = util.format("pandoc-%s-macOS.pkg", version);
const downloadUrl = util.format(
"https://github.com/jgm/pandoc/releases/download/%s/%s",
version,
fileName
);
let downloadPath: string | null = null;
try {
downloadPath = await tc.downloadTool(downloadUrl);
} catch (error) {
throw `Failed to download Pandoc ${version}: ${error}`;
}
await io.mv(downloadPath, path.join(tempDirectory, fileName));
exec.exec("sudo installer", [
"-pkg",
path.join(tempDirectory, fileName),
"-target",
"/"
]);
}
await io.mkdirP(manDir);
await io.mkdirP(clojureLibexecDir);
await io.mv(path.join(sourceDir, 'deps.edn'), clojureLibDir);
await io.mv(path.join(sourceDir, 'example-deps.edn'), clojureLibDir);
let downloadedJar: string = fs.readdirSync(sourceDir).filter(file => file.endsWith('jar'))[0];
await io.mv(
path.join(sourceDir, downloadedJar),
clojureLibexecDir
);
await readWriteAsync(
path.join(sourceDir, 'clojure'),
'"$CLOJURE_INSTALL_DIR"'
);
await io.mv(path.join(sourceDir, 'clj'), binDir);
await io.mv(path.join(sourceDir, 'clojure'), binDir);
await io.mv(path.join(sourceDir, 'clojure.1'), manDir);
await io.mv(path.join(sourceDir, 'clj.1'), manDir);
return path.join(destinationFolder, 'clojure');
} else {
throw new Error(`Not a file`);
}
}