diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index be574cff6..66ab9229f 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -230,3 +230,8 @@ describe "Workspace", -> expect(atom.config.get('editor.fontSize')).toBe 1 workspace.decreaseFontSize() expect(atom.config.get('editor.fontSize')).toBe 1 + + describe "::openLicense()", -> + it "opens the license as plain-text in a buffer", -> + waitsForPromise -> workspace.openLicense() + runs -> expect(workspace.activePaneItem.getText()).toMatch /Copyright/ diff --git a/src/workspace-view.coffee b/src/workspace-view.coffee index bb7779b3e..7ded114ee 100644 --- a/src/workspace-view.coffee +++ b/src/workspace-view.coffee @@ -111,6 +111,7 @@ class WorkspaceView extends View @command 'application:open-your-keymap', -> ipc.sendChannel('command', 'application:open-your-keymap') @command 'application:open-your-snippets', -> ipc.sendChannel('command', 'application:open-your-snippets') @command 'application:open-your-stylesheet', -> ipc.sendChannel('command', 'application:open-your-stylesheet') + @command 'application:open-license', => @model.openLicense() @command 'window:install-shell-commands', => @installShellCommands() diff --git a/src/workspace.coffee b/src/workspace.coffee index 1a9b1d0ee..ceb6c9c48 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -1,4 +1,5 @@ {remove, last} = require 'underscore-plus' +{join} = require 'path' {Model} = require 'theorist' Q = require 'q' Serializable = require 'serializable' @@ -88,6 +89,9 @@ class Workspace extends Model @openUriInPane(uri, pane, options) + openLicense: -> + @open(join(atom.getLoadSettings().resourcePath, 'LICENSE')) + # Only used in specs openSync: (uri='', options={}) -> {initialLine} = options