Skip to content

Commit

Permalink
Merge pull request #45 from valory-xyz/chore/bump
Browse files Browse the repository at this point in the history
Bump dependencies
  • Loading branch information
angrybayblade authored Apr 2, 2024
2 parents 2ca3b16 + 6d664b4 commit 89d9be4
Show file tree
Hide file tree
Showing 8 changed files with 10,069 additions and 846 deletions.
27 changes: 0 additions & 27 deletions electron/docker.js

This file was deleted.

33 changes: 32 additions & 1 deletion electron/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const os = require('os');
const sudo = require('sudo-prompt');
const process = require('process');
const { spawnSync } = require('child_process');
const Docker = require('dockerode');


const OperateDirectory = `${os.homedir()}/.operate`;
Expand Down Expand Up @@ -143,7 +144,7 @@ function createVirtualEnvUbuntu(path) {
function installOperatePackageUnix(path) {
return runCmdUnix(
`${path}/venv/bin/python3.10`,
['-m', 'pip', 'install', 'olas-operate-middleware==0.1.0rc0']
['-m', 'pip', 'install', 'olas-operate-middleware==0.1.0rc1']
)
}

Expand Down Expand Up @@ -267,8 +268,38 @@ async function setupUbuntu(ipcChannel) {
await installOperateCli('/usr/local/bin')
}


async function startDocker(ipcChannel) {
const docker = new Docker();
let running = await new Promise((resolve, reject) => {
docker.ping((err) => {
resolve(!err)
});
});
if (!running) {
console.log(appendLog("Starting docker"))
ipcChannel.send("response", "Starting docker")
if (process.platform == "darwin") {
runCmdUnix("open", ["-a", "Docker"])
} else if (process.platform == "win32") {
// TODO
} else {
runSudoUnix("sudo", ["service", "docker", "restart"])
}
}
while (!running) {
running = await new Promise((resolve, reject) => {
docker.ping((err) => {
resolve(!err)
});
});
};
}


module.exports = {
setupDarwin,
startDocker,
setupUbuntu,
OperateDirectory,
OperateCmd,
Expand Down
6 changes: 6 additions & 0 deletions electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const {
setupUbuntu,
OperateCmd,
OperateDirectory,
startDocker
} = require('./install');
const { killProcesses } = require('./processes');
const { isPortAvailable, findAvailablePort } = require('./ports');
Expand Down Expand Up @@ -267,6 +268,9 @@ async function launchNextAppDev() {

ipcMain.on('check', async function (event, argument) {
try {



event.sender.send('response', 'Checking installation');
if (!isDev) {
if (platform === 'darwin') {
Expand All @@ -278,6 +282,8 @@ ipcMain.on('check', async function (event, argument) {
}
}

startDocker(event.sender)

if (isDev) {
event.sender.send(
'response',
Expand Down
Loading

0 comments on commit 89d9be4

Please sign in to comment.