Skip to content

Commit

Permalink
Add install imagemagick commands to api
Browse files Browse the repository at this point in the history
  • Loading branch information
mfix22 committed Feb 23, 2017
1 parent 84c5417 commit 1407443
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const convert = ({ files, outputPath, name }) => {
process.env['PATH'] = '/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'

return new Promise((resolve, reject) => {
execS('which convert', (error, stdout, stderr) => {
execS('which convert', (error) => {
if (error) reject(error)

const fileString = files.map(replaceSpaceCharacters).join(' ')
Expand All @@ -23,6 +23,20 @@ const convert = ({ files, outputPath, name }) => {
})
}

const installImageMagick = () => {
return new Promise((resolve, reject) => {
execS('which brew', (error) => {
if (error) reject(new Error('Brew is required to run Alchemy. Please visit https://brew.sh/ to install.'))
else {
execS('brew install imagemagick', (error) => {
return error ? reject(error) : resolve(true)
})
}
})
})
}

module.exports = {
convert
convert,
installImageMagick
}

0 comments on commit 1407443

Please # to comment.