Skip to content

Commit

Permalink
feat: add brew installation script and fix tendermint installation
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybayblade committed Jun 5, 2024
1 parent 2187725 commit d6256b9
Show file tree
Hide file tree
Showing 2 changed files with 1,110 additions and 17 deletions.
29 changes: 12 additions & 17 deletions electron/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ function runCmdUnix(command, options) {
if (output.stderr) {
appendLog(output.stdout.toString());
}
if (output.error) {
if (output.error || output.stderr.length > 0) {
throw new Error(
`Error running ${command} with options ${options};
Error: ${output.error}; Stdout: ${output.stdout}; Stderr: ${output.stderr}`,
);
}
return {
error: output.error,
stdout: output.stdout?.toString(),
stderr: output.stderr?.toString(),
};
console.log(appendLog(`Executed ${command} ${options} with output:\n${output.stdout}`))
}

function runSudoUnix(command, options) {
Expand Down Expand Up @@ -117,9 +113,8 @@ function isBrewInstalled() {
}

function installBrew() {
return runCmdUnix('bash', [
'-c',
'$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)',
runCmdUnix('bash', [
`${__dir}/scripts/install_brew.sh`
]);
}

Expand All @@ -141,7 +136,7 @@ async function downloadFile(url, dest) {
writer.on('error', reject);
});
} catch (err) {
fs.unlink(dest, () => {}); // Delete the file if there is an error
fs.unlink(dest, () => { }); // Delete the file if there is an error
console.error('Error downloading the file:', err.message);
}
}
Expand All @@ -159,7 +154,7 @@ async function installTendermintUnix() {
await downloadFile(url, `${TempDir}/tendermint.tar.gz`);

console.log(appendLog(`Installing tendermint binary`));
await runCmdUnix('tar', ['-xvf', 'tendermint.tar.gz']);
runCmdUnix('tar', ['-xvf', 'tendermint.tar.gz']);
await runSudoUnix('install', 'tendermint /usr/local/bin');
process.chdir(cwd);
}
Expand All @@ -169,7 +164,7 @@ function isDockerInstalledDarwin() {
}

function installDockerDarwin() {
return runCmdUnix('brew', ['install', 'docker']);
runCmdUnix('brew', ['install', 'docker']);
}

function isDockerInstalledUbuntu() {
Expand All @@ -185,11 +180,11 @@ function isPythonInstalledDarwin() {
}

function installPythonDarwin() {
return runCmdUnix('brew', ['install', '[email protected]']);
runCmdUnix('brew', ['install', '[email protected]']);
}

function createVirtualEnvUnix(path) {
return runCmdUnix('python3.10', ['-m', 'venv', path]);
runCmdUnix('python3.10', ['-m', 'venv', path]);
}

function isPythonInstalledUbuntu() {
Expand All @@ -209,11 +204,11 @@ function installGitUbuntu() {
}

function createVirtualEnvUbuntu(path) {
return runCmdUnix('python3.10', ['-m', 'venv', path]);
runCmdUnix('python3.10', ['-m', 'venv', path]);
}

function installOperatePackageUnix(path) {
return runCmdUnix(`${path}/venv/bin/python3.10`, [
runCmdUnix(`${path}/venv/bin/python3.10`, [
'-m',
'pip',
'install',
Expand All @@ -223,7 +218,7 @@ function installOperatePackageUnix(path) {

function reInstallOperatePackageUnix(path) {
console.log(appendLog('Reinstalling pearl CLI'));
return runCmdUnix(`${path}/venv/bin/python3.10`, [
runCmdUnix(`${path}/venv/bin/python3.10`, [
'-m',
'pip',
'install',
Expand Down
Loading

0 comments on commit d6256b9

Please sign in to comment.