mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2024-12-27 08:31:04 +08:00
small fixes
This commit is contained in:
parent
fcba246910
commit
4e58ffd645
@ -26,57 +26,57 @@ describe('tdeps tests', () => {
|
|||||||
}
|
}
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('Throws if invalid version', async () => {
|
it('Throws if invalid version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await tdeps.setup('1000');
|
await tdeps.setup('1000');
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
expect(thrown).toBe(true);
|
expect(thrown).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Install clojure tools deps with normal version', async () => {
|
it('Install clojure tools deps with normal version', async () => {
|
||||||
await tdeps.setup('1.10.1.469');
|
await tdeps.setup('1.10.1.469');
|
||||||
const clojureDir = path.join(
|
const clojureDir = path.join(
|
||||||
toolDir,
|
toolDir,
|
||||||
'ClojureToolsDeps',
|
'ClojureToolsDeps',
|
||||||
'1.10.1-469',
|
'1.10.1-469',
|
||||||
os.arch()
|
os.arch()
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
expect(fs.existsSync(`${clojureDir}.complete`)).toBe(true);
|
||||||
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
expect(fs.existsSync(path.join(clojureDir, 'bin', 'clojure'))).toBe(true);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('Uses version of clojure tools-deps installed in cache', async () => {
|
it('Uses version of clojure tools-deps installed in cache', async () => {
|
||||||
const clojureDir: string = path.join(
|
const clojureDir: string = path.join(
|
||||||
toolDir,
|
toolDir,
|
||||||
'ClojureToolsDeps',
|
'ClojureToolsDeps',
|
||||||
'1.10.1-469',
|
'1.10.1-469',
|
||||||
os.arch()
|
os.arch()
|
||||||
);
|
);
|
||||||
await io.mkdirP(clojureDir);
|
await io.mkdirP(clojureDir);
|
||||||
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
fs.writeFileSync(`${clojureDir}.complete`, 'hello');
|
||||||
await tdeps.setup('1.10.1.469');
|
await tdeps.setup('1.10.1.469');
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
it('Doesnt use version of clojure that was only partially installed in cache', async () => {
|
||||||
const clojureDir: string = path.join(
|
const clojureDir: string = path.join(
|
||||||
toolDir,
|
toolDir,
|
||||||
'ClojureToolsDeps',
|
'ClojureToolsDeps',
|
||||||
'1.10.1-469',
|
'1.10.1-469',
|
||||||
os.arch()
|
os.arch()
|
||||||
);
|
);
|
||||||
await io.mkdirP(clojureDir);
|
await io.mkdirP(clojureDir);
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await tdeps.setup('1000');
|
await tdeps.setup('1000');
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
expect(thrown).toBe(true);
|
expect(thrown).toBe(true);
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@ function installLeiningen(binScript, libFile, destinationFolder) {
|
|||||||
fs.chmodSync(path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`), '0755');
|
fs.chmodSync(path.join(binDir, `lein${IS_WINDOWS ? '.bat' : ''}`), '0755');
|
||||||
yield io.mv(lib, path.join(libDir, `leiningen-standalone.jar`));
|
yield io.mv(lib, path.join(libDir, `leiningen-standalone.jar`));
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
yield readWriteAsync(path.join(binDir, 'lein.bat'), '!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar', '..\libexec\leiningen-standalone.jar');
|
yield readWriteAsync(path.join(binDir, 'lein.bat'), '!LEIN_HOME!self-installsleiningen-!LEIN_VERSION!-standalone.jar', '..libexecleiningen-standalone.jar');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield readWriteAsync(path.join(binDir, 'lein'), '/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar', '../libexec/leiningen-standalone.jar');
|
yield readWriteAsync(path.join(binDir, 'lein'), '/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar', '../libexec/leiningen-standalone.jar');
|
||||||
|
@ -20,6 +20,7 @@ const core = __importStar(require("@actions/core"));
|
|||||||
const lein = __importStar(require("./leiningen"));
|
const lein = __importStar(require("./leiningen"));
|
||||||
const boot = __importStar(require("./boot"));
|
const boot = __importStar(require("./boot"));
|
||||||
const tdeps = __importStar(require("./tdeps"));
|
const tdeps = __importStar(require("./tdeps"));
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@ -33,7 +34,12 @@ function run() {
|
|||||||
boot.setup(Boot);
|
boot.setup(Boot);
|
||||||
}
|
}
|
||||||
if (Tdeps) {
|
if (Tdeps) {
|
||||||
tdeps.setup(Tdeps);
|
if (IS_WINDOWS) {
|
||||||
|
throw new Error('Windows is not supported yet');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tdeps.setup(Tdeps);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!Boot && !Lein && !Tdeps) {
|
if (!Boot && !Lein && !Tdeps) {
|
||||||
throw new Error('You must specify at least one clojure tool.');
|
throw new Error('You must specify at least one clojure tool.');
|
||||||
|
@ -25,9 +25,6 @@ const os = __importStar(require("os"));
|
|||||||
const utils = __importStar(require("./utils"));
|
const utils = __importStar(require("./utils"));
|
||||||
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
if (IS_WINDOWS) {
|
|
||||||
throw new Error('Windows is not supported yet.');
|
|
||||||
}
|
|
||||||
if (!tempDirectory) {
|
if (!tempDirectory) {
|
||||||
let baseLocation;
|
let baseLocation;
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
|
@ -19,12 +19,12 @@ async function run() {
|
|||||||
boot.setup(Boot);
|
boot.setup(Boot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tdeps) {
|
if (Tdeps) {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
throw new Error('Windows is not supported yet');
|
throw new Error('Windows is not supported yet');
|
||||||
} else {
|
} else {
|
||||||
tdeps.setup(Tdeps);
|
tdeps.setup(Tdeps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Boot && !Lein && !Tdeps) {
|
if (!Boot && !Lein && !Tdeps) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user