Install atom and apm cli commands to /usr/local/bin

This commit is contained in:
probablycorey
2014-01-21 18:00:59 -08:00
parent a95a510770
commit 1bd4d51879

View File

@@ -23,10 +23,6 @@ unlinkCommand = (destinationPath, callback) ->
callback()
module.exports =
findInstallDirectory: (callback) ->
directories = ['/opt/boxen', '/opt/github', '/usr/local']
async.detect(directories, fs.isDirectory, callback)
install: (commandPath, commandName, callback) ->
if not commandName? or _.isFunction(commandName)
callback = commandName
@@ -37,17 +33,17 @@ module.exports =
console.warn "Failed to install `#{commandName}` binary", error
callback?(error, sourcePath, destinationPath)
@findInstallDirectory (directory) ->
if directory?
destinationPath = path.join(directory, 'bin', commandName)
unlinkCommand destinationPath, (error) ->
if error?
installCallback(error)
else
symlinkCommand commandPath, destinationPath, (error) ->
installCallback(error, commandPath, destinationPath)
else
installCallback(new Error("No destination directory exists to install"))
directory = "/usr/local"
if fs.existsSync(directory)
destinationPath = path.join(directory, 'bin', commandName)
unlinkCommand destinationPath, (error) ->
if error?
installCallback(error)
else
symlinkCommand commandPath, destinationPath, (error) ->
installCallback(error, commandPath, destinationPath)
else
installCallback(new Error("No destination directory exists to install"))
installAtomCommand: (resourcePath, callback) ->
if _.isFunction(resourcePath)