From 304f63532e1e9e13c785475374b514dbdb661a7a Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 29 Dec 2014 15:25:44 -0600 Subject: [PATCH] =?UTF-8?q?Replace=20=E2=80=98global=E2=80=99=20config=20k?= =?UTF-8?q?ey=20with=20=E2=80=98*=E2=80=99=20selector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/config-spec.coffee | 14 +++++++------- src/config.coffee | 10 +++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee index 95599eb07..31e0756fc 100644 --- a/spec/config-spec.coffee +++ b/spec/config-spec.coffee @@ -599,7 +599,7 @@ describe "Config", -> expect(CSON.writeFileSync.argsForCall[0][0]).toBe atom.config.configFilePath writtenConfig = CSON.writeFileSync.argsForCall[0][1] - expect(writtenConfig).toEqual global: atom.config.settings + expect(writtenConfig).toEqual '*': atom.config.settings describe "when ~/.atom/config.json doesn't exist", -> it "writes any non-default properties to ~/.atom/config.cson", -> @@ -613,7 +613,7 @@ describe "Config", -> expect(CSON.writeFileSync.argsForCall[0][0]).toBe path.join(atom.config.configDirPath, "atom.config.cson") writtenConfig = CSON.writeFileSync.argsForCall[0][1] - expect(writtenConfig).toEqual global: atom.config.settings + expect(writtenConfig).toEqual '*': atom.config.settings describe "when scoped settings are defined", -> it 'writes out explicitly set config settings', -> @@ -626,7 +626,7 @@ describe "Config", -> writtenConfig = CSON.writeFileSync.argsForCall[0][1] expect(writtenConfig).toEqualJson - global: + '*': atom.config.settings '.ruby.source': foo: @@ -655,7 +655,7 @@ describe "Config", -> describe "when the config file contains scoped settings", -> beforeEach -> fs.writeFileSync atom.config.configFilePath, """ - global: + '*': foo: bar: 'baz' @@ -752,7 +752,7 @@ describe "Config", -> expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy() fs.writeFileSync atom.config.configFilePath, """ - global: + '*': foo: bar: 'baz' scoped: false @@ -817,7 +817,7 @@ describe "Config", -> atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], scopedSpy) writeConfigFile """ - global: + '*': foo: scoped: false """ @@ -832,7 +832,7 @@ describe "Config", -> atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], noChangeSpy) writeConfigFile """ - global: + '*': foo: bar: 'baz' '.source.ruby': diff --git a/src/config.coffee b/src/config.coffee index 775a35481..97989d24d 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -837,7 +837,7 @@ class Config console.error detail save: -> - allSettings = global: @settings + allSettings = {'*': @settings} allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource(@getUserConfigPath()) CSON.writeFileSync(@configFilePath, allSettings) @@ -852,9 +852,13 @@ class Config return if newSettings.global? + newSettings['*'] = newSettings.global + delete newSettings.global + + if newSettings['*']? scopedSettings = newSettings - newSettings = newSettings.global - delete scopedSettings.global + newSettings = newSettings['*'] + delete scopedSettings['*'] @resetUserScopedSettings(scopedSettings) @transact =>