From 2f46fee1cad24c0c025a60db841bac8d1cf38a93 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 21 Nov 2013 14:55:25 -0800 Subject: [PATCH 1/3] Use resource path from load settings --- spec/spec-helper.coffee | 8 ++++---- spec/spec-suite.coffee | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 3fcbf8263..65da40e5d 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -39,7 +39,9 @@ specPackageName = null specPackagePath = null specProjectPath = null -if specDirectory = atom.getLoadSettings().specDirectory +{specDirectory, resourcePath} = atom.getLoadSettings() + +if specDirectory specPackagePath = path.resolve(specDirectory, '..') try specPackageName = fs.readObjectSync(path.join(specPackagePath, 'package.json'))?.name @@ -68,9 +70,7 @@ beforeEach -> spyOn(atom.menu, 'sendToBrowserProcess') # reset config before each spec; don't load or save from/to `config.json` - config = new Config - resourcePath: window.resourcePath - configDirPath: atom.getConfigDirPath() + config = new Config({resourcePath, configDirPath: atom.getConfigDirPath()}) spyOn(config, 'load') spyOn(config, 'save') config.setDefaults('core', RootView.configDefaults) diff --git a/spec/spec-suite.coffee b/spec/spec-suite.coffee index 82dc95070..6beade358 100644 --- a/spec/spec-suite.coffee +++ b/spec/spec-suite.coffee @@ -23,9 +23,10 @@ setSpecDirectory = (specDirectory) -> setSpecField('specDirectory', specDirectory) runAllSpecs = -> + {resourcePath} = atom.getLoadSettings() # Only run core specs when resource path is the Atom repository - if Git.exists(window.resourcePath) - requireSpecs(path.join(window.resourcePath, 'spec')) + if Git.exists(resourcePath) + requireSpecs(path.join(resourcePath, 'spec')) setSpecType('core') fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages') @@ -34,7 +35,7 @@ runAllSpecs = -> packagePaths = _.groupBy packagePaths, (packagePath) -> if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0 'fixtures' - else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0 + else if packagePath.indexOf("#{resourcePath}#{path.sep}") is 0 'bundled' else 'user' From 87b530140bf65315493d4c15ace908523582987d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 21 Nov 2013 14:59:53 -0800 Subject: [PATCH 2/3] Remove window.resourcePath --- src/window.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/src/window.coffee b/src/window.coffee index 014f745fa..e8f50d644 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -11,7 +11,6 @@ windowEventHandler = null # This method is called in any window needing a general environment, including specs window.setUpEnvironment = (windowMode) -> atom.windowMode = windowMode - window.resourcePath = atom.getLoadSettings().resourcePath atom.initialize() # Set up the default event handlers and menus for a non-editor windows. From dd9aa2d02fbac6775ff002a4c21079faac9a6dca Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 21 Nov 2013 15:25:51 -0800 Subject: [PATCH 3/3] :lipstick: Remove extra space --- spec/spec-helper.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index 65da40e5d..6181e9f7c 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -70,7 +70,7 @@ beforeEach -> spyOn(atom.menu, 'sendToBrowserProcess') # reset config before each spec; don't load or save from/to `config.json` - config = new Config({resourcePath, configDirPath: atom.getConfigDirPath()}) + config = new Config({resourcePath, configDirPath: atom.getConfigDirPath()}) spyOn(config, 'load') spyOn(config, 'save') config.setDefaults('core', RootView.configDefaults)