mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Upgrade to fs-plus@0.4.0
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
"coffeestack": "0.6.0",
|
||||
"emissary": "0.9.0",
|
||||
"first-mate": "0.5.0",
|
||||
"fs-plus": "0.3.0",
|
||||
"fs-plus": "0.4.0",
|
||||
"fuzzaldrin": "0.1.0",
|
||||
"git-utils": "0.28.0",
|
||||
"guid": "0.0.10",
|
||||
|
||||
@@ -2179,7 +2179,7 @@ describe "Editor", ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = project.resolve('git/working-dir/file.txt')
|
||||
originalPathText = fs.readSync(filePath)
|
||||
originalPathText = fs.readFileSync(filePath, 'utf8')
|
||||
editor.edit(project.openSync(filePath))
|
||||
|
||||
afterEach ->
|
||||
|
||||
@@ -47,7 +47,7 @@ describe "Git", ->
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
filePath = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
newPath = path.join(__dirname, 'fixtures', 'git', 'working-dir', 'new-path.txt')
|
||||
originalPathText = fs.readSync(filePath)
|
||||
originalPathText = fs.readFileSync(filePath, 'utf8')
|
||||
|
||||
afterEach ->
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
@@ -93,9 +93,9 @@ describe "Git", ->
|
||||
beforeEach ->
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
path1 = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPath1Text = fs.readSync(path1)
|
||||
originalPath1Text = fs.readFileSync(path1, 'utf8')
|
||||
path2 = require.resolve('./fixtures/git/working-dir/other.txt')
|
||||
originalPath2Text = fs.readSync(path2)
|
||||
originalPath2Text = fs.readFileSync(path2, 'utf8')
|
||||
|
||||
afterEach ->
|
||||
fs.writeSync(path1, originalPath1Text)
|
||||
@@ -111,13 +111,13 @@ describe "Git", ->
|
||||
it "restores the contents of the path to the original text", ->
|
||||
fs.writeSync(path1, '')
|
||||
expect(repo.checkoutHead(path1)).toBeTruthy()
|
||||
expect(fs.readSync(path1)).toBe(originalPath1Text)
|
||||
expect(fs.readFileSync(path1, 'utf8')).toBe(originalPath1Text)
|
||||
|
||||
it "only restores the path specified", ->
|
||||
fs.writeSync(path2, 'path 2 is edited')
|
||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
||||
expect(repo.checkoutHead(path1)).toBeTruthy()
|
||||
expect(fs.readSync(path2)).toBe('path 2 is edited')
|
||||
expect(fs.readFileSync(path2, 'utf8')).toBe('path 2 is edited')
|
||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
||||
|
||||
it "fires a status-changed event if the checkout completes successfully", ->
|
||||
@@ -144,7 +144,7 @@ describe "Git", ->
|
||||
beforeEach ->
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
filePath = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fs.readSync(filePath)
|
||||
originalPathText = fs.readFileSync(filePath, 'utf8')
|
||||
|
||||
afterEach ->
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
@@ -160,7 +160,7 @@ describe "Git", ->
|
||||
beforeEach ->
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
filePath = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fs.readSync(filePath)
|
||||
originalPathText = fs.readFileSync(filePath, 'utf8')
|
||||
|
||||
afterEach ->
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
@@ -183,7 +183,7 @@ describe "Git", ->
|
||||
beforeEach ->
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
modifiedPath = project.resolve('git/working-dir/file.txt')
|
||||
originalModifiedPathText = fs.readSync(modifiedPath)
|
||||
originalModifiedPathText = fs.readFileSync(modifiedPath, 'utf8')
|
||||
newPath = project.resolve('git/working-dir/untracked.txt')
|
||||
cleanPath = project.resolve('git/working-dir/other.txt')
|
||||
fs.writeSync(newPath, '')
|
||||
|
||||
@@ -47,7 +47,7 @@ describe "the `syntax` global", ->
|
||||
|
||||
it "doesn't read the file when the file contents are specified", ->
|
||||
filePath = require.resolve("./fixtures/shebang")
|
||||
filePathContents = fs.readSync(filePath)
|
||||
filePathContents = fs.readFileSync(filePath, 'utf8')
|
||||
spyOn(fs, 'read').andCallThrough()
|
||||
expect(syntax.selectGrammar(filePath, filePathContents).name).toBe "Ruby"
|
||||
expect(fs.read).not.toHaveBeenCalled()
|
||||
|
||||
@@ -9,7 +9,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = require.resolve('./fixtures/sample.js')
|
||||
fileContents = fs.readSync(filePath)
|
||||
fileContents = fs.readFileSync(filePath, 'utf8')
|
||||
buffer = project.bufferForPathSync(filePath)
|
||||
|
||||
afterEach ->
|
||||
@@ -25,13 +25,13 @@ describe 'TextBuffer', ->
|
||||
it "loads the contents of that file", ->
|
||||
filePath = require.resolve './fixtures/sample.txt'
|
||||
buffer = project.bufferForPathSync(filePath)
|
||||
expect(buffer.getText()).toBe fs.readSync(filePath)
|
||||
expect(buffer.getText()).toBe fs.readFileSync(filePath, 'utf8')
|
||||
|
||||
it "does not allow the initial state of the buffer to be undone", ->
|
||||
filePath = require.resolve './fixtures/sample.txt'
|
||||
buffer = project.bufferForPathSync(filePath)
|
||||
buffer.undo()
|
||||
expect(buffer.getText()).toBe fs.readSync(filePath)
|
||||
expect(buffer.getText()).toBe fs.readFileSync(filePath, 'utf8')
|
||||
|
||||
describe "when no file exists for the path", ->
|
||||
it "is modified and is initially empty", ->
|
||||
@@ -472,7 +472,7 @@ describe 'TextBuffer', ->
|
||||
it "saves the contents of the buffer to the path", ->
|
||||
saveBuffer.setText 'Buffer contents!'
|
||||
saveBuffer.save()
|
||||
expect(fs.readSync(filePath)).toEqual 'Buffer contents!'
|
||||
expect(fs.readFileSync(filePath, 'utf8')).toEqual 'Buffer contents!'
|
||||
|
||||
it "fires will-be-saved and saved events around the call to fs.writeSync", ->
|
||||
events = []
|
||||
@@ -530,7 +530,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
saveAsBuffer.setText 'Buffer contents!'
|
||||
saveAsBuffer.saveAs(filePath)
|
||||
expect(fs.readSync(filePath)).toEqual 'Buffer contents!'
|
||||
expect(fs.readFileSync(filePath, 'utf8')).toEqual 'Buffer contents!'
|
||||
|
||||
expect(eventHandler).toHaveBeenCalledWith(saveAsBuffer)
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ describe "ThemeManager", ->
|
||||
|
||||
element = $('head style[id*="css.css"]')
|
||||
expect(element.attr('id')).toBe cssPath
|
||||
expect(element.text()).toBe fs.readSync(cssPath)
|
||||
expect(element.text()).toBe fs.readFileSync(cssPath, 'utf8')
|
||||
|
||||
# doesn't append twice
|
||||
themeManager.requireStylesheet(cssPath)
|
||||
|
||||
@@ -9,7 +9,7 @@ fs = require 'fs-plus'
|
||||
fs.exists = fs.existsSync
|
||||
fs.makeTree = fs.makeTreeSync
|
||||
fs.move = fs.moveSync
|
||||
fs.read = fs.readSync
|
||||
fs.read = (filePath) -> fs.readFileSync(filePath, 'utf8')
|
||||
fs.remove = fs.removeSync
|
||||
|
||||
fs = require 'fs-plus'
|
||||
@@ -277,7 +277,7 @@ class Atom
|
||||
if windowStatePath = @getWindowStatePath()
|
||||
if fs.existsSync(windowStatePath)
|
||||
try
|
||||
documentStateJson = fs.readSync(windowStatePath)
|
||||
documentStateJson = fs.readFileSync(windowStatePath, 'utf8')
|
||||
catch error
|
||||
console.warn "Error reading window state: #{windowStatePath}", error.stack, error
|
||||
else
|
||||
|
||||
@@ -17,7 +17,8 @@ class BindingSet
|
||||
name: null
|
||||
|
||||
constructor: (selector, commandsByKeystrokes, @index, @name) ->
|
||||
BindingSet.parser ?= PEG.buildParser(fs.readSync(require.resolve './keystroke-pattern.pegjs'))
|
||||
keystrokePattern = fs.readFileSync(require.resolve('./keystroke-pattern.pegjs'), 'utf8')
|
||||
BindingSet.parser ?= PEG.buildParser(keystrokePattern)
|
||||
@specificity = specificity(selector)
|
||||
@selector = selector.replace(/!important/g, '')
|
||||
@commandsByKeystrokes = @normalizeCommandsByKeystrokes(commandsByKeystrokes)
|
||||
|
||||
@@ -65,7 +65,7 @@ class File
|
||||
if not @exists()
|
||||
@cachedContents = null
|
||||
else if not @cachedContents? or flushCache
|
||||
@cachedContents = fs.readSync(@getPath())
|
||||
@cachedContents = fs.readFileSync(@getPath(), 'utf8')
|
||||
else
|
||||
@cachedContents
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class PackageManager
|
||||
|
||||
try
|
||||
metadataPath = path.join(@resourcePath, 'package.json')
|
||||
{packageDependencies} = JSON.parse(fs.readSync(metadataPath)) ? {}
|
||||
{packageDependencies} = JSON.parse(fs.readFileSync(metadataPath)) ? {}
|
||||
packagesPath = path.join(@resourcePath, 'node_modules')
|
||||
for packageName, packageVersion of packageDependencies ? {}
|
||||
packagePath = path.join(packagesPath, packageName)
|
||||
|
||||
@@ -73,7 +73,7 @@ class TextMateGrammar
|
||||
true
|
||||
|
||||
getScore: (filePath, contents) ->
|
||||
contents = fs.readSync(filePath) if not contents? and fs.isFileSync(filePath)
|
||||
contents = fs.readFileSync(filePath, 'utf8') if not contents? and fs.isFileSync(filePath)
|
||||
|
||||
if syntax.grammarOverrideForPath(filePath) is @scopeName
|
||||
2 + (filePath?.length ? 0)
|
||||
|
||||
@@ -142,7 +142,7 @@ class ThemeManager
|
||||
if path.extname(stylesheetPath) is '.less'
|
||||
@loadLessStylesheet(stylesheetPath)
|
||||
else
|
||||
fs.readSync(stylesheetPath)
|
||||
fs.readFileSync(stylesheetPath, 'utf8')
|
||||
|
||||
# Internal-only:
|
||||
loadLessStylesheet: (lessStylesheetPath) ->
|
||||
|
||||
Reference in New Issue
Block a user