avoid need for foreman
This commit is contained in:
parent
4b5b06b6fc
commit
49ac2f21eb
|
@ -21,7 +21,8 @@ OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo
|
||||||
|
|
||||||
const mastodonDir = path.join(dir, '../mastodon')
|
const mastodonDir = path.join(dir, '../mastodon')
|
||||||
|
|
||||||
let childProc
|
let railsChildProc
|
||||||
|
let webpackChildProc
|
||||||
|
|
||||||
async function cloneMastodon () {
|
async function cloneMastodon () {
|
||||||
try {
|
try {
|
||||||
|
@ -54,7 +55,6 @@ async function runMastodon () {
|
||||||
console.log('Running mastodon...')
|
console.log('Running mastodon...')
|
||||||
let cmds = [
|
let cmds = [
|
||||||
'gem install bundler',
|
'gem install bundler',
|
||||||
'gem install foreman',
|
|
||||||
'bundle install',
|
'bundle install',
|
||||||
'yarn --pure-lockfile'
|
'yarn --pure-lockfile'
|
||||||
]
|
]
|
||||||
|
@ -63,11 +63,19 @@ async function runMastodon () {
|
||||||
console.log(cmd)
|
console.log(cmd)
|
||||||
await exec(cmd, {cwd: mastodonDir})
|
await exec(cmd, {cwd: mastodonDir})
|
||||||
}
|
}
|
||||||
const promise = spawn('foreman', ['start'], {cwd: mastodonDir})
|
|
||||||
const log = fs.createWriteStream('mastodon.log', {flags: 'a'})
|
const log = fs.createWriteStream('mastodon.log', {flags: 'a'})
|
||||||
childProc = promise.childProcess
|
|
||||||
childProc.stdout.pipe(log)
|
railsChildProc = spawn(
|
||||||
childProc.stderr.pipe(log)
|
'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)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
|
@ -79,10 +87,14 @@ async function main () {
|
||||||
await waitForMastodonUiToStart()
|
await waitForMastodonUiToStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
function shutdownMastodon() {
|
function shutdownMastodon () {
|
||||||
if (childProc) {
|
if (railsChildProc) {
|
||||||
console.log('killing child process')
|
console.log('killing rails child process')
|
||||||
childProc.kill()
|
railsChildProc.kill()
|
||||||
|
}
|
||||||
|
if (webpackChildProc) {
|
||||||
|
console.log('killing webpack child process')
|
||||||
|
webpackChildProc.kill()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ if (require.main === module) {
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(waitForMastodonApiToStart)
|
.then(waitForMastodonApiToStart)
|
||||||
.then(waitForMastodonUiToStart).catch(err => {
|
.then(waitForMastodonUiToStart).catch(err => {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue