From 0f5483a2ede0a02b5d06d35ced8e552b00fa800d Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 30 Sep 2015 14:04:09 -0600 Subject: [PATCH] Assign config schema on Atom environment construction --- spec/atom-spec.coffee | 2 +- spec/spec-helper.coffee | 4 +--- src/atom.coffee | 12 +++++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee index f0219d164..4d3021bef 100644 --- a/spec/atom-spec.coffee +++ b/spec/atom-spec.coffee @@ -52,7 +52,7 @@ describe "the `atom` global", -> expect(releaseVersion).toBe 'version' describe "loading default config", -> - it 'loads the default core config', -> + it 'loads the default core config schema', -> expect(atom.config.get('core.excludeVcsIgnoredPaths')).toBe true expect(atom.config.get('core.followSymlinks')).toBe true expect(atom.config.get('editor.showInvisibles')).toBe false diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index fd02e6fac..d0350dc62 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -126,7 +126,6 @@ beforeEach -> # reset config before each spec; don't load or save from/to `config.json` spyOn(atom.config, 'load') spyOn(atom.config, 'save') - atom.loadConfig() atom.config.set "core.destroyEmptyPanes", false atom.config.set "editor.fontFamily", "Courier" atom.config.set "editor.fontSize", 16 @@ -157,8 +156,6 @@ beforeEach -> addCustomMatchers(this) afterEach -> - atom.reset() - atom.packages.deactivatePackages() atom.menu.template = [] atom.contextMenu.clear() @@ -175,6 +172,7 @@ afterEach -> atom.themes.removeStylesheet('global-editor-styles') delete atom.state.packageStates + atom.reset() document.getElementById('jasmine-content').innerHTML = '' unless window.debugContent diff --git a/src/atom.coffee b/src/atom.coffee index 98f7682e4..a150fef2c 100644 --- a/src/atom.coffee +++ b/src/atom.coffee @@ -160,6 +160,7 @@ class Atom extends Model Config = require './config' @config = new Config({configDirPath, resourcePath, notificationManager: @notifications}) + @setConfigSchema() KeymapManager = require './keymap-extensions' @keymaps = new KeymapManager({configDirPath, resourcePath, notificationManager: @notifications}) @@ -204,6 +205,9 @@ class Atom extends Model registerDefaultCommands = require './register-default-commands' registerDefaultCommands(@commands) + setConfigSchema: -> + @config.setSchema null, {type: 'object', properties: _.clone(require('./config-schema'))} + registerDeserializersAndViewProviders: -> Workspace = require './workspace' PaneContainer = require './pane-container' @@ -240,6 +244,7 @@ class Atom extends Model reset: -> @config.reset() + @setConfigSchema() # Sets up the basic services that should be available in all modes # (both spec and application). @@ -566,7 +571,8 @@ class Atom extends Model commandInstaller.installApmCommand false, (error) -> console.warn error.message if error? - @loadConfig() + @config.load() + @themes.loadBaseStylesheets() @setBodyPlatformClass() @@ -747,10 +753,6 @@ class Atom extends Model @deserializeProject() @deserializeWorkspace() - loadConfig: -> - @config.setSchema null, {type: 'object', properties: _.clone(require('./config-schema'))} - @config.load() - loadThemes: -> @themes.load()