From b58fcc5395c045f894e18a0010b295d84f7b5619 Mon Sep 17 00:00:00 2001 From: probablycorey Date: Tue, 21 May 2013 17:04:00 -0700 Subject: [PATCH] Specs run (but fail hardcore) --- src/app/atom.coffee | 6 +++--- src/app/window.coffee | 7 +++++-- src/main.coffee | 11 +++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/app/atom.coffee b/src/app/atom.coffee index 0874336d9..7c3236061 100644 --- a/src/app/atom.coffee +++ b/src/app/atom.coffee @@ -20,7 +20,7 @@ window.atom = originalSendMessageToBrowserProcess: -> console.log 'this methods needs to be replaced' getPathToOpen: -> - window.location.params.pathToOpen ? @getWindowState('pathToOpen') + window.location.params.pathToOpen getPackageState: (name) -> @packageStates[name] @@ -223,7 +223,7 @@ window.atom = fsUtils.join(config.userStoragePath, shasum.digest('hex')) setWindowState: (keyPath, value) -> - return {} if @windowMode == 'config' + return {} if not @getPathToOpen() windowState = @getWindowState() _.setValueForKeyPath(windowState, keyPath, value) @@ -231,7 +231,7 @@ window.atom = windowState getWindowState: (keyPath) -> - return {} if @windowMode == 'config' or not fsUtils.exists(@getWindowStatePath()) + return {} if not @getPathToOpen() or not fsUtils.exists(@getWindowStatePath()) windowState = JSON.parse(fsUtils.read(@getWindowStatePath()) or '{}') if keyPath diff --git a/src/app/window.coffee b/src/app/window.coffee index f7919da05..ed432e280 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -36,6 +36,11 @@ window.setUpEnvironment = -> if nativeStylesheetPath = fsUtils.resolveOnLoadPath(process.platform, ['css', 'less']) requireStylesheet(nativeStylesheetPath) + dimensions = atom.getWindowState('dimensions') + dimensions = defaultWindowDimensions unless dimensions.width and dimensions.height + window.setDimensions(dimensions) + remote.getCurrentWindow().show() + # This method is only called when opening a real application window window.startEditorWindow = -> directory = _.find ['/opt/boxen', '/opt/github', '/usr/local'], (dir) -> fsUtils.isDirectory(dir) @@ -55,7 +60,6 @@ window.startEditorWindow = -> atom.activatePackages() keymap.loadUserKeymaps() atom.requireUserInitScript() - remote.getCurrentWindow().show() $(window).on 'unload', -> unloadEditorWindow(); false $(window).focus() @@ -154,7 +158,6 @@ window.deserializeEditorWindow = -> atom.packageStates = windowState.packageStates ? {} window.project = deserialize(windowState.project) ? new Project(pathToOpen) window.rootView = deserialize(windowState.rootView) ? new RootView - window.setDimensions(windowState.dimensions ? defaultWindowDimensions) if !windowState.rootView and (!pathToOpen or fsUtils.isFile(pathToOpen)) rootView.open(pathToOpen) diff --git a/src/main.coffee b/src/main.coffee index d3408ce37..6a8bdeeb2 100644 --- a/src/main.coffee +++ b/src/main.coffee @@ -16,6 +16,7 @@ setupNodePath= -> 'vendor', 'static', 'node_modules', + 'spec' ] homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME'] @@ -75,6 +76,8 @@ class AtomApplication { label: 'Hide Others', accelerator: 'Command+Shift+H', selector: 'hideOtherApplications:' } { label: 'Show All', selector: 'unhideAllApplications:' } { type: 'separator' } + { label: 'Run Specs', accelerator: 'Command+Alt+N', click: => @runSpecs() } + { type: 'separator' } { label: 'Quit', accelerator: 'Command+Q', click: -> app.quit() } ] @@ -140,6 +143,14 @@ class AtomApplication @windows.push atomWindow + runSpecs: -> + specWindow = new AtomWindow + bootstrapScript: 'spec-bootstrap', + resourcePath: @resourcePath + + specWindow.browserWindow.show() + @windows.push specWindow + class AtomWindow browserWindow: null