mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Don’t load/save config if enablePersistence option is false
This commit is contained in:
@@ -11,8 +11,12 @@ describe "Config", ->
|
||||
spyOn(atom.config, "save")
|
||||
dotAtomPath = temp.path('dot-atom-dir')
|
||||
atom.config.configDirPath = dotAtomPath
|
||||
atom.config.enablePersistence = true
|
||||
atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
|
||||
|
||||
afterEach ->
|
||||
atom.config.enablePersistence = false
|
||||
|
||||
describe ".get(keyPath, {scope, sources, excludeSources})", ->
|
||||
it "allows a key path's value to be read", ->
|
||||
expect(atom.config.set("foo.bar.baz", 42)).toBe true
|
||||
|
||||
@@ -18,7 +18,11 @@ module.exports = ({logFile, headless, testPaths, buildAtomEnvironment}) ->
|
||||
applicationDelegate = new ApplicationDelegate()
|
||||
applicationDelegate.setRepresentedFilename = ->
|
||||
applicationDelegate.setWindowDocumentEdited = ->
|
||||
window.atom = buildAtomEnvironment({applicationDelegate, window, document})
|
||||
window.atom = buildAtomEnvironment({
|
||||
applicationDelegate, window, document,
|
||||
configDirPath: process.env.ATOM_HOME
|
||||
enablePersistence: false
|
||||
})
|
||||
|
||||
require './spec-helper'
|
||||
disableFocusMethods() if process.env.JANKY_SHA1 or process.env.CI
|
||||
|
||||
@@ -116,7 +116,7 @@ class AtomEnvironment extends Model
|
||||
|
||||
# Call .loadOrCreate instead
|
||||
constructor: (params={}) ->
|
||||
{@applicationDelegate, @window, @document, configDirPath} = params
|
||||
{@applicationDelegate, @window, @document, configDirPath, @enablePersistence} = params
|
||||
|
||||
@state = {version: @constructor.version}
|
||||
|
||||
@@ -133,7 +133,7 @@ class AtomEnvironment extends Model
|
||||
|
||||
@notifications = new NotificationManager
|
||||
|
||||
@config = new Config({configDirPath, resourcePath, notificationManager: @notifications})
|
||||
@config = new Config({configDirPath, resourcePath, notificationManager: @notifications, @enablePersistence})
|
||||
@setConfigSchema()
|
||||
|
||||
@keymaps = new KeymapManager({configDirPath, resourcePath, notificationManager: @notifications})
|
||||
|
||||
@@ -334,8 +334,8 @@ class Config
|
||||
value
|
||||
|
||||
# Created during initialization, available as `atom.config`
|
||||
constructor: ({@configDirPath, @resourcePath, @notificationManager}={}) ->
|
||||
if @configDirPath?
|
||||
constructor: ({@configDirPath, @resourcePath, @notificationManager, @enablePersistence}={}) ->
|
||||
if @enablePersistence?
|
||||
@configFilePath = fs.resolve(@configDirPath, 'config', ['json', 'cson'])
|
||||
@configFilePath ?= path.join(@configDirPath, 'config.cson')
|
||||
@clear()
|
||||
@@ -360,7 +360,7 @@ class Config
|
||||
@save()
|
||||
debouncedSave = _.debounce(save, 100)
|
||||
|
||||
shouldNotAccessFileSystem: -> not @configDirPath?
|
||||
shouldNotAccessFileSystem: -> not @enablePersistence
|
||||
|
||||
###
|
||||
Section: Config Subscription
|
||||
|
||||
@@ -16,7 +16,12 @@ process.env.NODE_ENV ?= 'production' unless devMode
|
||||
|
||||
AtomEnvironment = require './atom-environment'
|
||||
ApplicationDelegate = require './application-delegate'
|
||||
window.atom = new AtomEnvironment({applicationDelegate: new ApplicationDelegate, window, document, configDirPath: process.env.ATOM_HOME})
|
||||
window.atom = new AtomEnvironment({
|
||||
window, document,
|
||||
applicationDelegate: new ApplicationDelegate,
|
||||
configDirPath: process.env.ATOM_HOME
|
||||
enablePersistence: true
|
||||
})
|
||||
|
||||
atom.displayWindow()
|
||||
atom.loadStateSync()
|
||||
|
||||
Reference in New Issue
Block a user