Skip to content

Commit 55ffba9

Browse files
authored
fix: исправлена ошибки установки на macOS, изменен проверяемый пакет в тестах
1 parent 6b0a965 commit 55ffba9

File tree

2 files changed

+34
-22
lines changed

2 files changed

+34
-22
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
ovm_version: ${{ matrix.ovm_version }}
2121
- name: Проверка скрипта OS
2222
run: oscript test/fixtures/test.os
23-
- name: Проверка установки coverage
24-
run: opm install coverage
23+
- name: Проверка установки reflector
24+
run: opm install reflector

dist/index.js

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8687,23 +8687,22 @@ async function run() {
86878687
}
86888688

86898689
if (platform == 'linux') {
8690-
8691-
var tmpFile = tmp.fileSync();
8692-
fs.writeFileSync(tmpFile.name, installLinux());
8693-
await exec.exec('bash ' + tmpFile.name);
8694-
fs.unlinkSync(tmpFile.name);
8695-
8690+
await installLinux();
86968691
}
86978692

86988693
if (platform == 'darwin') {
8699-
var tmpFile = tmp.fileSync();
8700-
fs.writeFileSync(tmpFile.name, installMacOs());
8701-
await exec.exec('bash ' + tmpFile.name);
8702-
fs.unlinkSync(tmpFile.name);
8694+
await installMacOs();
87038695
}
87048696

8705-
await exec.exec('ovm install ' + osVersion);
8706-
await exec.exec('ovm use ' + osVersion);
8697+
if (platform == 'win32') {
8698+
await exec.exec('ovm install ' + osVersion);
8699+
await exec.exec('ovm use ' + osVersion);
8700+
} else {
8701+
var commands = [];
8702+
commands.push('ovm install ' + osVersion);
8703+
commands.push('ovm use ' + osVersion);
8704+
await execBash(commands);
8705+
}
87078706

87088707
let output = '';
87098708
const options = {};
@@ -8714,7 +8713,11 @@ async function run() {
87148713
}
87158714
}
87168715
};
8717-
await exec.exec('ovm', ['which', 'current'], options);
8716+
if (platform == 'win32') {
8717+
await exec.exec('ovm', ['which', 'current'], options);
8718+
} else {
8719+
await execBash('ovm which current', options);
8720+
}
87188721
let pathOscript = path.dirname(output);
87198722

87208723
core.addPath(pathOscript);
@@ -8738,9 +8741,8 @@ async function run() {
87388741
}
87398742
}
87408743

8741-
function installLinux() {
8744+
async function installLinux() {
87428745
var value = [];
8743-
value.push('#!/bin/bash');
87448746
value.push('sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF');
87458747
value.push('echo "deb http://download.mono-project.com/repo/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/mono-official.list');
87468748
value.push('sudo apt-get update');
@@ -8751,17 +8753,27 @@ function installLinux() {
87518753
value.push("echo '" + cmd + "' | sudo tee /usr/local/bin/ovm");
87528754

87538755
value.push('sudo chmod +x /usr/local/bin/ovm');
8754-
return value.join('\n');
8756+
await execBash(value);
87558757
}
87568758

8757-
function installMacOs() {
8759+
async function installMacOs() {
87588760
var value = [];
8759-
value.push('#!/bin/bash');
87608761
value.push('mv ovm.exe /usr/local/bin/');
87618762
let cmd = 'mono /usr/local/bin/ovm.exe "$@"';
87628763
value.push("echo '" + cmd + "' | tee /usr/local/bin/ovm");
87638764
value.push('sudo chmod +x /usr/local/bin/ovm');
8764-
return value.join('\n');
8765+
await execBash(value);
8766+
}
8767+
8768+
async function execBash(commands, options = {}) {
8769+
var script = Array.isArray(commands) ? [...commands] : [commands];
8770+
script.unshift('#!/bin/bash');
8771+
script = script.join('\n');
8772+
8773+
var tmpFile = tmp.fileSync();
8774+
fs.writeFileSync(tmpFile.name, script);
8775+
await exec.exec('bash ' + tmpFile.name, [], options);
8776+
fs.unlinkSync(tmpFile.name);
87658777
}
87668778

87678779
run()
@@ -8770,4 +8782,4 @@ run()
87708782

87718783
module.exports = __webpack_exports__;
87728784
/******/ })()
8773-
;
8785+
;

0 commit comments

Comments
 (0)