mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2024-12-27 16:41:06 +08:00
fix
This commit is contained in:
parent
348f36cadd
commit
d34f36f7b4
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@ -6,7 +6,7 @@ jobs:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
operating-system: [ubuntu-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
|
@ -1,12 +1,12 @@
|
||||
import io = require('@actions/io');
|
||||
import exec = require('@actions/exec');
|
||||
import core = require('@actions/core');
|
||||
import os = require('os');
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
|
||||
const toolDir = path.join(__dirname, 'runner', 'tools', 'leiningen');
|
||||
const tempDir = path.join(__dirname, 'runner', 'temp', 'leiningen');
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
process.env['RUNNER_TOOL_CACHE'] = toolDir;
|
||||
process.env['RUNNER_TEMP'] = tempDir;
|
||||
@ -47,14 +47,13 @@ describe('leiningen tests', () => {
|
||||
);
|
||||
|
||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||
if (IS_WINDOWS) {
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein.bat'))).toBe(
|
||||
true
|
||||
);
|
||||
await exec.exec('lein');
|
||||
} else {
|
||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'lein'))).toBe(true);
|
||||
}
|
||||
|
||||
const leinPath: string = await io.which('lein', true)
|
||||
core.debug(`Leiningen path: ${leinPath}`);
|
||||
|
||||
await exec.exec('echo $LEIN_HOME');
|
||||
await exec.exec('lein');
|
||||
}, 100000);
|
||||
|
||||
it('Uses version of leiningen installed in cache', async () => {
|
||||
|
@ -19,25 +19,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
const os = __importStar(require("os"));
|
||||
const utils = __importStar(require("./utils"));
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
}
|
||||
else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
function setup(version) {
|
||||
@ -47,39 +42,32 @@ function setup(version) {
|
||||
core.debug(`Leiningen found in cache ${toolPath}`);
|
||||
}
|
||||
else {
|
||||
let leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version}/bin/lein${IS_WINDOWS ? '.bat' : '-pkg'}`);
|
||||
let leiningenLib = yield tc.downloadTool(`https://github.com/technomancy/leiningen/releases/download/${version}/leiningen-${version}-standalone.zip`);
|
||||
let leiningenFile = yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version}/bin/lein`);
|
||||
let tempDir = path.join(tempDirectory, 'temp_' + Math.floor(Math.random() * 2000000000));
|
||||
const leiningenDir = yield installLeiningen(leiningenFile, leiningenLib, tempDir);
|
||||
const leiningenDir = yield installLeiningen(leiningenFile, tempDir);
|
||||
core.debug(`clojure tools deps installed to ${leiningenDir}`);
|
||||
toolPath = yield tc.cacheDir(leiningenDir, 'ClojureLeiningen', utils.getCacheVersionString(version));
|
||||
}
|
||||
core.exportVariable('LEIN_LIB_DIR', toolPath);
|
||||
core.exportVariable('LEIN_HOME', toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
});
|
||||
}
|
||||
exports.setup = setup;
|
||||
function installLeiningen(binScript, libFile, destinationFolder) {
|
||||
function installLeiningen(binScript, destinationFolder) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield io.mkdirP(destinationFolder);
|
||||
const bin = path.normalize(binScript);
|
||||
const lib = path.normalize(libFile);
|
||||
const binStats = fs.statSync(bin);
|
||||
const libStats = fs.statSync(lib);
|
||||
if (binStats.isFile() && libStats.isFile()) {
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'leiningen', 'bin');
|
||||
const libDir = path.join(destinationFolder, 'leiningen', 'libexec');
|
||||
yield io.mkdirP(binDir);
|
||||
yield io.mkdirP(libDir);
|
||||
yield io.mv(bin, path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`));
|
||||
fs.chmodSync(path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`), '0755');
|
||||
yield io.mv(lib, path.join(libDir, `leiningen-standalone.jar`));
|
||||
if (IS_WINDOWS) {
|
||||
yield readWriteAsync(path.join(binDir, 'lein.bat'), '!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar', '!LEIN_LIB_DIR!\libexec\leiningen-standalone.jar');
|
||||
}
|
||||
else {
|
||||
yield readWriteAsync(path.join(binDir, 'lein'), '/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar', '$LEIN_LIB_DIR/libexec/leiningen-standalone.jar');
|
||||
}
|
||||
yield io.mv(bin, path.join(binDir, `lein`));
|
||||
fs.chmodSync(path.join(binDir, `lein`), '0755');
|
||||
core.exportVariable('LEIN_HOME', path.join(destinationFolder, 'leiningen'));
|
||||
core.addPath(path.join(destinationFolder, 'leiningen', 'bin'));
|
||||
yield exec.exec('lein -h');
|
||||
return path.join(destinationFolder, 'leiningen');
|
||||
}
|
||||
else {
|
||||
|
@ -27,6 +27,9 @@ function run() {
|
||||
const Lein = core.getInput('lein');
|
||||
const Boot = core.getInput('boot');
|
||||
const Tdeps = core.getInput('tools-deps');
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Windows is not supported yet.');
|
||||
}
|
||||
if (Lein) {
|
||||
lein.setup(Lein);
|
||||
}
|
||||
@ -34,13 +37,8 @@ function run() {
|
||||
boot.setup(Boot);
|
||||
}
|
||||
if (Tdeps) {
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Windows is not supported yet');
|
||||
}
|
||||
else {
|
||||
tdeps.setup(Tdeps);
|
||||
}
|
||||
}
|
||||
if (!Boot && !Lein && !Tdeps) {
|
||||
throw new Error('You must specify at least one clojure tool.');
|
||||
}
|
||||
|
228
package-lock.json
generated
228
package-lock.json
generated
@ -545,12 +545,6 @@
|
||||
"integrity": "sha512-P57oKTJ/vYivL2BCfxCC5tQjlS8qW31pbOL6qt99Yrjm95YdHgNZwjrTTjMBh+C2/y6PXIX4oz253+jUzxKKfQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz",
|
||||
"integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/semver": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-6.0.2.tgz",
|
||||
@ -657,15 +651,6 @@
|
||||
"normalize-path": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"arr-diff": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
|
||||
@ -1016,30 +1001,6 @@
|
||||
"unset-value": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"caller-callsite": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
|
||||
"integrity": "sha1-hH4PzgoiN1CpoCfFSzNzGtMVQTQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"callsites": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"caller-path": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/caller-path/-/caller-path-2.0.0.tgz",
|
||||
"integrity": "sha1-Ro+DBE42mrIBD6xfBs7uFbsssfQ=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caller-callsite": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"callsites": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-2.0.0.tgz",
|
||||
"integrity": "sha1-BuuE8A7qQT2oav/vrL/7Ngk7PFA=",
|
||||
"dev": true
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
|
||||
@ -1192,18 +1153,6 @@
|
||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
||||
"dev": true
|
||||
},
|
||||
"cosmiconfig": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.2.1.tgz",
|
||||
"integrity": "sha512-H65gsXo1SKjf8zmrJ67eJk8aIRKV5ff2D4uKZIBZShbhGSpEmsQOPW/SKMKYhSTrqR7ufy6RP69rPogdaPh/kA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"import-fresh": "^2.0.0",
|
||||
"is-directory": "^0.3.1",
|
||||
"js-yaml": "^3.13.1",
|
||||
"parse-json": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
|
||||
@ -1467,12 +1416,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"dev": true
|
||||
},
|
||||
"estraverse": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
|
||||
@ -1709,16 +1652,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"find-up": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
|
||||
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"locate-path": "^5.0.0",
|
||||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"for-in": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
|
||||
@ -2317,12 +2250,6 @@
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"dev": true
|
||||
},
|
||||
"get-stdin": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz",
|
||||
"integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==",
|
||||
"dev": true
|
||||
},
|
||||
"get-stream": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
|
||||
@ -2486,25 +2413,6 @@
|
||||
"sshpk": "^1.7.0"
|
||||
}
|
||||
},
|
||||
"husky": {
|
||||
"version": "3.0.8",
|
||||
"resolved": "https://registry.npmjs.org/husky/-/husky-3.0.8.tgz",
|
||||
"integrity": "sha512-HFOsgcyrX3qe/rBuqyTt+P4Gxn5P0seJmr215LAZ/vnwK3jWB3r0ck7swbzGRUbufCf9w/lgHPVbF/YXQALgfQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "^2.4.2",
|
||||
"cosmiconfig": "^5.2.1",
|
||||
"execa": "^1.0.0",
|
||||
"get-stdin": "^7.0.0",
|
||||
"is-ci": "^2.0.0",
|
||||
"opencollective-postinstall": "^2.0.2",
|
||||
"pkg-dir": "^4.2.0",
|
||||
"please-upgrade-node": "^3.2.0",
|
||||
"read-pkg": "^5.1.1",
|
||||
"run-node": "^1.0.0",
|
||||
"slash": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
@ -2514,16 +2422,6 @@
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz",
|
||||
"integrity": "sha1-2BNVwVYS04bGH53dOSLUMEgipUY=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"caller-path": "^2.0.0",
|
||||
"resolve-from": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"import-local": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
|
||||
@ -2702,12 +2600,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"is-directory": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz",
|
||||
"integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=",
|
||||
"dev": true
|
||||
},
|
||||
"is-extendable": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz",
|
||||
@ -3381,16 +3273,6 @@
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true
|
||||
},
|
||||
"js-yaml": {
|
||||
"version": "3.13.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz",
|
||||
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
@ -3516,12 +3398,6 @@
|
||||
"type-check": "~0.3.2"
|
||||
}
|
||||
},
|
||||
"lines-and-columns": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz",
|
||||
"integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=",
|
||||
"dev": true
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
|
||||
@ -3534,15 +3410,6 @@
|
||||
"strip-bom": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"locate-path": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
|
||||
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-locate": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"lodash": {
|
||||
"version": "4.17.15",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
|
||||
@ -3932,12 +3799,6 @@
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"opencollective-postinstall": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz",
|
||||
"integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==",
|
||||
"dev": true
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
@ -4002,15 +3863,6 @@
|
||||
"p-try": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"p-locate": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
|
||||
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"p-limit": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"p-reduce": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
|
||||
@ -4045,12 +3897,6 @@
|
||||
"integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
|
||||
"dev": true
|
||||
},
|
||||
"path-exists": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
|
||||
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
|
||||
"dev": true
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
@ -4099,24 +3945,6 @@
|
||||
"node-modules-regexp": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"pkg-dir": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz",
|
||||
"integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"find-up": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"please-upgrade-node": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz",
|
||||
"integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"semver-compare": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"pn": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
|
||||
@ -4197,32 +4025,6 @@
|
||||
"integrity": "sha512-BXUMf9sIOPXXZWqr7+c5SeOKJykyVr2u0UDzEf4LNGc6taGkQe1A9DFD07umCIXz45RLr9oAAwZbAJ0Pkknfaw==",
|
||||
"dev": true
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
|
||||
"integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/normalize-package-data": "^2.4.0",
|
||||
"normalize-package-data": "^2.5.0",
|
||||
"parse-json": "^5.0.0",
|
||||
"type-fest": "^0.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"parse-json": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
|
||||
"integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-better-errors": "^1.0.1",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"read-pkg-up": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz",
|
||||
@ -4446,12 +4248,6 @@
|
||||
"integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==",
|
||||
"dev": true
|
||||
},
|
||||
"run-node": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/run-node/-/run-node-1.0.0.tgz",
|
||||
"integrity": "sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A==",
|
||||
"dev": true
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
@ -4501,12 +4297,6 @@
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
|
||||
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||
},
|
||||
"semver-compare": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz",
|
||||
"integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=",
|
||||
"dev": true
|
||||
},
|
||||
"set-blocking": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
|
||||
@ -4569,12 +4359,6 @@
|
||||
"integrity": "sha512-SbEG75TzH8G7eVXFSN5f9EExILKfly7SUvVY5DhhYLvfhKqhDFY0OzevWa/zwak0RLRfWS5AvfMWpd9gJvr5Yg==",
|
||||
"dev": true
|
||||
},
|
||||
"slash": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
||||
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
|
||||
"dev": true
|
||||
},
|
||||
"snapdragon": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",
|
||||
@ -4764,12 +4548,6 @@
|
||||
"extend-shallow": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||
"dev": true
|
||||
},
|
||||
"sshpk": {
|
||||
"version": "1.16.1",
|
||||
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
|
||||
@ -5075,12 +4853,6 @@
|
||||
"prelude-ls": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"type-fest": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz",
|
||||
"integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==",
|
||||
"dev": true
|
||||
},
|
||||
"typed-rest-client": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.5.0.tgz",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
@ -8,19 +9,13 @@ import * as utils from './utils';
|
||||
|
||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
if (!tempDirectory) {
|
||||
let baseLocation;
|
||||
if (IS_WINDOWS) {
|
||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||
} else {
|
||||
if (process.platform === 'darwin') {
|
||||
baseLocation = '/Users';
|
||||
} else {
|
||||
baseLocation = '/home';
|
||||
}
|
||||
}
|
||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||
}
|
||||
|
||||
@ -35,12 +30,7 @@ export async function setup(version: string): Promise<void> {
|
||||
core.debug(`Leiningen found in cache ${toolPath}`);
|
||||
} else {
|
||||
let leiningenFile = await tc.downloadTool(
|
||||
`https://raw.githubusercontent.com/technomancy/leiningen/${version}/bin/lein${
|
||||
IS_WINDOWS ? '.bat' : '-pkg'
|
||||
}`
|
||||
);
|
||||
let leiningenLib = await tc.downloadTool(
|
||||
`https://github.com/technomancy/leiningen/releases/download/${version}/leiningen-${version}-standalone.zip`
|
||||
`https://raw.githubusercontent.com/technomancy/leiningen/${version}/bin/lein`
|
||||
);
|
||||
let tempDir: string = path.join(
|
||||
tempDirectory,
|
||||
@ -48,7 +38,6 @@ export async function setup(version: string): Promise<void> {
|
||||
);
|
||||
const leiningenDir = await installLeiningen(
|
||||
leiningenFile,
|
||||
leiningenLib,
|
||||
tempDir
|
||||
);
|
||||
core.debug(`clojure tools deps installed to ${leiningenDir}`);
|
||||
@ -59,46 +48,31 @@ export async function setup(version: string): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
core.exportVariable('LEIN_LIB_DIR', toolPath);
|
||||
core.exportVariable('LEIN_HOME', toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
}
|
||||
|
||||
async function installLeiningen(
|
||||
binScript: string,
|
||||
libFile: string,
|
||||
destinationFolder: string
|
||||
): Promise<string> {
|
||||
await io.mkdirP(destinationFolder);
|
||||
|
||||
const bin = path.normalize(binScript);
|
||||
const lib = path.normalize(libFile);
|
||||
const binStats = fs.statSync(bin);
|
||||
const libStats = fs.statSync(lib);
|
||||
if (binStats.isFile() && libStats.isFile()) {
|
||||
if (binStats.isFile()) {
|
||||
const binDir = path.join(destinationFolder, 'leiningen', 'bin');
|
||||
const libDir = path.join(destinationFolder, 'leiningen', 'libexec');
|
||||
|
||||
await io.mkdirP(binDir);
|
||||
await io.mkdirP(libDir);
|
||||
|
||||
await io.mv(bin, path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`));
|
||||
fs.chmodSync(path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`), '0755');
|
||||
await io.mv(bin, path.join(binDir, `lein`));
|
||||
fs.chmodSync(path.join(binDir, `lein`), '0755');
|
||||
|
||||
await io.mv(lib, path.join(libDir, `leiningen-standalone.jar`));
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
await readWriteAsync(
|
||||
path.join(binDir, 'lein.bat'),
|
||||
'!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar',
|
||||
'!LEIN_LIB_DIR!\libexec\leiningen-standalone.jar'
|
||||
);
|
||||
} else {
|
||||
await readWriteAsync(
|
||||
path.join(binDir, 'lein'),
|
||||
'/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar',
|
||||
'$LEIN_LIB_DIR/libexec/leiningen-standalone.jar'
|
||||
);
|
||||
}
|
||||
core.exportVariable('LEIN_HOME', path.join(destinationFolder, 'leiningen'));
|
||||
core.addPath(path.join(destinationFolder, 'leiningen', 'bin'));
|
||||
await exec.exec('lein -h');
|
||||
|
||||
return path.join(destinationFolder, 'leiningen');
|
||||
} else {
|
||||
|
@ -11,6 +11,10 @@ async function run() {
|
||||
const Boot = core.getInput('boot');
|
||||
const Tdeps = core.getInput('tools-deps');
|
||||
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Windows is not supported yet.');
|
||||
}
|
||||
|
||||
if (Lein) {
|
||||
lein.setup(Lein);
|
||||
}
|
||||
@ -20,12 +24,8 @@ async function run() {
|
||||
}
|
||||
|
||||
if (Tdeps) {
|
||||
if (IS_WINDOWS) {
|
||||
throw new Error('Windows is not supported yet');
|
||||
} else {
|
||||
tdeps.setup(Tdeps);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Boot && !Lein && !Tdeps) {
|
||||
throw new Error('You must specify at least one clojure tool.');
|
||||
|
Loading…
x
Reference in New Issue
Block a user