From 3e0477ffcb9824fd90a5eadbc79157bc582430e6 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 24 Sep 2014 15:05:55 -0600 Subject: [PATCH] Move shell command installation to workspace model --- src/workspace-view.coffee | 24 +----------------------- src/workspace.coffee | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index 3adbf8f63..12947db59 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -8,7 +8,6 @@ scrollbarStyle = require 'scrollbar-style' {$, $$, View} = require './space-pen-extensions' fs = require 'fs-plus' Workspace = require './workspace' -CommandInstaller = require './command-installer' PaneView = require './pane-view' PaneContainerView = require './pane-container-view' Editor = require './editor' @@ -142,7 +141,7 @@ class WorkspaceView extends View @command 'application:open-license', => @model.openLicense() if process.platform is 'darwin' - @command 'window:install-shell-commands', => @installShellCommands() + @command 'window:install-shell-commands', => @getModel().installShellCommands() @command 'window:run-package-specs', -> ipc.send('run-package-specs', path.join(atom.project.getPath(), 'spec')) @@ -333,27 +332,6 @@ class WorkspaceView extends View setEditorLineHeight: (lineHeight) -> atom.themes.updateGlobalEditorStyle('line-height', lineHeight) - # Install the Atom shell commands on the user's system. - installShellCommands: -> - showErrorDialog = (error) -> - installDirectory = CommandInstaller.getInstallDirectory() - atom.confirm - message: "Failed to install shell commands" - detailedMessage: error.message - - resourcePath = atom.getLoadSettings().resourcePath - CommandInstaller.installAtomCommand resourcePath, true, (error) -> - if error? - showErrorDialog(error) - else - CommandInstaller.installApmCommand resourcePath, true, (error) -> - if error? - showErrorDialog(error) - else - atom.confirm - message: "Commands installed." - detailedMessage: "The shell commands `atom` and `apm` are installed." - handleFocus: -> if @getActivePaneView() @getActivePaneView().focus() diff --git a/src/workspace.coffee b/src/workspace.coffee index b8fbbfca3..33b5bbd3f 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -6,6 +6,7 @@ Q = require 'q' Serializable = require 'serializable' Delegator = require 'delegato' {Emitter} = require 'event-kit' +CommandInstaller = require './command-installer' Editor = require './editor' PaneContainer = require './pane-container' Pane = require './pane' @@ -97,6 +98,26 @@ class Workspace extends Model editorAdded: (editor) -> @emit 'editor-created', editor + installShellCommands: -> + showErrorDialog = (error) -> + installDirectory = CommandInstaller.getInstallDirectory() + atom.confirm + message: "Failed to install shell commands" + detailedMessage: error.message + + resourcePath = atom.getLoadSettings().resourcePath + CommandInstaller.installAtomCommand resourcePath, true, (error) -> + if error? + showErrorDialog(error) + else + CommandInstaller.installApmCommand resourcePath, true, (error) -> + if error? + showErrorDialog(error) + else + atom.confirm + message: "Commands installed." + detailedMessage: "The shell commands `atom` and `apm` are installed." + ### Section: Event Subscription ###