Assign config schema on Atom environment construction

This commit is contained in:
Nathan Sobo 2015-09-30 14:04:09 -06:00
parent 4ca09ef7d3
commit 0f5483a2ed
3 changed files with 9 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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()