Skip to content

Commit 9d39ec9

Browse files
authored
Merge pull request #104 from DeLaGuardo/test-leiningen
Set LEIN_JAR
2 parents 4b9b2f7 + b53cf20 commit 9d39ec9

File tree

7 files changed

+54
-19
lines changed

7 files changed

+54
-19
lines changed

.github/workflows/smoke-tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ jobs:
128128
run: |
129129
lein version
130130
131-
- name: lein pwsh
132-
shell: pwsh
133-
run: |
134-
lein version
135-
136131
- name: lein cmd
137132
shell: cmd
138133
run: |
@@ -312,7 +307,7 @@ jobs:
312307
uses: ./
313308
with:
314309
cli: 1.11.1.1149
315-
lein: 2.9.1
310+
lein: 2.11.0
316311
boot: 2.8.3
317312
bb: 0.8.157
318313
clj-kondo: 2022.06.22

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
java-version: '8'
4747

4848
- name: Install clojure tools
49-
uses: DeLaGuardo/setup-clojure@12.3
49+
uses: DeLaGuardo/setup-clojure@12.4
5050
with:
5151
# Install just one or all simultaneously
5252
# The value must indicate a particular version of the tool, or use 'latest'

dist/index.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10711071
};
10721072
var _a;
10731073
Object.defineProperty(exports, "__esModule", ({ value: true }));
1074-
exports.mkdir = exports.cp = exports.writeFile = exports.readFile = exports.chmod = exports.stat = void 0;
1074+
exports.readdir = exports.mkdir = exports.cp = exports.writeFile = exports.readFile = exports.chmod = exports.stat = void 0;
10751075
const fs_1 = __importDefault(__nccwpck_require__(7147));
1076-
_a = fs_1.default.promises, exports.stat = _a.stat, exports.chmod = _a.chmod, exports.readFile = _a.readFile, exports.writeFile = _a.writeFile, exports.cp = _a.cp, exports.mkdir = _a.mkdir;
1076+
_a = fs_1.default.promises, exports.stat = _a.stat, exports.chmod = _a.chmod, exports.readFile = _a.readFile, exports.writeFile = _a.writeFile, exports.cp = _a.cp, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir;
10771077

10781078

10791079
/***/ }),
@@ -1148,6 +1148,10 @@ function setup(version, githubAuth) {
11481148
core.debug(`Leiningen installed to ${leiningenDir}`);
11491149
toolPath = yield tc.cacheDir(leiningenDir, exports.identifier, utils.getCacheVersionString(version));
11501150
}
1151+
const leiningenJarPath = yield leiningenJar(toolPath);
1152+
if (leiningenJarPath !== null) {
1153+
core.exportVariable('LEIN_JAR', leiningenJarPath);
1154+
}
11511155
core.exportVariable('LEIN_HOME', toolPath);
11521156
core.addPath(path.join(toolPath, 'bin'));
11531157
});
@@ -1175,8 +1179,9 @@ function installLeiningen(binScripts, destinationFolder) {
11751179
const version_cmd = isWindows
11761180
? 'powershell .\\lein.ps1 self-install'
11771181
: './lein version';
1182+
const toolDir = path.join(destinationFolder, 'leiningen');
11781183
const env = {
1179-
LEIN_HOME: path.join(destinationFolder, 'leiningen')
1184+
LEIN_HOME: toolDir
11801185
};
11811186
if (process.env['PATH']) {
11821187
env['PATH'] = process.env['PATH'];
@@ -1185,10 +1190,23 @@ function installLeiningen(binScripts, destinationFolder) {
11851190
env['JAVA_CMD'] = process.env['JAVA_CMD'];
11861191
}
11871192
yield exec.exec(version_cmd, [], {
1188-
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
1193+
cwd: path.join(toolDir, 'bin'),
11891194
env
11901195
});
1191-
return path.join(destinationFolder, 'leiningen');
1196+
return toolDir;
1197+
});
1198+
}
1199+
function leiningenJar(toolPath) {
1200+
return __awaiter(this, void 0, void 0, function* () {
1201+
const files = yield fs.readdir(path.join(toolPath, 'self-installs'));
1202+
if (files) {
1203+
for (const file of files) {
1204+
if (file.endsWith('.jar')) {
1205+
return path.join(toolPath, 'self-installs', file);
1206+
}
1207+
}
1208+
}
1209+
return null;
11921210
});
11931211
}
11941212

@@ -1309,7 +1327,7 @@ exports.isMacOS = isMacOS;
13091327

13101328
Object.defineProperty(exports, "__esModule", ({ value: true }));
13111329
exports.VERSION = void 0;
1312-
exports.VERSION = '12-3';
1330+
exports.VERSION = '12-4';
13131331

13141332

13151333
/***/ }),

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/fs.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import fs from 'fs'
22

3-
export const {stat, chmod, readFile, writeFile, cp, mkdir} = fs.promises
3+
export const {stat, chmod, readFile, writeFile, cp, mkdir, readdir} =
4+
fs.promises

src/leiningen.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ export async function setup(
6262
)
6363
}
6464

65+
const leiningenJarPath = await leiningenJar(toolPath)
66+
67+
if (leiningenJarPath !== null) {
68+
core.exportVariable('LEIN_JAR', leiningenJarPath)
69+
}
70+
6571
core.exportVariable('LEIN_HOME', toolPath)
6672
core.addPath(path.join(toolPath, 'bin'))
6773
}
@@ -96,8 +102,10 @@ async function installLeiningen(
96102
? 'powershell .\\lein.ps1 self-install'
97103
: './lein version'
98104

105+
const toolDir = path.join(destinationFolder, 'leiningen')
106+
99107
const env: {[key: string]: string} = {
100-
LEIN_HOME: path.join(destinationFolder, 'leiningen')
108+
LEIN_HOME: toolDir
101109
}
102110

103111
if (process.env['PATH']) {
@@ -108,9 +116,22 @@ async function installLeiningen(
108116
}
109117

110118
await exec.exec(version_cmd, [], {
111-
cwd: path.join(destinationFolder, 'leiningen', 'bin'),
119+
cwd: path.join(toolDir, 'bin'),
112120
env
113121
})
114122

115-
return path.join(destinationFolder, 'leiningen')
123+
return toolDir
124+
}
125+
126+
async function leiningenJar(toolPath: string): Promise<string | null> {
127+
const files = await fs.readdir(path.join(toolPath, 'self-installs'))
128+
if (files) {
129+
for (const file of files) {
130+
if (file.endsWith('.jar')) {
131+
return path.join(toolPath, 'self-installs', file)
132+
}
133+
}
134+
}
135+
136+
return null
116137
}

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '12-3'
1+
export const VERSION = '12-4'

0 commit comments

Comments
 (0)