Skip to content

Commit 87d6a70

Browse files
committed
Do not assume extension
1 parent 57dbd0d commit 87d6a70

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

dist/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,11 @@ function setup(version, githubAuth) {
967967
const binScripts = [];
968968
if (isWindows) {
969969
for (const ext of ['ps1', 'bat']) {
970-
binScripts.push(yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein.${ext}`, undefined, githubAuth));
970+
binScripts.push(yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein.${ext}`, path.join(utils.getTempDir(), `lein.${ext}`), githubAuth));
971971
}
972972
}
973973
else {
974-
binScripts.push(yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein`, undefined, githubAuth));
974+
binScripts.push(yield tc.downloadTool(`https://raw.githubusercontent.com/technomancy/leiningen/${version === 'latest' ? 'stable' : version}/bin/lein`, path.join(utils.getTempDir(), 'lein'), githubAuth));
975975
}
976976
const tempDir = path.join(utils.getTempDir(), `temp_${Math.floor(Math.random() * 2000000000)}`);
977977
const leiningenDir = yield installLeiningen(binScripts, tempDir);
@@ -993,9 +993,9 @@ function installLeiningen(binScripts, destinationFolder) {
993993
if (binStats.isFile()) {
994994
const binDir = path.join(destinationFolder, 'leiningen', 'bin');
995995
yield io.mkdirP(binDir);
996-
yield io.mv(bin, path.join(binDir, `lein${isWindows ? '.ps1' : ''}`));
996+
yield io.mv(bin, path.join(binDir, `${path.basename(bin)}`));
997997
if (!isWindows) {
998-
yield fs.chmod(path.join(binDir, `lein`), '0755');
998+
yield fs.chmod(path.join(binDir, 'lein'), '0755');
999999
}
10001000
}
10011001
else {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/leiningen.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function setup(
3232
`https://raw.githubusercontent.com/technomancy/leiningen/${
3333
version === 'latest' ? 'stable' : version
3434
}/bin/lein.${ext}`,
35-
undefined,
35+
path.join(utils.getTempDir(), `lein.${ext}`),
3636
githubAuth
3737
)
3838
)
@@ -43,7 +43,7 @@ export async function setup(
4343
`https://raw.githubusercontent.com/technomancy/leiningen/${
4444
version === 'latest' ? 'stable' : version
4545
}/bin/lein`,
46-
undefined,
46+
path.join(utils.getTempDir(), 'lein'),
4747
githubAuth
4848
)
4949
)
@@ -82,10 +82,10 @@ async function installLeiningen(
8282

8383
await io.mkdirP(binDir)
8484

85-
await io.mv(bin, path.join(binDir, `lein${isWindows ? '.ps1' : ''}`))
85+
await io.mv(bin, path.join(binDir, `${path.basename(bin)}`))
8686

8787
if (!isWindows) {
88-
await fs.chmod(path.join(binDir, `lein`), '0755')
88+
await fs.chmod(path.join(binDir, 'lein'), '0755')
8989
}
9090
} else {
9191
throw new Error('Not a file')

0 commit comments

Comments
 (0)