From 7b92f894a41c273a88e3bd2e4e25f7d5e5be22a6 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 6 Mar 2018 21:32:56 -0800 Subject: [PATCH] Revert "avoid need for foreman" This reverts commit 49ac2f21ebfd929733e6a8a8999e83f103afa1cc. --- bin/run-mastodon.js | 32 ++++++++++--------------------- bin/wait-for-mastodon-to-start.js | 6 +++--- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/bin/run-mastodon.js b/bin/run-mastodon.js index 18c43b3..7f0b732 100644 --- a/bin/run-mastodon.js +++ b/bin/run-mastodon.js @@ -21,8 +21,7 @@ OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo const mastodonDir = path.join(dir, '../mastodon') -let railsChildProc -let webpackChildProc +let childProc async function cloneMastodon () { try { @@ -55,6 +54,7 @@ async function runMastodon () { console.log('Running mastodon...') let cmds = [ 'gem install bundler', + 'gem install foreman', 'bundle install', 'yarn --pure-lockfile' ] @@ -63,19 +63,11 @@ async function runMastodon () { console.log(cmd) await exec(cmd, {cwd: mastodonDir}) } + const promise = spawn('foreman', ['start'], {cwd: mastodonDir}) const log = fs.createWriteStream('mastodon.log', {flags: 'a'}) - - railsChildProc = spawn( - 'bundle', ['exec', 'rails', 'server'], {cwd: mastodonDir} - ).childProcess - railsChildProc.stdout.pipe(log) - railsChildProc.stderr.pipe(log) - - webpackChildProc = spawn( - './bin/webpack-dev-server', [], {cwd: mastodonDir} - ).childProcess - webpackChildProc.stdout.pipe(log) - webpackChildProc.stderr.pipe(log) + childProc = promise.childProcess + childProc.stdout.pipe(log) + childProc.stderr.pipe(log) } async function main () { @@ -87,14 +79,10 @@ async function main () { await waitForMastodonUiToStart() } -function shutdownMastodon () { - if (railsChildProc) { - console.log('killing rails child process') - railsChildProc.kill() - } - if (webpackChildProc) { - console.log('killing webpack child process') - webpackChildProc.kill() +function shutdownMastodon() { + if (childProc) { + console.log('killing child process') + childProc.kill() } } diff --git a/bin/wait-for-mastodon-to-start.js b/bin/wait-for-mastodon-to-start.js index 9dae625..8f3da02 100644 --- a/bin/wait-for-mastodon-to-start.js +++ b/bin/wait-for-mastodon-to-start.js @@ -34,7 +34,7 @@ if (require.main === module) { Promise.resolve() .then(waitForMastodonApiToStart) .then(waitForMastodonUiToStart).catch(err => { - console.error(err) - process.exit(1) - }) + console.error(err) + process.exit(1) + }) }