From 3320176a0a80d20e9df2442508fbaf4b9b1774c7 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 22 Nov 2013 09:51:21 -0800 Subject: [PATCH] Move atom/apm install helpers to CommandInstaller --- src/command-installer.coffee | 10 ++++++++++ src/window.coffee | 15 +++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/command-installer.coffee b/src/command-installer.coffee index 77dacc934..339da0be6 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -47,3 +47,13 @@ module.exports = symlinkCommand(commandPath, destinationPath, installCallback) else installCallback(new Error("No destination directory exists to install")) + + installAtomCommand: (callback) -> + {resourcePath} = atom.getLoadSettings() + commandPath = path.join(resourcePath, 'atom.sh') + @install(commandPath, callback) + + installApmCommand: (callback) -> + {resourcePath} = atom.getLoadSettings() + commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm') + @install(commandPath, callback) diff --git a/src/window.coffee b/src/window.coffee index a6326087a..8c1f54327 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -20,8 +20,9 @@ window.setUpDefaultEvents = -> # This method is only called when opening a real application window window.startEditorWindow = -> if process.platform is 'darwin' - installAtomCommand() - installApmCommand() + CommandInstaller = require './command-installer' + CommandInstaller.installAtomCommand() + CommandInstaller.installApmCommand() windowEventHandler = new WindowEventHandler atom.restoreDimensions() @@ -56,16 +57,6 @@ window.unloadEditorWindow = -> atom.project.destroy() windowEventHandler?.unsubscribe() -installAtomCommand = (callback) -> - {resourcePath} = atom.getLoadSettings() - commandPath = path.join(resourcePath, 'atom.sh') - require('./command-installer').install(commandPath, callback) - -installApmCommand = (callback) -> - {resourcePath} = atom.getLoadSettings() - commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm') - require('./command-installer').install(commandPath, callback) - window.onerror = -> atom.openDevTools()