Make cli installation work with install-cli script

This commit is contained in:
probablycorey 2014-01-22 15:56:05 -08:00
parent 399c4f9f95
commit d2e4c61e0b
4 changed files with 13 additions and 11 deletions

View File

@ -3,9 +3,8 @@
path = require 'path'
CommandInstaller = require '../src/command-installer'
callback = (error, sourcePath, destinationPath) ->
unless error?
console.log "#{sourcePath} intalled to #{destinationPath}"
callback = (error) ->
console.warn error.message if error?
CommandInstaller.installAtomCommand(path.resolve(__dirname, '..'), callback)
CommandInstaller.installApmCommand(path.resolve(__dirname, '..'), callback)

View File

@ -250,8 +250,11 @@ class Atom extends Model
# Private: Call this method when establishing a real application window.
startEditorWindow: ->
CommandInstaller = require './command-installer'
CommandInstaller.installAtomCommand (error) -> console.warn error.message if error?
CommandInstaller.installApmCommand (error) -> console.warn error.message if error?
resourcePath = atom.getLoadSettings().resourcePath
CommandInstaller.installAtomCommand resourcePath, (error) ->
console.warn error.message if error?
CommandInstaller.installApmCommand resourcePath, (error) ->
console.warn error.message if error?
@restoreWindowDimensions()
@config.load()

View File

@ -45,12 +45,10 @@ module.exports =
error = new Error "Directory '#{directory} doesn't exist."
callback?(error)
installAtomCommand: (callback) ->
resourcePath = atom.getLoadSettings().resourcePath
installAtomCommand: (resourcePath, callback) ->
commandPath = path.join(resourcePath, 'atom.sh')
@install commandPath, callback
installApmCommand: (callback) ->
resourcePath = atom.getLoadSettings().resourcePath
installApmCommand: (resourcePath, callback) ->
commandPath = path.join(resourcePath, 'apm', 'node_modules', '.bin', 'apm')
@install commandPath, callback

View File

@ -146,10 +146,12 @@ class WorkspaceView extends View
message: "Command installed."
detailedMessage: "The shell command `#{commandName}` is installed."
CommandInstaller.installApmCommand (error) =>
resourcePath = atom.getLoadSettings().resourcePath
CommandInstaller.installApmCommand resourcePath, (error) =>
showDialog(error, 'atom')
unless error?
CommandInstaller.installApmCommand (error) => showDialog(error, 'apm')
CommandInstaller.installApmCommand resourcePath, (error) =>
showDialog(error, 'apm')
# Private:
handleFocus: (e) ->