mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
@@ -23,6 +23,7 @@
|
||||
* Commit messages that improve the format of the code start with :lipstick:
|
||||
* Commit messages that improve the performance start with :racehorse:
|
||||
* Commit messages that remove memory leaks start with :non-potable_water:
|
||||
* Commit messages that improve documentation start with :memo:
|
||||
* Files end with a newline
|
||||
* Class variables and methods should be in the following order:
|
||||
* Class variables (variables starting with a `@`)
|
||||
|
||||
@@ -22,6 +22,7 @@ module.exports = (grunt) ->
|
||||
expand: true
|
||||
src: [
|
||||
'src/**/*.coffee'
|
||||
'exports/**/*.coffee'
|
||||
'static/**/*.coffee'
|
||||
]
|
||||
dest: appDir
|
||||
@@ -89,6 +90,7 @@ module.exports = (grunt) ->
|
||||
level: 'ignore'
|
||||
src: [
|
||||
'dot-atom/**/*.coffee'
|
||||
'exports/**/*.coffee'
|
||||
'src/**/*.coffee'
|
||||
'tasks/**/*.coffee'
|
||||
'Gruntfile.coffee'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
require 'atom'
|
||||
{runSpecSuite} = require 'jasmine-helper'
|
||||
require '../src/atom'
|
||||
{runSpecSuite} = require '../spec/jasmine-helper'
|
||||
|
||||
atom.openDevTools()
|
||||
|
||||
|
||||
30
exports/atom.coffee
Normal file
30
exports/atom.coffee
Normal file
@@ -0,0 +1,30 @@
|
||||
{View, $$, $$$} = require '../src/space-pen-extensions'
|
||||
{Point, Range} = require 'telepath'
|
||||
|
||||
module.exports =
|
||||
_: require '../src/underscore-extensions'
|
||||
$: require '../src/jquery-extensions'
|
||||
$$: $$
|
||||
$$$: $$$
|
||||
BufferedNodeProcess: require '../src/buffered-node-process'
|
||||
BufferedProcess: require '../src/buffered-process'
|
||||
Directory: require '../src/directory'
|
||||
EventEmitter: require '../src/event-emitter'
|
||||
File: require '../src/file'
|
||||
fs: require '../src/fs-utils'
|
||||
Git: require '../src/git'
|
||||
Point: Point
|
||||
Range: Range
|
||||
ScrollView: require '../src/scroll-view'
|
||||
stringscore: require '../vendor/stringscore'
|
||||
Subscriber: require '../src/subscriber'
|
||||
View: View
|
||||
|
||||
# The following classes can't be used from a Task handler and should therefore
|
||||
# only be exported when not running as a child node process
|
||||
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
|
||||
module.exports.Editor = require '../src/editor'
|
||||
module.exports.pathForRepositoryUrl = require('../src/project').pathForRepositoryUrl
|
||||
module.exports.RootView = require '../src/root-view'
|
||||
module.exports.SelectList = require '../src/select-list'
|
||||
module.exports.Task = require '../src/task'
|
||||
3
exports/jquery.coffee
Normal file
3
exports/jquery.coffee
Normal file
@@ -0,0 +1,3 @@
|
||||
# FIXME Make jquery a package.json dependency
|
||||
# This is needed so that space-pen can be require it as 'jquery'
|
||||
module.exports = require '../vendor/jquery'
|
||||
66
package.json
66
package.json
@@ -18,7 +18,7 @@
|
||||
"first-mate": "0.1.0",
|
||||
"git-utils": "0.24.0",
|
||||
"guid": "0.0.10",
|
||||
"jasmine-focused": "~0.12.0",
|
||||
"jasmine-focused": "~0.14.0",
|
||||
"mkdirp": "0.3.5",
|
||||
"less": "git://github.com/nathansobo/less.js.git",
|
||||
"less-cache": "0.8.0",
|
||||
@@ -46,41 +46,41 @@
|
||||
"base16-tomorrow-dark-theme": "0.1.0",
|
||||
"solarized-dark-syntax": "0.1.0",
|
||||
|
||||
"archive-view": "0.5.0",
|
||||
"autocomplete": "0.4.0",
|
||||
"autoflow": "0.1.0",
|
||||
"bookmarks": "0.2.0",
|
||||
"bracket-matcher": "0.3.0",
|
||||
"collaboration": "0.10.0",
|
||||
"command-logger": "0.2.0",
|
||||
"command-palette": "0.2.0",
|
||||
"find-and-replace": "0.3.0",
|
||||
"fuzzy-finder": "0.4.0",
|
||||
"editor-stats": "0.1.0",
|
||||
"archive-view": "0.6.0",
|
||||
"autocomplete": "0.5.0",
|
||||
"autoflow": "0.2.0",
|
||||
"bookmarks": "0.3.0",
|
||||
"bracket-matcher": "0.4.0",
|
||||
"collaboration": "0.11.0",
|
||||
"command-logger": "0.3.0",
|
||||
"command-palette": "0.3.0",
|
||||
"editor-stats": "0.2.0",
|
||||
"find-and-replace": "0.4.0",
|
||||
"fuzzy-finder": "0.5.0",
|
||||
"gfm": "0.4.0",
|
||||
"git-diff": "0.2.0",
|
||||
"gists": "0.1.0",
|
||||
"github-sign-in": "0.1.0",
|
||||
"go-to-line": "0.2.0",
|
||||
"grammar-selector": "0.3.1",
|
||||
"image-view": "0.3.0",
|
||||
"link": "0.1.0",
|
||||
"markdown-preview": "0.2.0",
|
||||
"git-diff": "0.3.0",
|
||||
"gists": "0.2.0",
|
||||
"github-sign-in": "0.2.0",
|
||||
"go-to-line": "0.3.0",
|
||||
"grammar-selector": "0.4.0",
|
||||
"image-view": "0.4.0",
|
||||
"link": "0.2.0",
|
||||
"markdown-preview": "0.3.0",
|
||||
"metrics": "0.1.1",
|
||||
"package-generator": "0.6.0",
|
||||
"settings-view": "0.18.0",
|
||||
"snippets": "0.3.0",
|
||||
"spell-check": "0.3.0",
|
||||
"status-bar": "0.5.0",
|
||||
"symbols-view": "0.4.0",
|
||||
"tabs": "0.3.0",
|
||||
"terminal": "0.7.0",
|
||||
"to-the-hubs": "0.1.0",
|
||||
"package-generator": "0.7.0",
|
||||
"settings-view": "0.19.0",
|
||||
"snippets": "0.4.0",
|
||||
"spell-check": "0.4.0",
|
||||
"status-bar": "0.6.0",
|
||||
"symbols-view": "0.5.0",
|
||||
"tabs": "0.4.0",
|
||||
"terminal": "0.8.0",
|
||||
"to-the-hubs": "0.3.0",
|
||||
"toml": "0.2.0",
|
||||
"tree-view": "0.3.0",
|
||||
"ui-demo": "0.3.1",
|
||||
"whitespace": "0.3.0",
|
||||
"wrap-guide": "0.1.0",
|
||||
"tree-view": "0.4.0",
|
||||
"ui-demo": "0.4.0",
|
||||
"whitespace": "0.4.0",
|
||||
"wrap-guide": "0.2.0",
|
||||
|
||||
"c-tmbundle": "1.0.0",
|
||||
"coffee-script-tmbundle": "6.0.0",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
fsUtils = require 'fs-utils'
|
||||
{$} = require 'atom'
|
||||
path = require 'path'
|
||||
Package = require 'package'
|
||||
Package = require '../src/package'
|
||||
|
||||
describe "AtomPackage", ->
|
||||
describe "theme", ->
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$ = require 'jquery'
|
||||
{$} = require 'atom'
|
||||
|
||||
describe '"atom" protocol URL', ->
|
||||
it 'sends the file relative in the package as response', ->
|
||||
|
||||
@@ -7,7 +7,7 @@ sourceMaps = {}
|
||||
formatStackTrace = (stackTrace) ->
|
||||
return stackTrace unless stackTrace
|
||||
|
||||
jasminePath = require.resolve('jasmine')
|
||||
jasminePath = require.resolve('../vendor/jasmine')
|
||||
jasminePattern = new RegExp("\\(#{_.escapeRegExp(jasminePath)}:\\d+:\\d+\\)\\s*$")
|
||||
convertedLines = []
|
||||
for line in stackTrace.split('\n')
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
$ = require 'jquery'
|
||||
RootView = require 'root-view'
|
||||
{$$} = require 'space-pen'
|
||||
fsUtils = require 'fs-utils'
|
||||
{$, $$, fs, RootView} = require 'atom'
|
||||
Exec = require('child_process').exec
|
||||
path = require 'path'
|
||||
|
||||
@@ -71,7 +68,7 @@ describe "the `atom` global", ->
|
||||
describe "when the package has a main module", ->
|
||||
describe "when the metadata specifies a main module path˜", ->
|
||||
it "requires the module at the specified path", ->
|
||||
mainModule = require('fixtures/packages/package-with-main/main-module')
|
||||
mainModule = require('./fixtures/packages/package-with-main/main-module')
|
||||
spyOn(mainModule, 'activate')
|
||||
pack = atom.activatePackage('package-with-main')
|
||||
expect(mainModule.activate).toHaveBeenCalled()
|
||||
@@ -79,7 +76,7 @@ describe "the `atom` global", ->
|
||||
|
||||
describe "when the metadata does not specify a main module", ->
|
||||
it "requires index.coffee", ->
|
||||
indexModule = require('fixtures/packages/package-with-index/index')
|
||||
indexModule = require('./fixtures/packages/package-with-index/index')
|
||||
spyOn(indexModule, 'activate')
|
||||
pack = atom.activatePackage('package-with-index')
|
||||
expect(indexModule.activate).toHaveBeenCalled()
|
||||
@@ -95,9 +92,9 @@ describe "the `atom` global", ->
|
||||
[mainModule, pack] = []
|
||||
|
||||
beforeEach ->
|
||||
mainModule = require 'fixtures/packages/package-with-activation-events/index'
|
||||
mainModule = require './fixtures/packages/package-with-activation-events/index'
|
||||
spyOn(mainModule, 'activate').andCallThrough()
|
||||
AtomPackage = require 'atom-package'
|
||||
AtomPackage = require '../src/atom-package'
|
||||
spyOn(AtomPackage.prototype, 'requireMainModule').andCallThrough()
|
||||
pack = atom.activatePackage('package-with-activation-events')
|
||||
|
||||
@@ -177,9 +174,9 @@ describe "the `atom` global", ->
|
||||
describe "stylesheet loading", ->
|
||||
describe "when the metadata contains a 'stylesheets' manifest", ->
|
||||
it "loads stylesheets from the stylesheets directory as specified by the manifest", ->
|
||||
one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
|
||||
two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
|
||||
three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
|
||||
one = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
|
||||
two = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
|
||||
three = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
|
||||
expect(stylesheetElementForId(one)).not.toExist()
|
||||
expect(stylesheetElementForId(two)).not.toExist()
|
||||
expect(stylesheetElementForId(three)).not.toExist()
|
||||
@@ -193,9 +190,9 @@ describe "the `atom` global", ->
|
||||
|
||||
describe "when the metadata does not contain a 'stylesheets' manifest", ->
|
||||
it "loads all stylesheets from the stylesheets directory", ->
|
||||
one = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/1.css")
|
||||
two = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/2.less")
|
||||
three = fsUtils.resolveOnLoadPath("fixtures/packages/package-with-stylesheets/stylesheets/3.css")
|
||||
one = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/1.css")
|
||||
two = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/2.less")
|
||||
three = require.resolve("./fixtures/packages/package-with-stylesheets/stylesheets/3.css")
|
||||
expect(stylesheetElementForId(one)).not.toExist()
|
||||
expect(stylesheetElementForId(two)).not.toExist()
|
||||
expect(stylesheetElementForId(three)).not.toExist()
|
||||
@@ -292,9 +289,9 @@ describe "the `atom` global", ->
|
||||
it "removes the package's stylesheets", ->
|
||||
atom.activatePackage('package-with-stylesheets')
|
||||
atom.deactivatePackage('package-with-stylesheets')
|
||||
one = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/1.css")
|
||||
two = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/2.less")
|
||||
three = fsUtils.resolveOnLoadPath("package-with-stylesheets/stylesheets/3.css")
|
||||
one = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/1.css")
|
||||
two = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/2.less")
|
||||
three = require.resolve("./fixtures/packages/package-with-stylesheets-manifest/stylesheets/3.css")
|
||||
expect(stylesheetElementForId(one)).not.toExist()
|
||||
expect(stylesheetElementForId(two)).not.toExist()
|
||||
expect(stylesheetElementForId(three)).not.toExist()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
fs = require 'fs'
|
||||
fsUtils = require 'fs-utils'
|
||||
installer = require 'command-installer'
|
||||
{fs} = require 'atom'
|
||||
installer = require '../src/command-installer'
|
||||
|
||||
describe "install(commandPath, callback)", ->
|
||||
directory = '/tmp/install-atom-command/atom'
|
||||
@@ -11,13 +10,13 @@ describe "install(commandPath, callback)", ->
|
||||
spyOn(installer, 'findInstallDirectory').andCallFake (callback) ->
|
||||
callback(directory)
|
||||
|
||||
fsUtils.remove(directory) if fsUtils.exists(directory)
|
||||
fs.remove(directory) if fs.exists(directory)
|
||||
|
||||
it "symlinks the command and makes it executable", ->
|
||||
fsUtils.writeSync(commandPath, 'test')
|
||||
expect(fsUtils.isFileSync(commandPath)).toBeTruthy()
|
||||
expect(fsUtils.isExecutableSync(commandPath)).toBeFalsy()
|
||||
expect(fsUtils.isFileSync(destinationPath)).toBeFalsy()
|
||||
fs.writeSync(commandPath, 'test')
|
||||
expect(fs.isFileSync(commandPath)).toBeTruthy()
|
||||
expect(fs.isExecutableSync(commandPath)).toBeFalsy()
|
||||
expect(fs.isFileSync(destinationPath)).toBeFalsy()
|
||||
|
||||
installDone = false
|
||||
installError = null
|
||||
@@ -29,6 +28,6 @@ describe "install(commandPath, callback)", ->
|
||||
|
||||
runs ->
|
||||
expect(installError).toBeNull()
|
||||
expect(fsUtils.isFileSync(destinationPath)).toBeTruthy()
|
||||
expect(fs.isFileSync(destinationPath)).toBeTruthy()
|
||||
expect(fs.realpathSync(destinationPath)).toBe fs.realpathSync(commandPath)
|
||||
expect(fsUtils.isExecutableSync(destinationPath)).toBeTruthy()
|
||||
expect(fs.isExecutableSync(destinationPath)).toBeTruthy()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
fs = require 'fs'
|
||||
fsUtils = require 'fs-utils'
|
||||
{fs} = require 'atom'
|
||||
path = require 'path'
|
||||
CSON = require 'season'
|
||||
|
||||
@@ -77,8 +76,10 @@ describe "Config", ->
|
||||
expect(config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
|
||||
|
||||
describe ".save()", ->
|
||||
nodeFs = require 'fs'
|
||||
|
||||
beforeEach ->
|
||||
spyOn(fs, 'writeFileSync')
|
||||
spyOn(nodeFs, 'writeFileSync')
|
||||
jasmine.unspy config, 'save'
|
||||
|
||||
describe "when ~/.atom/config.json exists", ->
|
||||
@@ -89,11 +90,11 @@ describe "Config", ->
|
||||
config.set("x.y.z", 3)
|
||||
config.setDefaults("a.b", e: 4, f: 5)
|
||||
|
||||
fs.writeFileSync.reset()
|
||||
nodeFs.writeFileSync.reset()
|
||||
config.save()
|
||||
|
||||
expect(fs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.json"))
|
||||
writtenConfig = JSON.parse(fs.writeFileSync.argsForCall[0][1])
|
||||
expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.json"))
|
||||
writtenConfig = JSON.parse(nodeFs.writeFileSync.argsForCall[0][1])
|
||||
expect(writtenConfig).toEqual config.settings
|
||||
|
||||
describe "when ~/.atom/config.json doesn't exist", ->
|
||||
@@ -104,12 +105,12 @@ describe "Config", ->
|
||||
config.set("x.y.z", 3)
|
||||
config.setDefaults("a.b", e: 4, f: 5)
|
||||
|
||||
fs.writeFileSync.reset()
|
||||
nodeFs.writeFileSync.reset()
|
||||
config.save()
|
||||
|
||||
expect(fs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.cson"))
|
||||
expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.cson"))
|
||||
CoffeeScript = require 'coffee-script'
|
||||
writtenConfig = CoffeeScript.eval(fs.writeFileSync.argsForCall[0][1], bare: true)
|
||||
writtenConfig = CoffeeScript.eval(nodeFs.writeFileSync.argsForCall[0][1], bare: true)
|
||||
expect(writtenConfig).toEqual config.settings
|
||||
|
||||
describe ".setDefaults(keyPath, defaults)", ->
|
||||
@@ -162,10 +163,10 @@ describe "Config", ->
|
||||
describe ".initializeConfigDirectory()", ->
|
||||
beforeEach ->
|
||||
config.configDirPath = '/tmp/dot-atom-dir'
|
||||
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
|
||||
expect(fs.exists(config.configDirPath)).toBeFalsy()
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove('/tmp/dot-atom-dir') if fsUtils.exists('/tmp/dot-atom-dir')
|
||||
fs.remove('/tmp/dot-atom-dir') if fs.exists('/tmp/dot-atom-dir')
|
||||
|
||||
describe "when the configDirPath doesn't exist", ->
|
||||
it "copies the contents of dot-atom to ~/.atom", ->
|
||||
@@ -177,24 +178,24 @@ describe "Config", ->
|
||||
waitsFor -> initializationDone
|
||||
|
||||
runs ->
|
||||
expect(fsUtils.exists(config.configDirPath)).toBeTruthy()
|
||||
expect(fsUtils.exists(path.join(config.configDirPath, 'packages'))).toBeTruthy()
|
||||
expect(fsUtils.exists(path.join(config.configDirPath, 'snippets'))).toBeTruthy()
|
||||
expect(fsUtils.exists(path.join(config.configDirPath, 'themes'))).toBeTruthy()
|
||||
expect(fsUtils.isFileSync(path.join(config.configDirPath, 'config.cson'))).toBeTruthy()
|
||||
expect(fs.exists(config.configDirPath)).toBeTruthy()
|
||||
expect(fs.exists(path.join(config.configDirPath, 'packages'))).toBeTruthy()
|
||||
expect(fs.exists(path.join(config.configDirPath, 'snippets'))).toBeTruthy()
|
||||
expect(fs.exists(path.join(config.configDirPath, 'themes'))).toBeTruthy()
|
||||
expect(fs.isFileSync(path.join(config.configDirPath, 'config.cson'))).toBeTruthy()
|
||||
|
||||
describe ".loadUserConfig()", ->
|
||||
beforeEach ->
|
||||
config.configDirPath = '/tmp/dot-atom-dir'
|
||||
config.configFilePath = path.join(config.configDirPath, "config.cson")
|
||||
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
|
||||
expect(fs.exists(config.configDirPath)).toBeFalsy()
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove('/tmp/dot-atom-dir') if fsUtils.exists('/tmp/dot-atom-dir')
|
||||
fs.remove('/tmp/dot-atom-dir') if fs.exists('/tmp/dot-atom-dir')
|
||||
|
||||
describe "when the config file contains valid cson", ->
|
||||
beforeEach ->
|
||||
fsUtils.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
fs.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
config.loadUserConfig()
|
||||
|
||||
it "updates the config data based on the file contents", ->
|
||||
@@ -203,7 +204,7 @@ describe "Config", ->
|
||||
describe "when the config file contains invalid cson", ->
|
||||
beforeEach ->
|
||||
spyOn(console, 'error')
|
||||
fsUtils.writeSync(config.configFilePath, "{{{{{")
|
||||
fs.writeSync(config.configFilePath, "{{{{{")
|
||||
|
||||
it "logs an error to the console and does not overwrite the config file on a subsequent save", ->
|
||||
config.loadUserConfig()
|
||||
@@ -213,9 +214,9 @@ describe "Config", ->
|
||||
|
||||
describe "when the config file does not exist", ->
|
||||
it "creates it with an empty object", ->
|
||||
fsUtils.makeTree(config.configDirPath)
|
||||
fs.makeTree(config.configDirPath)
|
||||
config.loadUserConfig()
|
||||
expect(fsUtils.exists(config.configFilePath)).toBe true
|
||||
expect(fs.exists(config.configFilePath)).toBe true
|
||||
expect(CSON.readFileSync(config.configFilePath)).toEqual {}
|
||||
|
||||
describe ".observeUserConfig()", ->
|
||||
@@ -224,8 +225,8 @@ describe "Config", ->
|
||||
beforeEach ->
|
||||
config.configDirPath = '/tmp/dot-atom-dir'
|
||||
config.configFilePath = path.join(config.configDirPath, "config.cson")
|
||||
expect(fsUtils.exists(config.configDirPath)).toBeFalsy()
|
||||
fsUtils.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
expect(fs.exists(config.configDirPath)).toBeFalsy()
|
||||
fs.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
config.loadUserConfig()
|
||||
config.observeUserConfig()
|
||||
updatedHandler = jasmine.createSpy("updatedHandler")
|
||||
@@ -233,11 +234,11 @@ describe "Config", ->
|
||||
|
||||
afterEach ->
|
||||
config.unobserveUserConfig()
|
||||
fsUtils.remove('/tmp/dot-atom-dir') if fsUtils.exists('/tmp/dot-atom-dir')
|
||||
fs.remove('/tmp/dot-atom-dir') if fs.exists('/tmp/dot-atom-dir')
|
||||
|
||||
describe "when the config file changes to contain valid cson", ->
|
||||
it "updates the config data", ->
|
||||
fsUtils.writeSync(config.configFilePath, "foo: { bar: 'quux', baz: 'bar'}")
|
||||
fs.writeSync(config.configFilePath, "foo: { bar: 'quux', baz: 'bar'}")
|
||||
waitsFor 'update event', -> updatedHandler.callCount > 0
|
||||
runs ->
|
||||
expect(config.get('foo.bar')).toBe 'quux'
|
||||
@@ -246,7 +247,7 @@ describe "Config", ->
|
||||
describe "when the config file changes to contain invalid cson", ->
|
||||
beforeEach ->
|
||||
spyOn(console, 'error')
|
||||
fsUtils.writeSync(config.configFilePath, "}}}")
|
||||
fs.writeSync(config.configFilePath, "}}}")
|
||||
waitsFor "error to be logged", -> console.error.callCount > 0
|
||||
|
||||
it "logs a warning and does not update config data", ->
|
||||
@@ -257,7 +258,7 @@ describe "Config", ->
|
||||
|
||||
describe "when the config file subsequently changes again to contain valid cson", ->
|
||||
beforeEach ->
|
||||
fsUtils.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
fs.writeSync(config.configFilePath, "foo: bar: 'baz'")
|
||||
waitsFor 'update event', -> updatedHandler.callCount > 0
|
||||
|
||||
it "updates the config data and resumes saving", ->
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
Directory = require 'directory'
|
||||
fsUtils = require 'fs-utils'
|
||||
Directory = require '../src/directory'
|
||||
{fs} = require 'atom'
|
||||
path = require 'path'
|
||||
|
||||
describe "Directory", ->
|
||||
directory = null
|
||||
|
||||
beforeEach ->
|
||||
directory = new Directory(fsUtils.resolveOnLoadPath('fixtures'))
|
||||
directory = new Directory(path.join(__dirname, 'fixtures'))
|
||||
|
||||
afterEach ->
|
||||
directory.off()
|
||||
@@ -15,11 +15,11 @@ describe "Directory", ->
|
||||
temporaryFilePath = null
|
||||
|
||||
beforeEach ->
|
||||
temporaryFilePath = path.join(fsUtils.resolveOnLoadPath('fixtures'), 'temporary')
|
||||
fsUtils.remove(temporaryFilePath) if fsUtils.exists(temporaryFilePath)
|
||||
temporaryFilePath = path.join(__dirname, 'fixtures', 'temporary')
|
||||
fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(temporaryFilePath) if fsUtils.exists(temporaryFilePath)
|
||||
fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath)
|
||||
|
||||
it "triggers 'contents-changed' event handlers", ->
|
||||
changeHandler = null
|
||||
@@ -27,13 +27,13 @@ describe "Directory", ->
|
||||
runs ->
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
directory.on 'contents-changed', changeHandler
|
||||
fsUtils.writeSync(temporaryFilePath, '')
|
||||
fs.writeSync(temporaryFilePath, '')
|
||||
|
||||
waitsFor "first change", -> changeHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
changeHandler.reset()
|
||||
fsUtils.remove(temporaryFilePath)
|
||||
fs.remove(temporaryFilePath)
|
||||
|
||||
waitsFor "second change", -> changeHandler.callCount > 0
|
||||
|
||||
@@ -42,10 +42,10 @@ describe "Directory", ->
|
||||
|
||||
beforeEach ->
|
||||
temporaryFilePath = path.join(directory.path, 'temporary')
|
||||
fsUtils.remove(temporaryFilePath) if fsUtils.exists(temporaryFilePath)
|
||||
fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(temporaryFilePath) if fsUtils.exists(temporaryFilePath)
|
||||
fs.remove(temporaryFilePath) if fs.exists(temporaryFilePath)
|
||||
|
||||
it "no longer triggers events", ->
|
||||
changeHandler = null
|
||||
@@ -53,7 +53,7 @@ describe "Directory", ->
|
||||
runs ->
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
directory.on 'contents-changed', changeHandler
|
||||
fsUtils.writeSync(temporaryFilePath, '')
|
||||
fs.writeSync(temporaryFilePath, '')
|
||||
|
||||
waitsFor "change event", -> changeHandler.callCount > 0
|
||||
|
||||
@@ -62,7 +62,7 @@ describe "Directory", ->
|
||||
directory.off()
|
||||
waits 20
|
||||
|
||||
runs -> fsUtils.remove(temporaryFilePath)
|
||||
runs -> fs.remove(temporaryFilePath)
|
||||
waits 20
|
||||
runs -> expect(changeHandler.callCount).toBe 0
|
||||
|
||||
@@ -84,9 +84,9 @@ describe "Directory", ->
|
||||
expect(directory.relativize(path.join(absolutePath, "file.coffee"))).toBe "file.coffee"
|
||||
|
||||
it "returns a relative path based on the directory's symlinked source path", ->
|
||||
symlinkPath = path.join(fsUtils.resolveOnLoadPath('fixtures'), 'symlink-to-dir')
|
||||
symlinkPath = path.join(__dirname, 'fixtures', 'symlink-to-dir')
|
||||
symlinkDirectory = new Directory(symlinkPath)
|
||||
realFilePath = fsUtils.resolveOnLoadPath('fixtures/dir/a')
|
||||
realFilePath = require.resolve('./fixtures/dir/a')
|
||||
expect(symlinkDirectory.relativize(symlinkPath)).toBe ''
|
||||
expect(symlinkDirectory.relativize(realFilePath)).toBe 'a'
|
||||
|
||||
@@ -97,13 +97,13 @@ describe "Directory", ->
|
||||
it "returns true if the path is a child of the directory's path", ->
|
||||
absolutePath = directory.getPath()
|
||||
expect(directory.contains(path.join(absolutePath, "b"))).toBe true
|
||||
expect(directory.contains(path.join(absolutePath, "b/file.coffee"))).toBe true
|
||||
expect(directory.contains(path.join(absolutePath, "b", "file.coffee"))).toBe true
|
||||
expect(directory.contains(path.join(absolutePath, "file.coffee"))).toBe true
|
||||
|
||||
it "returns true if the path is a child of the directory's symlinked source path", ->
|
||||
symlinkPath = path.join(fsUtils.resolveOnLoadPath('fixtures'), 'symlink-to-dir')
|
||||
symlinkPath = path.join(__dirname, 'fixtures', 'symlink-to-dir')
|
||||
symlinkDirectory = new Directory(symlinkPath)
|
||||
realFilePath = fsUtils.resolveOnLoadPath('fixtures/dir/a')
|
||||
realFilePath = require.resolve('./fixtures/dir/a')
|
||||
expect(symlinkDirectory.contains(realFilePath)).toBe true
|
||||
|
||||
it "returns false if the directory's path is not a prefix of the path", ->
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
DisplayBuffer = require 'display-buffer'
|
||||
Buffer = require 'text-buffer'
|
||||
_ = require 'underscore'
|
||||
DisplayBuffer = require '../src/display-buffer'
|
||||
{_} = require 'atom'
|
||||
|
||||
describe "DisplayBuffer", ->
|
||||
[displayBuffer, buffer, changeHandler, tabLength] = []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{Site} = require 'telepath'
|
||||
Environment = require 'environment'
|
||||
Environment = require './environment'
|
||||
|
||||
describe "EditSession replication", ->
|
||||
[env1, env2, editSession1, editSession2] = []
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
Project = require 'project'
|
||||
Buffer = require 'text-buffer'
|
||||
EditSession = require 'edit-session'
|
||||
clipboard = require 'clipboard'
|
||||
|
||||
describe "EditSession", ->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{Site} = require 'telepath'
|
||||
Editor = require 'editor'
|
||||
Environment = require 'environment'
|
||||
Editor = require '../src/editor'
|
||||
Environment = require './environment'
|
||||
|
||||
describe "Editor replication", ->
|
||||
[env1, env2, editSession1, editSession2, editor1, editor2] = []
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
RootView = require 'root-view'
|
||||
EditSession = require 'edit-session'
|
||||
Buffer = require 'text-buffer'
|
||||
Editor = require 'editor'
|
||||
{_, $, $$, fs, RootView} = require 'atom'
|
||||
Editor = require '../src/editor'
|
||||
{Range} = require 'telepath'
|
||||
Project = require 'project'
|
||||
$ = require 'jquery'
|
||||
{$$} = require 'space-pen'
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
|
||||
describe "Editor", ->
|
||||
@@ -85,7 +78,7 @@ describe "Editor", ->
|
||||
describe "when the activeEditSession's file is modified on disk", ->
|
||||
it "triggers an alert", ->
|
||||
filePath = "/tmp/atom-changed-file.txt"
|
||||
fsUtils.writeSync(filePath, "")
|
||||
fs.writeSync(filePath, "")
|
||||
editSession = project.open(filePath)
|
||||
editor.edit(editSession)
|
||||
editor.insertText("now the buffer is modified")
|
||||
@@ -95,7 +88,7 @@ describe "Editor", ->
|
||||
|
||||
spyOn(atom, "confirm")
|
||||
|
||||
fsUtils.writeSync(filePath, "a file change")
|
||||
fs.writeSync(filePath, "a file change")
|
||||
|
||||
waitsFor "file to trigger contents-changed event", ->
|
||||
fileChangeHandler.callCount > 0
|
||||
@@ -150,7 +143,7 @@ describe "Editor", ->
|
||||
|
||||
it "triggers alert if edit session's buffer goes into conflict with changes on disk", ->
|
||||
filePath = "/tmp/atom-changed-file.txt"
|
||||
fsUtils.writeSync(filePath, "")
|
||||
fs.writeSync(filePath, "")
|
||||
tempEditSession = project.open(filePath)
|
||||
editor.edit(tempEditSession)
|
||||
tempEditSession.insertText("a buffer change")
|
||||
@@ -159,7 +152,7 @@ describe "Editor", ->
|
||||
|
||||
contentsConflictedHandler = jasmine.createSpy("contentsConflictedHandler")
|
||||
tempEditSession.on 'contents-conflicted', contentsConflictedHandler
|
||||
fsUtils.writeSync(filePath, "a file change")
|
||||
fs.writeSync(filePath, "a file change")
|
||||
waitsFor ->
|
||||
contentsConflictedHandler.callCount > 0
|
||||
|
||||
@@ -246,10 +239,10 @@ describe "Editor", ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = "/tmp/something.txt"
|
||||
fsUtils.writeSync(filePath, filePath)
|
||||
fs.writeSync(filePath, filePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
|
||||
it "emits event when buffer's path is changed", ->
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
@@ -2108,11 +2101,11 @@ describe "Editor", ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = project.resolve('git/working-dir/file.txt')
|
||||
originalPathText = fsUtils.read(filePath)
|
||||
originalPathText = fs.read(filePath)
|
||||
editor.edit(project.open(filePath))
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(filePath, originalPathText)
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
|
||||
it "restores the contents of the editor to the HEAD revision", ->
|
||||
editor.setText('')
|
||||
@@ -2223,11 +2216,11 @@ describe "Editor", ->
|
||||
[filePath] = []
|
||||
|
||||
beforeEach ->
|
||||
filePath = path.join(fsUtils.absolute("/tmp"), "grammar-change.txt")
|
||||
fsUtils.writeSync(filePath, "var i;")
|
||||
filePath = path.join(fs.absolute("/tmp"), "grammar-change.txt")
|
||||
fs.writeSync(filePath, "var i;")
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
|
||||
it "updates all the rendered lines when the grammar changes", ->
|
||||
editor.edit(project.open(filePath))
|
||||
@@ -2571,15 +2564,15 @@ describe "Editor", ->
|
||||
it "saves the state of the rendered lines, the display buffer, and the buffer to a file of the user's choosing", ->
|
||||
saveDialogCallback = null
|
||||
spyOn(atom, 'showSaveDialog').andCallFake (callback) -> saveDialogCallback = callback
|
||||
spyOn(fsUtils, 'writeSync')
|
||||
spyOn(fs, 'writeSync')
|
||||
|
||||
editor.trigger 'editor:save-debug-snapshot'
|
||||
|
||||
expect(atom.showSaveDialog).toHaveBeenCalled()
|
||||
saveDialogCallback('/tmp/state')
|
||||
expect(fsUtils.writeSync).toHaveBeenCalled()
|
||||
expect(fsUtils.writeSync.argsForCall[0][0]).toBe '/tmp/state'
|
||||
expect(typeof fsUtils.writeSync.argsForCall[0][1]).toBe 'string'
|
||||
expect(fs.writeSync).toHaveBeenCalled()
|
||||
expect(fs.writeSync.argsForCall[0][0]).toBe '/tmp/state'
|
||||
expect(typeof fs.writeSync.argsForCall[0][1]).toBe 'string'
|
||||
|
||||
describe "when the escape key is pressed on the editor", ->
|
||||
it "clears multiple selections if there are any, and otherwise allows other bindings to be handled", ->
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
path = require 'path'
|
||||
{Site} = require 'telepath'
|
||||
fsUtils = require 'fs-utils'
|
||||
Project = require 'project'
|
||||
{fs} = require 'atom'
|
||||
Project = require '../src/project'
|
||||
|
||||
module.exports =
|
||||
class Environment
|
||||
@@ -10,7 +11,7 @@ class Environment
|
||||
@run => @project = deserialize(@state.get('project'))
|
||||
else
|
||||
@state = @site.createDocument({})
|
||||
@project = new Project(projectPath ? fsUtils.resolveOnLoadPath('fixtures'))
|
||||
@project = new Project(projectPath ? path.join(__dirname, 'fixtures'))
|
||||
@state.set(project: @project.getState())
|
||||
|
||||
clone: (params) ->
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require 'event-emitter'
|
||||
{_} = require 'atom'
|
||||
EventEmitter = require '../src/event-emitter'
|
||||
|
||||
describe "EventEmitter mixin", ->
|
||||
[object, fooHandler1, fooHandler2, barHandler] = []
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
File = require 'file'
|
||||
fsUtils = require 'fs-utils'
|
||||
{File, fs} = require 'atom'
|
||||
path = require 'path'
|
||||
|
||||
describe 'File', ->
|
||||
[filePath, file] = []
|
||||
|
||||
beforeEach ->
|
||||
filePath = path.join(fsUtils.resolveOnLoadPath('fixtures'), "atom-file-test.txt") # Don't put in /tmp because /tmp symlinks to /private/tmp and screws up the rename test
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fsUtils.writeSync(filePath, "this is old!")
|
||||
filePath = path.join(__dirname, 'fixtures', 'atom-file-test.txt') # Don't put in /tmp because /tmp symlinks to /private/tmp and screws up the rename test
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
fs.writeSync(filePath, "this is old!")
|
||||
file = new File(filePath)
|
||||
|
||||
afterEach ->
|
||||
file.off()
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
|
||||
describe "when the file has not been read", ->
|
||||
describe "when the contents of the file change", ->
|
||||
it "triggers 'contents-changed' event handlers", ->
|
||||
file.on 'contents-changed', changeHandler = jasmine.createSpy('changeHandler')
|
||||
fsUtils.writeSync(file.getPath(), "this is new!")
|
||||
fs.writeSync(file.getPath(), "this is new!")
|
||||
|
||||
waitsFor "change event", ->
|
||||
changeHandler.callCount > 0
|
||||
@@ -33,14 +32,14 @@ describe 'File', ->
|
||||
changeHandler = null
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
file.on 'contents-changed', changeHandler
|
||||
fsUtils.writeSync(file.getPath(), "this is new!")
|
||||
fs.writeSync(file.getPath(), "this is new!")
|
||||
|
||||
waitsFor "change event", ->
|
||||
changeHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
changeHandler.reset()
|
||||
fsUtils.writeSync(file.getPath(), "this is newer!")
|
||||
fs.writeSync(file.getPath(), "this is newer!")
|
||||
|
||||
waitsFor "second change event", ->
|
||||
changeHandler.callCount > 0
|
||||
@@ -50,7 +49,7 @@ describe 'File', ->
|
||||
removeHandler = null
|
||||
removeHandler = jasmine.createSpy('removeHandler')
|
||||
file.on 'removed', removeHandler
|
||||
fsUtils.remove(file.getPath())
|
||||
fs.remove(file.getPath())
|
||||
|
||||
waitsFor "remove event", ->
|
||||
removeHandler.callCount > 0
|
||||
@@ -62,8 +61,8 @@ describe 'File', ->
|
||||
newPath = path.join(path.dirname(filePath), "atom-file-was-moved-test.txt")
|
||||
|
||||
afterEach ->
|
||||
if fsUtils.exists(newPath)
|
||||
fsUtils.remove(newPath)
|
||||
if fs.exists(newPath)
|
||||
fs.remove(newPath)
|
||||
waitsFor "remove event", (done) -> file.on 'removed', done
|
||||
|
||||
it "it updates its path", ->
|
||||
@@ -72,7 +71,7 @@ describe 'File', ->
|
||||
moveHandler = jasmine.createSpy('moveHandler')
|
||||
file.on 'moved', moveHandler
|
||||
|
||||
fsUtils.move(filePath, newPath)
|
||||
fs.move(filePath, newPath)
|
||||
|
||||
waitsFor "move event", ->
|
||||
moveHandler.callCount > 0
|
||||
@@ -89,14 +88,14 @@ describe 'File', ->
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
file.on 'contents-changed', changeHandler
|
||||
|
||||
fsUtils.move(filePath, newPath)
|
||||
fs.move(filePath, newPath)
|
||||
|
||||
waitsFor "move event", ->
|
||||
moveHandler.callCount > 0
|
||||
|
||||
runs ->
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
fsUtils.writeSync(file.getPath(), "this is new!")
|
||||
fs.writeSync(file.getPath(), "this is new!")
|
||||
|
||||
waitsFor "change event", ->
|
||||
changeHandler.callCount > 0
|
||||
@@ -113,12 +112,12 @@ describe 'File', ->
|
||||
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
|
||||
fsUtils.remove(filePath)
|
||||
fs.remove(filePath)
|
||||
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
waits 20
|
||||
runs ->
|
||||
fsUtils.writeSync(filePath, "HE HAS RISEN!")
|
||||
fs.writeSync(filePath, "HE HAS RISEN!")
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
|
||||
waitsFor "resurrection change event", ->
|
||||
@@ -126,7 +125,7 @@ describe 'File', ->
|
||||
|
||||
runs ->
|
||||
expect(removeHandler).not.toHaveBeenCalled()
|
||||
fsUtils.writeSync(filePath, "Hallelujah!")
|
||||
fs.writeSync(filePath, "Hallelujah!")
|
||||
changeHandler.reset()
|
||||
|
||||
waitsFor "post-resurrection change event", ->
|
||||
|
||||
@@ -1,59 +1,53 @@
|
||||
fsUtils = require 'fs-utils'
|
||||
fs = require 'fs'
|
||||
{fs} = require 'atom'
|
||||
path = require 'path'
|
||||
temp = require 'temp'
|
||||
|
||||
describe "fsUtils", ->
|
||||
describe "fs", ->
|
||||
fixturesDir = path.join(__dirname, 'fixtures')
|
||||
|
||||
describe ".read(path)", ->
|
||||
it "return contents of file", ->
|
||||
expect(fsUtils.read(require.resolve("fixtures/sample.txt"))).toBe "Some text.\n"
|
||||
expect(fs.read(require.resolve("./fixtures/sample.txt"))).toBe "Some text.\n"
|
||||
|
||||
it "does not through an exception when the path is a binary file", ->
|
||||
expect(-> fsUtils.read(require.resolve("fixtures/binary-file.png"))).not.toThrow()
|
||||
expect(-> fs.read(require.resolve("./fixtures/binary-file.png"))).not.toThrow()
|
||||
|
||||
describe ".isFileSync(path)", ->
|
||||
fixturesDir = fsUtils.resolveOnLoadPath('fixtures')
|
||||
|
||||
it "returns true with a file path", ->
|
||||
expect(fsUtils.isFileSync(path.join(fixturesDir, 'sample.js'))).toBe true
|
||||
expect(fs.isFileSync(path.join(fixturesDir, 'sample.js'))).toBe true
|
||||
|
||||
it "returns false with a directory path", ->
|
||||
expect(fsUtils.isFileSync(fixturesDir)).toBe false
|
||||
expect(fs.isFileSync(fixturesDir)).toBe false
|
||||
|
||||
it "returns false with a non-existent path", ->
|
||||
expect(fsUtils.isFileSync(path.join(fixturesDir, 'non-existent'))).toBe false
|
||||
expect(fsUtils.isFileSync(null)).toBe false
|
||||
expect(fs.isFileSync(path.join(fixturesDir, 'non-existent'))).toBe false
|
||||
expect(fs.isFileSync(null)).toBe false
|
||||
|
||||
describe ".exists(path)", ->
|
||||
it "returns true when path exsits", ->
|
||||
expect(fsUtils.exists(fsUtils.resolveOnLoadPath('fixtures'))).toBe true
|
||||
expect(fs.exists(fixturesDir)).toBe true
|
||||
|
||||
it "returns false when path doesn't exsit", ->
|
||||
expect(fsUtils.exists(fsUtils.resolveOnLoadPath("fixtures") + "/-nope-does-not-exist")).toBe false
|
||||
expect(fsUtils.exists("")).toBe false
|
||||
expect(fsUtils.exists(null)).toBe false
|
||||
expect(fs.exists(path.join(fixturesDir, "-nope-does-not-exist"))).toBe false
|
||||
expect(fs.exists("")).toBe false
|
||||
expect(fs.exists(null)).toBe false
|
||||
|
||||
describe ".makeTree(path)", ->
|
||||
beforeEach ->
|
||||
fsUtils.remove("/tmp/a") if fsUtils.exists("/tmp/a")
|
||||
fs.remove("/tmp/a") if fs.exists("/tmp/a")
|
||||
|
||||
it "creates all directories in path including any missing parent directories", ->
|
||||
fsUtils.makeTree("/tmp/a/b/c")
|
||||
expect(fsUtils.exists("/tmp/a/b/c")).toBeTruthy()
|
||||
fs.makeTree("/tmp/a/b/c")
|
||||
expect(fs.exists("/tmp/a/b/c")).toBeTruthy()
|
||||
|
||||
describe ".traverseTreeSync(path, onFile, onDirectory)", ->
|
||||
fixturesDir = null
|
||||
|
||||
beforeEach ->
|
||||
fixturesDir = fsUtils.resolveOnLoadPath('fixtures')
|
||||
|
||||
it "calls fn for every path in the tree at the given path", ->
|
||||
paths = []
|
||||
onPath = (childPath) ->
|
||||
paths.push(childPath)
|
||||
true
|
||||
fsUtils.traverseTreeSync fixturesDir, onPath, onPath
|
||||
expect(paths).toEqual fsUtils.listTreeSync(fixturesDir)
|
||||
fs.traverseTreeSync fixturesDir, onPath, onPath
|
||||
expect(paths).toEqual fs.listTreeSync(fixturesDir)
|
||||
|
||||
it "does not recurse into a directory if it is pruned", ->
|
||||
paths = []
|
||||
@@ -63,7 +57,7 @@ describe "fsUtils", ->
|
||||
else
|
||||
paths.push(childPath)
|
||||
true
|
||||
fsUtils.traverseTreeSync fixturesDir, onPath, onPath
|
||||
fs.traverseTreeSync fixturesDir, onPath, onPath
|
||||
|
||||
expect(paths.length).toBeGreaterThan 0
|
||||
for filePath in paths
|
||||
@@ -78,8 +72,8 @@ describe "fsUtils", ->
|
||||
paths = []
|
||||
onPath = (path) -> paths.push(path.substring(regularPath.length + 1))
|
||||
|
||||
fsUtils.traverseTreeSync(symlinkPath, onSymlinkPath, onSymlinkPath)
|
||||
fsUtils.traverseTreeSync(regularPath, onPath, onPath)
|
||||
fs.traverseTreeSync(symlinkPath, onSymlinkPath, onSymlinkPath)
|
||||
fs.traverseTreeSync(regularPath, onPath, onPath)
|
||||
|
||||
expect(symlinkPaths).toEqual(paths)
|
||||
|
||||
@@ -88,26 +82,26 @@ describe "fsUtils", ->
|
||||
paths = []
|
||||
onPath = (childPath) -> paths.push(childPath)
|
||||
fs.symlinkSync(path.join(directory, 'source'), path.join(directory, 'destination'))
|
||||
fsUtils.traverseTreeSync(directory, onPath)
|
||||
fs.traverseTreeSync(directory, onPath)
|
||||
expect(paths.length).toBe 0
|
||||
|
||||
describe ".md5ForPath(path)", ->
|
||||
it "returns the MD5 hash of the file at the given path", ->
|
||||
expect(fsUtils.md5ForPath(require.resolve('fixtures/sample.js'))).toBe 'dd38087d0d7e3e4802a6d3f9b9745f2b'
|
||||
expect(fs.md5ForPath(require.resolve('./fixtures/sample.js'))).toBe 'dd38087d0d7e3e4802a6d3f9b9745f2b'
|
||||
|
||||
describe ".list(path, extensions)", ->
|
||||
it "returns the absolute paths of entries within the given directory", ->
|
||||
paths = fsUtils.listSync(project.getPath())
|
||||
paths = fs.listSync(project.getPath())
|
||||
expect(paths).toContain project.resolve('css.css')
|
||||
expect(paths).toContain project.resolve('coffee.coffee')
|
||||
expect(paths).toContain project.resolve('two-hundred.txt')
|
||||
|
||||
it "returns an empty array for paths that aren't directories or don't exist", ->
|
||||
expect(fsUtils.listSync(project.resolve('sample.js'))).toEqual []
|
||||
expect(fsUtils.listSync('/non/existent/directory')).toEqual []
|
||||
expect(fs.listSync(project.resolve('sample.js'))).toEqual []
|
||||
expect(fs.listSync('/non/existent/directory')).toEqual []
|
||||
|
||||
it "can filter the paths by an optional array of file extensions", ->
|
||||
paths = fsUtils.listSync(project.getPath(), ['.css', 'coffee'])
|
||||
paths = fs.listSync(project.getPath(), ['.css', 'coffee'])
|
||||
expect(paths).toContain project.resolve('css.css')
|
||||
expect(paths).toContain project.resolve('coffee.coffee')
|
||||
expect(listedPath).toMatch /(css|coffee)$/ for listedPath in paths
|
||||
@@ -117,7 +111,7 @@ describe "fsUtils", ->
|
||||
|
||||
it "calls the callback with the absolute paths of entries within the given directory", ->
|
||||
waitsFor (done) ->
|
||||
fsUtils.list project.getPath(), (err, result) ->
|
||||
fs.list project.getPath(), (err, result) ->
|
||||
paths = result
|
||||
done()
|
||||
runs ->
|
||||
@@ -127,7 +121,7 @@ describe "fsUtils", ->
|
||||
|
||||
it "can filter the paths by an optional array of file extensions", ->
|
||||
waitsFor (done) ->
|
||||
fsUtils.list project.getPath(), ['css', '.coffee'], (err, result) ->
|
||||
fs.list project.getPath(), ['css', '.coffee'], (err, result) ->
|
||||
paths = result
|
||||
done()
|
||||
runs ->
|
||||
@@ -137,6 +131,6 @@ describe "fsUtils", ->
|
||||
|
||||
describe ".absolute(relativePath)", ->
|
||||
it "converts a leading ~ segment to the HOME directory", ->
|
||||
expect(fsUtils.absolute('~')).toBe fs.realpathSync(process.env.HOME)
|
||||
expect(fsUtils.absolute(path.join('~', 'does', 'not', 'exist'))).toBe path.join(process.env.HOME, 'does', 'not', 'exist')
|
||||
expect(fsUtils.absolute('~test')).toBe '~test'
|
||||
expect(fs.absolute('~')).toBe fs.realpathSync(process.env.HOME)
|
||||
expect(fs.absolute(path.join('~', 'does', 'not', 'exist'))).toBe path.join(process.env.HOME, 'does', 'not', 'exist')
|
||||
expect(fs.absolute('~test')).toBe '~test'
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Git = require 'git'
|
||||
fsUtils = require 'fs-utils'
|
||||
Git = require '../src/git'
|
||||
{fs} = require 'atom'
|
||||
path = require 'path'
|
||||
Task = require 'task'
|
||||
Task = require '../src/task'
|
||||
|
||||
describe "Git", ->
|
||||
repo = null
|
||||
|
||||
beforeEach ->
|
||||
fsUtils.remove('/tmp/.git') if fsUtils.isDirectorySync('/tmp/.git')
|
||||
fs.remove('/tmp/.git') if fs.isDirectorySync('/tmp/.git')
|
||||
|
||||
afterEach ->
|
||||
repo.destroy() if repo?.repo?
|
||||
@@ -22,45 +22,45 @@ describe "Git", ->
|
||||
|
||||
describe ".getPath()", ->
|
||||
it "returns the repository path for a .git directory path", ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/master.git/HEAD'))
|
||||
expect(repo.getPath()).toBe fsUtils.resolveOnLoadPath('fixtures/git/master.git')
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'master.git', 'HEAD'))
|
||||
expect(repo.getPath()).toBe path.join(__dirname, 'fixtures', 'git', 'master.git')
|
||||
|
||||
it "returns the repository path for a repository path", ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/master.git'))
|
||||
expect(repo.getPath()).toBe fsUtils.resolveOnLoadPath('fixtures/git/master.git')
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'master.git'))
|
||||
expect(repo.getPath()).toBe path.join(__dirname, 'fixtures', 'git', 'master.git')
|
||||
|
||||
describe ".isPathIgnored(path)", ->
|
||||
it "returns true for an ignored path", ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/ignore.git'))
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'ignore.git'))
|
||||
expect(repo.isPathIgnored('a.txt')).toBeTruthy()
|
||||
|
||||
it "returns false for a non-ignored path", ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/ignore.git'))
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'ignore.git'))
|
||||
expect(repo.isPathIgnored('b.txt')).toBeFalsy()
|
||||
|
||||
describe ".isPathModified(path)", ->
|
||||
[repo, filePath, newPath, originalPathText] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
filePath = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/file.txt')
|
||||
newPath = path.join(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'), 'new-path.txt')
|
||||
originalPathText = fsUtils.read(filePath)
|
||||
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.read(filePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(filePath, originalPathText)
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
|
||||
describe "when the path is unstaged", ->
|
||||
it "returns false if the path has not been modified", ->
|
||||
expect(repo.isPathModified(filePath)).toBeFalsy()
|
||||
|
||||
it "returns true if the path is modified", ->
|
||||
fsUtils.writeSync(filePath, "change")
|
||||
fs.writeSync(filePath, "change")
|
||||
expect(repo.isPathModified(filePath)).toBeTruthy()
|
||||
|
||||
it "returns true if the path is deleted", ->
|
||||
fsUtils.remove(filePath)
|
||||
fs.remove(filePath)
|
||||
expect(repo.isPathModified(filePath)).toBeTruthy()
|
||||
|
||||
it "returns false if the path is new", ->
|
||||
@@ -70,13 +70,13 @@ describe "Git", ->
|
||||
[filePath, newPath] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
filePath = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/file.txt')
|
||||
newPath = path.join(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'), 'new-path.txt')
|
||||
fsUtils.writeSync(newPath, "i'm new here")
|
||||
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')
|
||||
fs.writeSync(newPath, "i'm new here")
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
|
||||
describe "when the path is unstaged", ->
|
||||
it "returns true if the path is new", ->
|
||||
@@ -89,37 +89,37 @@ describe "Git", ->
|
||||
[path1, path2, originalPath1Text, originalPath2Text] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
path1 = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/file.txt')
|
||||
originalPath1Text = fsUtils.read(path1)
|
||||
path2 = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/other.txt')
|
||||
originalPath2Text = fsUtils.read(path2)
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
path1 = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPath1Text = fs.read(path1)
|
||||
path2 = require.resolve('./fixtures/git/working-dir/other.txt')
|
||||
originalPath2Text = fs.read(path2)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(path1, originalPath1Text)
|
||||
fsUtils.writeSync(path2, originalPath2Text)
|
||||
fs.writeSync(path1, originalPath1Text)
|
||||
fs.writeSync(path2, originalPath2Text)
|
||||
|
||||
it "no longer reports a path as modified after checkout", ->
|
||||
expect(repo.isPathModified(path1)).toBeFalsy()
|
||||
fsUtils.writeSync(path1, '')
|
||||
fs.writeSync(path1, '')
|
||||
expect(repo.isPathModified(path1)).toBeTruthy()
|
||||
expect(repo.checkoutHead(path1)).toBeTruthy()
|
||||
expect(repo.isPathModified(path1)).toBeFalsy()
|
||||
|
||||
it "restores the contents of the path to the original text", ->
|
||||
fsUtils.writeSync(path1, '')
|
||||
fs.writeSync(path1, '')
|
||||
expect(repo.checkoutHead(path1)).toBeTruthy()
|
||||
expect(fsUtils.read(path1)).toBe(originalPath1Text)
|
||||
expect(fs.read(path1)).toBe(originalPath1Text)
|
||||
|
||||
it "only restores the path specified", ->
|
||||
fsUtils.writeSync(path2, 'path 2 is edited')
|
||||
fs.writeSync(path2, 'path 2 is edited')
|
||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
||||
expect(repo.checkoutHead(path1)).toBeTruthy()
|
||||
expect(fsUtils.read(path2)).toBe('path 2 is edited')
|
||||
expect(fs.read(path2)).toBe('path 2 is edited')
|
||||
expect(repo.isPathModified(path2)).toBeTruthy()
|
||||
|
||||
it "fires a status-changed event if the checkout completes successfully", ->
|
||||
fsUtils.writeSync(path1, '')
|
||||
fs.writeSync(path1, '')
|
||||
repo.getPathStatus(path1)
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
repo.on 'status-changed', statusHandler
|
||||
@@ -132,7 +132,7 @@ describe "Git", ->
|
||||
|
||||
describe ".destroy()", ->
|
||||
it "throws an exception when any method is called after it is called", ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/master.git/HEAD'))
|
||||
repo = new Git(require.resolve('./fixtures/git/master.git/HEAD'))
|
||||
repo.destroy()
|
||||
expect(-> repo.getShortHead()).toThrow()
|
||||
|
||||
@@ -140,38 +140,38 @@ describe "Git", ->
|
||||
[filePath, originalPathText] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
filePath = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fsUtils.read(filePath)
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
filePath = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fs.read(filePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(filePath, originalPathText)
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
|
||||
it "returns the number of lines added and deleted", ->
|
||||
expect(repo.getDiffStats(filePath)).toEqual {added: 0, deleted: 0}
|
||||
fsUtils.writeSync(filePath, "#{originalPathText} edited line")
|
||||
fs.writeSync(filePath, "#{originalPathText} edited line")
|
||||
expect(repo.getDiffStats(filePath)).toEqual {added: 1, deleted: 1}
|
||||
|
||||
describe ".getPathStatus(path)", ->
|
||||
[filePath, originalPathText] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
filePath = fsUtils.resolveOnLoadPath('fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fsUtils.read(filePath)
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
filePath = require.resolve('./fixtures/git/working-dir/file.txt')
|
||||
originalPathText = fs.read(filePath)
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(filePath, originalPathText)
|
||||
fs.writeSync(filePath, originalPathText)
|
||||
|
||||
it "trigger a status-changed event when the new status differs from the last cached one", ->
|
||||
statusHandler = jasmine.createSpy("statusHandler")
|
||||
repo.on 'status-changed', statusHandler
|
||||
fsUtils.writeSync(filePath, '')
|
||||
fs.writeSync(filePath, '')
|
||||
status = repo.getPathStatus(filePath)
|
||||
expect(statusHandler.callCount).toBe 1
|
||||
expect(statusHandler.argsForCall[0][0..1]).toEqual [filePath, status]
|
||||
|
||||
fsUtils.writeSync(filePath, 'abc')
|
||||
fs.writeSync(filePath, 'abc')
|
||||
status = repo.getPathStatus(filePath)
|
||||
expect(statusHandler.callCount).toBe 1
|
||||
|
||||
@@ -179,19 +179,19 @@ describe "Git", ->
|
||||
[newPath, modifiedPath, cleanPath, originalModifiedPathText] = []
|
||||
|
||||
beforeEach ->
|
||||
repo = new Git(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
repo = new Git(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
modifiedPath = project.resolve('git/working-dir/file.txt')
|
||||
originalModifiedPathText = fsUtils.read(modifiedPath)
|
||||
originalModifiedPathText = fs.read(modifiedPath)
|
||||
newPath = project.resolve('git/working-dir/untracked.txt')
|
||||
cleanPath = project.resolve('git/working-dir/other.txt')
|
||||
fsUtils.writeSync(newPath, '')
|
||||
fs.writeSync(newPath, '')
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(modifiedPath, originalModifiedPathText)
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fs.writeSync(modifiedPath, originalModifiedPathText)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
|
||||
it "returns status information for all new and modified files", ->
|
||||
fsUtils.writeSync(modifiedPath, 'making this path modified')
|
||||
fs.writeSync(modifiedPath, 'making this path modified')
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
repo.on 'statuses-changed', statusHandler
|
||||
repo.refreshStatus()
|
||||
@@ -209,7 +209,7 @@ describe "Git", ->
|
||||
[originalContent, editSession] = []
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(editSession.getPath(), originalContent)
|
||||
fs.writeSync(editSession.getPath(), originalContent)
|
||||
|
||||
it "emits a status-changed event", ->
|
||||
editSession = project.open('sample.js')
|
||||
@@ -226,12 +226,12 @@ describe "Git", ->
|
||||
[originalContent, editSession] = []
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(editSession.getPath(), originalContent)
|
||||
fs.writeSync(editSession.getPath(), originalContent)
|
||||
|
||||
it "emits a status-changed event", ->
|
||||
editSession = project.open('sample.js')
|
||||
originalContent = editSession.getText()
|
||||
fsUtils.writeSync(editSession.getPath(), 'changed')
|
||||
fs.writeSync(editSession.getPath(), 'changed')
|
||||
|
||||
statusHandler = jasmine.createSpy('statusHandler')
|
||||
project.getRepo().on 'status-changed', statusHandler
|
||||
@@ -245,7 +245,7 @@ describe "Git", ->
|
||||
[originalContent, buffer, project2] = []
|
||||
|
||||
afterEach ->
|
||||
fsUtils.writeSync(buffer.getPath(), originalContent)
|
||||
fs.writeSync(buffer.getPath(), originalContent)
|
||||
project2?.destroy()
|
||||
|
||||
it "subscribes to all the serialized buffers in the project", ->
|
||||
|
||||
@@ -1,20 +1,10 @@
|
||||
window.nakedLoad = (file) ->
|
||||
fsUtils = require 'fs-utils'
|
||||
path = require 'path'
|
||||
file = require.resolve(file)
|
||||
code = fsUtils.read(file)
|
||||
if path.extname(file) is '.coffee'
|
||||
require('coffee-script').eval(code, filename: file)
|
||||
else
|
||||
window.eval("#{code}\n//@ sourceURL=#{file}")
|
||||
|
||||
module.exports.runSpecSuite = (specSuite, logErrors=true) ->
|
||||
{$$} = require 'space-pen'
|
||||
nakedLoad 'jasmine'
|
||||
{$, $$} = require 'atom'
|
||||
window[key] = value for key, value of require '../vendor/jasmine'
|
||||
|
||||
require 'jasmine-focused'
|
||||
|
||||
$ = require 'jquery'
|
||||
TimeReporter = require 'time-reporter'
|
||||
TimeReporter = require './time-reporter'
|
||||
timeReporter = new TimeReporter()
|
||||
|
||||
if atom.getLoadSettings().exitWhenDone
|
||||
@@ -29,7 +19,7 @@ module.exports.runSpecSuite = (specSuite, logErrors=true) ->
|
||||
timeReporter.logLongestSpecs 10, (line) -> process.stdout.write("#{line}\n")
|
||||
atom.exit(runner.results().failedCount > 0 ? 1 : 0)
|
||||
else
|
||||
AtomReporter = require 'atom-reporter'
|
||||
AtomReporter = require './atom-reporter'
|
||||
reporter = new AtomReporter()
|
||||
|
||||
require specSuite
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
{View, $$} = require 'space-pen'
|
||||
{_, $, $$, View} = require 'atom'
|
||||
|
||||
describe 'jQuery extensions', ->
|
||||
describe '$.fn.preempt(eventName, handler)', ->
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
Keymap = require 'keymap'
|
||||
$ = require 'jquery'
|
||||
{$$} = require 'space-pen'
|
||||
RootView = require 'root-view'
|
||||
Keymap = require '../src/keymap'
|
||||
{$, $$, RootView} = require 'atom'
|
||||
|
||||
describe "Keymap", ->
|
||||
fragment = null
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
Project = require 'project'
|
||||
Buffer = require 'text-buffer'
|
||||
EditSession = require 'edit-session'
|
||||
|
||||
describe "LanguageMode", ->
|
||||
[editSession, buffer, languageMode] = []
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{Site} = require 'telepath'
|
||||
{View} = require 'space-pen'
|
||||
PaneContainer = require 'pane-container'
|
||||
Pane = require 'pane'
|
||||
Environment = require 'environment'
|
||||
{View} = require 'atom'
|
||||
PaneContainer = require '../src/pane-container'
|
||||
Pane = require '../src/pane'
|
||||
Environment = require './environment'
|
||||
|
||||
describe "PaneContainer replication", ->
|
||||
[env1, env2, envConnection, container1, container2, pane1a, pane1b, pane1c] = []
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
PaneContainer = require 'pane-container'
|
||||
Pane = require 'pane'
|
||||
{View, $$} = require 'space-pen'
|
||||
_ = require 'underscore'
|
||||
$ = require 'jquery'
|
||||
PaneContainer = require '../src/pane-container'
|
||||
Pane = require '../src/pane'
|
||||
{_, $, View, $$} = require 'atom'
|
||||
|
||||
describe "PaneContainer", ->
|
||||
[TestView, container, pane1, pane2, pane3] = []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PaneContainer = require 'pane-container'
|
||||
Pane = require 'pane'
|
||||
PaneContainer = require '../src/pane-container'
|
||||
Pane = require '../src/pane'
|
||||
{Site} = require 'telepath'
|
||||
|
||||
describe "Pane replication", ->
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
PaneContainer = require 'pane-container'
|
||||
Pane = require 'pane'
|
||||
{View} = require 'space-pen'
|
||||
$ = require 'jquery'
|
||||
PaneContainer = require '../src/pane-container'
|
||||
Pane = require '../src/pane'
|
||||
{$, View} = require 'atom'
|
||||
{dirname} = require 'path'
|
||||
|
||||
describe "Pane", ->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
path = require 'path'
|
||||
{Site} = require 'telepath'
|
||||
fsUtils = require 'fs-utils'
|
||||
Project = require 'project'
|
||||
Git = require 'git'
|
||||
Project = require '../src/project'
|
||||
Git = require '../src/git'
|
||||
|
||||
describe "Project replication", ->
|
||||
[doc1, doc2, project1, project2] = []
|
||||
@@ -12,8 +12,10 @@ describe "Project replication", ->
|
||||
getOriginUrl: -> 'git://server/project.git'
|
||||
destroy: ->
|
||||
|
||||
config.set('core.projectHome', fsUtils.resolveOnLoadPath('fixtures/replication/home-1'))
|
||||
project1 = new Project(fsUtils.resolveOnLoadPath('fixtures/replication/home-1/project'))
|
||||
projectHome1 = path.join(__dirname, 'fixtures', 'replication', 'home-1')
|
||||
projectHome2 = path.join(__dirname, 'fixtures', 'replication', 'home-2')
|
||||
config.set('core.projectHome', projectHome1)
|
||||
project1 = new Project(path.join(projectHome1, 'project'))
|
||||
project1.bufferForPath('file-1.txt')
|
||||
project1.bufferForPath('file-1.txt')
|
||||
expect(project1.getBuffers().length).toBe 1
|
||||
@@ -23,7 +25,7 @@ describe "Project replication", ->
|
||||
connection = doc1.connect(doc2)
|
||||
|
||||
# pretend we're bootstrapping a joining window
|
||||
config.set('core.projectHome', fsUtils.resolveOnLoadPath('fixtures/replication/home-2'))
|
||||
config.set('core.projectHome', projectHome2)
|
||||
project2 = deserialize(doc2)
|
||||
|
||||
afterEach ->
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
Project = require 'project'
|
||||
fsUtils = require 'fs-utils'
|
||||
Project = require '../src/project'
|
||||
{_, fs} = require 'atom'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
BufferedProcess = require 'buffered-process'
|
||||
BufferedProcess = require '../src/buffered-process'
|
||||
|
||||
describe "Project", ->
|
||||
beforeEach ->
|
||||
@@ -42,7 +41,7 @@ describe "Project", ->
|
||||
editSession = project.open()
|
||||
editSession.saveAs('/tmp/atom-test-save-sets-project-path')
|
||||
expect(project.getPath()).toBe '/tmp'
|
||||
fsUtils.remove('/tmp/atom-test-save-sets-project-path')
|
||||
fs.remove('/tmp/atom-test-save-sets-project-path')
|
||||
|
||||
describe "when an edit session is deserialized", ->
|
||||
it "emits an 'edit-session-created' event and stores the edit session", ->
|
||||
@@ -63,7 +62,7 @@ describe "Project", ->
|
||||
describe ".open(path)", ->
|
||||
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditSessionHandler] = []
|
||||
beforeEach ->
|
||||
absolutePath = fsUtils.resolveOnLoadPath('fixtures/dir/a')
|
||||
absolutePath = require.resolve('./fixtures/dir/a')
|
||||
newBufferHandler = jasmine.createSpy('newBufferHandler')
|
||||
project.on 'buffer-created', newBufferHandler
|
||||
newEditSessionHandler = jasmine.createSpy('newEditSessionHandler')
|
||||
@@ -71,12 +70,12 @@ describe "Project", ->
|
||||
|
||||
fooOpener = (pathToOpen, options) -> { foo: pathToOpen, options } if pathToOpen?.match(/\.foo/)
|
||||
barOpener = (pathToOpen) -> { bar: pathToOpen } if pathToOpen?.match(/^bar:\/\//)
|
||||
Project.registerOpener(fooOpener)
|
||||
Project.registerOpener(barOpener)
|
||||
project.registerOpener(fooOpener)
|
||||
project.registerOpener(barOpener)
|
||||
|
||||
afterEach ->
|
||||
Project.unregisterOpener(fooOpener)
|
||||
Project.unregisterOpener(barOpener)
|
||||
project.unregisterOpener(fooOpener)
|
||||
project.unregisterOpener(barOpener)
|
||||
|
||||
describe "when passed a path that doesn't match a custom opener", ->
|
||||
describe "when given an absolute path that hasn't been opened previously", ->
|
||||
@@ -132,7 +131,7 @@ describe "Project", ->
|
||||
describe ".resolve(uri)", ->
|
||||
describe "when passed an absolute or relative path", ->
|
||||
it "returns an absolute path based on the project's root", ->
|
||||
absolutePath = fsUtils.resolveOnLoadPath('fixtures/dir/a')
|
||||
absolutePath = require.resolve('./fixtures/dir/a')
|
||||
expect(project.resolve('a')).toBe absolutePath
|
||||
expect(project.resolve(absolutePath + '/../a')).toBe absolutePath
|
||||
expect(project.resolve('a/../a')).toBe absolutePath
|
||||
@@ -144,15 +143,16 @@ describe "Project", ->
|
||||
describe ".setPath(path)", ->
|
||||
describe "when path is a file", ->
|
||||
it "sets its path to the files parent directory and updates the root directory", ->
|
||||
project.setPath(fsUtils.resolveOnLoadPath('fixtures/dir/a'))
|
||||
expect(project.getPath()).toEqual fsUtils.resolveOnLoadPath('fixtures/dir')
|
||||
expect(project.getRootDirectory().path).toEqual fsUtils.resolveOnLoadPath('fixtures/dir')
|
||||
project.setPath(require.resolve('./fixtures/dir/a'))
|
||||
expect(project.getPath()).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
|
||||
expect(project.getRootDirectory().path).toEqual path.dirname(require.resolve('./fixtures/dir/a'))
|
||||
|
||||
describe "when path is a directory", ->
|
||||
it "sets its path to the directory and updates the root directory", ->
|
||||
project.setPath(fsUtils.resolveOnLoadPath('fixtures/dir/a-dir'))
|
||||
expect(project.getPath()).toEqual fsUtils.resolveOnLoadPath('fixtures/dir/a-dir')
|
||||
expect(project.getRootDirectory().path).toEqual fsUtils.resolveOnLoadPath('fixtures/dir/a-dir')
|
||||
directory = fs.absolute(path.join(__dirname, 'fixtures', 'dir', 'a-dir'))
|
||||
project.setPath(directory)
|
||||
expect(project.getPath()).toEqual directory
|
||||
expect(project.getRootDirectory().path).toEqual directory
|
||||
|
||||
describe "when path is null", ->
|
||||
it "sets its path and root directory to null", ->
|
||||
@@ -183,7 +183,7 @@ describe "Project", ->
|
||||
describe "when config.core.hideGitIgnoredFiles is true", ->
|
||||
it "ignores files that are present in .gitignore if the project is a git repo", ->
|
||||
config.set "core.hideGitIgnoredFiles", true
|
||||
project.setPath(fsUtils.resolveOnLoadPath('fixtures/git/working-dir'))
|
||||
project.setPath(path.join(__dirname, 'fixtures', 'git', 'working-dir'))
|
||||
paths = null
|
||||
waitsForPromise ->
|
||||
project.getFilePaths().done (foundPaths) -> paths = foundPaths
|
||||
@@ -195,11 +195,11 @@ describe "Project", ->
|
||||
ignoredFile = null
|
||||
|
||||
beforeEach ->
|
||||
ignoredFile = path.join(fsUtils.resolveOnLoadPath('fixtures/dir'), 'ignored.txt')
|
||||
fsUtils.writeSync(ignoredFile, "")
|
||||
ignoredFile = path.join(__dirname, 'fixtures', 'dir', 'ignored.txt')
|
||||
fs.writeSync(ignoredFile, "")
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(ignoredFile)
|
||||
fs.remove(ignoredFile)
|
||||
|
||||
it "ignores ignored.txt file", ->
|
||||
paths = null
|
||||
@@ -214,11 +214,11 @@ describe "Project", ->
|
||||
ignoredFile = null
|
||||
|
||||
beforeEach ->
|
||||
ignoredFile = path.join(fsUtils.resolveOnLoadPath('fixtures/dir'), 'ignored/ignored.txt')
|
||||
fsUtils.writeSync(ignoredFile, "")
|
||||
ignoredFile = path.join(__dirname, 'fixtures', 'dir', 'ignored', 'ignored.txt')
|
||||
fs.writeSync(ignoredFile, "")
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(ignoredFile)
|
||||
fs.remove(ignoredFile)
|
||||
|
||||
it "ignores ignored folder", ->
|
||||
paths = null
|
||||
@@ -262,7 +262,7 @@ describe "Project", ->
|
||||
range: [[2, 6], [2, 11]]
|
||||
|
||||
it "works on evil filenames", ->
|
||||
project.setPath(fsUtils.resolveOnLoadPath('fixtures/evil-files'))
|
||||
project.setPath(path.join(__dirname, 'fixtures', 'evil-files'))
|
||||
paths = []
|
||||
matches = []
|
||||
waitsForPromise ->
|
||||
@@ -294,7 +294,7 @@ describe "Project", ->
|
||||
project.scan /a+/, iterator
|
||||
|
||||
stdout = BufferedProcess.prototype.bufferStream.argsForCall[0][1]
|
||||
stdout ":#{fsUtils.resolveOnLoadPath('fixtures/dir/a')}\n"
|
||||
stdout ":#{path.join(__dirname, 'fixtures', 'dir', 'a')}\n"
|
||||
stdout "1;0 3:aaa bbb\n2;3 2:cc aa cc\n"
|
||||
|
||||
expect(iterator.argsForCall[0][0]).toEqual
|
||||
@@ -311,12 +311,12 @@ describe "Project", ->
|
||||
[projectPath, ignoredPath] = []
|
||||
|
||||
beforeEach ->
|
||||
projectPath = fsUtils.resolveOnLoadPath('fixtures/git/working-dir')
|
||||
projectPath = path.join(__dirname, 'fixtures', 'git', 'working-dir')
|
||||
ignoredPath = path.join(projectPath, 'ignored.txt')
|
||||
fsUtils.writeSync(ignoredPath, 'this match should not be included')
|
||||
fs.writeSync(ignoredPath, 'this match should not be included')
|
||||
|
||||
afterEach ->
|
||||
fsUtils.remove(ignoredPath) if fsUtils.exists(ignoredPath)
|
||||
fs.remove(ignoredPath) if fs.exists(ignoredPath)
|
||||
|
||||
it "excludes ignored files", ->
|
||||
project.setPath(projectPath)
|
||||
@@ -335,7 +335,7 @@ describe "Project", ->
|
||||
it "includes files and folders that begin with a '.'", ->
|
||||
projectPath = '/tmp/atom-tests/folder-with-dot-file'
|
||||
filePath = path.join(projectPath, '.text')
|
||||
fsUtils.writeSync(filePath, 'match this')
|
||||
fs.writeSync(filePath, 'match this')
|
||||
project.setPath(projectPath)
|
||||
paths = []
|
||||
matches = []
|
||||
@@ -352,7 +352,7 @@ describe "Project", ->
|
||||
it "excludes values in core.ignoredNames", ->
|
||||
projectPath = '/tmp/atom-tests/folder-with-dot-git/.git'
|
||||
filePath = path.join(projectPath, 'test.txt')
|
||||
fsUtils.writeSync(filePath, 'match this')
|
||||
fs.writeSync(filePath, 'match this')
|
||||
project.setPath(projectPath)
|
||||
paths = []
|
||||
matches = []
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
fsUtils = require 'fs-utils'
|
||||
{$, $$, fs, RootView, View} = require 'atom'
|
||||
path = require 'path'
|
||||
Project = require 'project'
|
||||
RootView = require 'root-view'
|
||||
Buffer = require 'text-buffer'
|
||||
Editor = require 'editor'
|
||||
Pane = require 'pane'
|
||||
{View, $$} = require 'space-pen'
|
||||
Pane = require '../src/pane'
|
||||
|
||||
describe "RootView", ->
|
||||
pathToOpen = null
|
||||
@@ -222,7 +216,7 @@ describe "RootView", ->
|
||||
it "creates an edit session for the given path as an item on a new pane, and focuses the pane", ->
|
||||
editSession = rootView.open('b')
|
||||
expect(rootView.getActivePane().activeItem).toBe editSession
|
||||
expect(editSession.getPath()).toBe fsUtils.resolveOnLoadPath('fixtures/dir/b')
|
||||
expect(editSession.getPath()).toBe require.resolve('./fixtures/dir/b')
|
||||
expect(rootView.getActivePane().focus).toHaveBeenCalled()
|
||||
|
||||
describe "when the changeFocus option is false", ->
|
||||
@@ -362,6 +356,6 @@ describe "RootView", ->
|
||||
rootView.eachBuffer(callback)
|
||||
count = 0
|
||||
callbackBuffer = null
|
||||
rootView.open(require.resolve('fixtures/sample.txt'))
|
||||
rootView.open(require.resolve('./fixtures/sample.txt'))
|
||||
expect(count).toBe 1
|
||||
expect(callbackBuffer).toBe rootView.getActiveView().getBuffer()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
RowMap = require 'row-map'
|
||||
RowMap = require '../src/row-map'
|
||||
|
||||
describe "RowMap", ->
|
||||
map = null
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
SelectList = require 'select-list'
|
||||
{$$} = require 'space-pen'
|
||||
$ = require 'jquery'
|
||||
SelectList = require '../src/select-list'
|
||||
{$, $$} = require 'atom'
|
||||
|
||||
describe "SelectList", ->
|
||||
[selectList, array, list, miniEditor] = []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EditSession = require 'edit-session'
|
||||
EditSession = require '../src/edit-session'
|
||||
|
||||
describe "Selection", ->
|
||||
[buffer, editSession, selection] = []
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{View, $$} = require 'space-pen'
|
||||
EventEmitter = require 'event-emitter'
|
||||
{View, $$} = require 'atom'
|
||||
|
||||
describe "SpacePen extensions", ->
|
||||
class TestView extends View
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
try
|
||||
require 'atom'
|
||||
require '../src/atom'
|
||||
require '../src/window'
|
||||
atom.show()
|
||||
{runSpecSuite} = require 'jasmine-helper'
|
||||
{runSpecSuite} = require './jasmine-helper'
|
||||
|
||||
document.title = "Spec Suite"
|
||||
runSpecSuite "spec-suite"
|
||||
runSpecSuite './spec-suite'
|
||||
catch e
|
||||
console.error(e.stack ? e)
|
||||
atom.exit(1) if atom.getLoadSettings().exitWhenDone
|
||||
|
||||
@@ -1,28 +1,23 @@
|
||||
require 'window'
|
||||
require '../src/window'
|
||||
window.setUpEnvironment('spec')
|
||||
window.restoreDimensions()
|
||||
|
||||
nakedLoad 'jasmine-jquery'
|
||||
require '../vendor/jasmine-jquery'
|
||||
path = require 'path'
|
||||
$ = jQuery = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
Keymap = require 'keymap'
|
||||
Config = require 'config'
|
||||
{_, $, File, RootView, fs} = require 'atom'
|
||||
Keymap = require '../src/keymap'
|
||||
Config = require '../src/config'
|
||||
{Point} = require 'telepath'
|
||||
Project = require 'project'
|
||||
Directory = require 'directory'
|
||||
File = require 'file'
|
||||
Editor = require 'editor'
|
||||
TokenizedBuffer = require 'tokenized-buffer'
|
||||
fsUtils = require 'fs-utils'
|
||||
Project = require '../src/project'
|
||||
Editor = require '../src/editor'
|
||||
TokenizedBuffer = require '../src/tokenized-buffer'
|
||||
pathwatcher = require 'pathwatcher'
|
||||
RootView = require 'root-view'
|
||||
clipboard = require 'clipboard'
|
||||
|
||||
atom.loadBaseStylesheets()
|
||||
requireStylesheet "jasmine"
|
||||
requireStylesheet '../static/jasmine'
|
||||
|
||||
fixturePackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
|
||||
fixturePackagesPath = path.resolve(__dirname, './fixtures/packages')
|
||||
config.packageDirPaths.unshift(fixturePackagesPath)
|
||||
keymap.loadBundledKeymaps()
|
||||
[bindingSetsToRestore, bindingSetsByFirstKeystrokeToRestore] = []
|
||||
@@ -37,9 +32,9 @@ jasmine.getEnv().addEqualityTester(_.isEqual) # Use underscore's definition of e
|
||||
jasmine.getEnv().defaultTimeoutInterval = 5000
|
||||
|
||||
beforeEach ->
|
||||
jQuery.fx.off = true
|
||||
$.fx.off = true
|
||||
|
||||
specDirectory = atom.getLoadSettings().specDirectory ? fsUtils.resolveOnLoadPath("spec")
|
||||
specDirectory = atom.getLoadSettings().specDirectory ? __dirname
|
||||
window.project = new Project(path.join(specDirectory, 'fixtures'))
|
||||
|
||||
window.resetTimeouts()
|
||||
@@ -132,7 +127,7 @@ addCustomMatchers = (spec) ->
|
||||
toExistOnDisk: (expected) ->
|
||||
notText = this.isNot and " not" or ""
|
||||
@message = -> return "Expected path '" + @actual + "'" + notText + " to exist."
|
||||
fsUtils.exists(@actual)
|
||||
fs.exists(@actual)
|
||||
|
||||
window.keyIdentifierForKey = (key) ->
|
||||
if key.length > 1 # named key
|
||||
@@ -244,8 +239,8 @@ $.fn.textInput = (data) ->
|
||||
this.each ->
|
||||
event = document.createEvent('TextEvent')
|
||||
event.initTextEvent('textInput', true, true, window, data)
|
||||
event = jQuery.event.fix(event)
|
||||
event = $.event.fix(event)
|
||||
$(this).trigger(event)
|
||||
|
||||
unless fsUtils.md5ForPath(require.resolve('fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b"
|
||||
unless fs.md5ForPath(require.resolve('./fixtures/sample.js')) == "dd38087d0d7e3e4802a6d3f9b9745f2b"
|
||||
throw new Error("Sample.js is modified")
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
require 'window'
|
||||
|
||||
measure 'spec suite require time', ->
|
||||
fs = require 'fs'
|
||||
fsUtils = require 'fs-utils'
|
||||
{_, fs, Git} = require 'atom'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
Git = require 'git'
|
||||
require 'spec-helper'
|
||||
require './spec-helper'
|
||||
|
||||
requireSpecs = (specDirectory, specType) ->
|
||||
for specFilePath in fsUtils.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
|
||||
for specFilePath in fs.listTreeSync(specDirectory) when /-spec\.coffee$/.test specFilePath
|
||||
require specFilePath
|
||||
|
||||
setSpecType = (specType) ->
|
||||
@@ -22,7 +17,7 @@ measure 'spec suite require time', ->
|
||||
requireSpecs(path.join(window.resourcePath, 'spec'))
|
||||
setSpecType('core')
|
||||
|
||||
fixturesPackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
|
||||
fixturesPackagesPath = path.join(__dirname, 'fixtures', 'packages')
|
||||
packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
|
||||
packagePaths = _.groupBy packagePaths, (packagePath) ->
|
||||
if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
Subscriber = require 'subscriber'
|
||||
EventEmitter = require 'event-emitter'
|
||||
_ = require 'underscore'
|
||||
{$$} = require 'space-pen'
|
||||
Subscriber = require '../src/subscriber'
|
||||
EventEmitter = require '../src/event-emitter'
|
||||
{_, $$} = require 'atom'
|
||||
|
||||
describe "Subscriber", ->
|
||||
[emitter1, emitter2, emitter3, event1Handler, event2Handler, event3Handler, subscriber] = []
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fsUtils = require 'fs-utils'
|
||||
TextMateGrammar = require 'text-mate-grammar'
|
||||
{fs} = require 'atom'
|
||||
TextMateGrammar = require '../src/text-mate-grammar'
|
||||
|
||||
describe "the `syntax` global", ->
|
||||
beforeEach ->
|
||||
@@ -28,7 +28,7 @@ describe "the `syntax` global", ->
|
||||
expect(syntax.selectGrammar("/hu.git/config").name).toBe "Null Grammar"
|
||||
|
||||
it "uses the filePath's shebang line if the grammar cannot be determined by the extension or basename", ->
|
||||
filePath = require.resolve("fixtures/shebang")
|
||||
filePath = require.resolve("./fixtures/shebang")
|
||||
expect(syntax.selectGrammar(filePath).name).toBe "Ruby"
|
||||
|
||||
it "uses the number of newlines in the first line regex to determine the number of lines to test against", ->
|
||||
@@ -44,11 +44,11 @@ describe "the `syntax` global", ->
|
||||
expect(syntax.selectGrammar("grammar.tmLanguage", fileContent).name).toBe "Property List (XML)"
|
||||
|
||||
it "doesn't read the file when the file contents are specified", ->
|
||||
filePath = require.resolve("fixtures/shebang")
|
||||
filePathContents = fsUtils.read(filePath)
|
||||
spyOn(fsUtils, 'read').andCallThrough()
|
||||
filePath = require.resolve("./fixtures/shebang")
|
||||
filePathContents = fs.read(filePath)
|
||||
spyOn(fs, 'read').andCallThrough()
|
||||
expect(syntax.selectGrammar(filePath, filePathContents).name).toBe "Ruby"
|
||||
expect(fsUtils.read).not.toHaveBeenCalled()
|
||||
expect(fs.read).not.toHaveBeenCalled()
|
||||
|
||||
it "allows the default grammar to be overridden for a path", ->
|
||||
path = '/foo/bar/file.js'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Task = require 'task'
|
||||
Task = require '../src/task'
|
||||
|
||||
describe "Task", ->
|
||||
describe "populating the window with fake properties", ->
|
||||
@@ -8,7 +8,7 @@ describe "Task", ->
|
||||
spyOn(console, 'error')
|
||||
spyOn(console, 'warn')
|
||||
|
||||
jqueryTask = new Task('fixtures/jquery-task-handler')
|
||||
jqueryTask = new Task(require.resolve('./fixtures/jquery-task-handler'))
|
||||
jqueryLoaded = false
|
||||
jqueryTask.start (loaded) -> jqueryLoaded = loaded
|
||||
|
||||
@@ -24,7 +24,7 @@ describe "Task", ->
|
||||
describe "@once(taskPath, args..., callback)", ->
|
||||
it "terminates the process after it completes", ->
|
||||
handlerResult = null
|
||||
task = Task.once 'fixtures/task-spec-handler', (result) ->
|
||||
task = Task.once require.resolve('./fixtures/task-spec-handler'), (result) ->
|
||||
handlerResult = result
|
||||
|
||||
processClosed = false
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
Project = require 'project'
|
||||
Buffer = require 'text-buffer'
|
||||
fsUtils = require 'fs-utils'
|
||||
{_, fs} = require 'atom'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
{Site} = require 'telepath'
|
||||
|
||||
describe 'TextBuffer', ->
|
||||
[filePath, fileContents, buffer] = []
|
||||
|
||||
beforeEach ->
|
||||
filePath = require.resolve('fixtures/sample.js')
|
||||
fileContents = fsUtils.read(filePath)
|
||||
filePath = require.resolve('./fixtures/sample.js')
|
||||
fileContents = fs.read(filePath)
|
||||
buffer = project.bufferForPath(filePath)
|
||||
|
||||
afterEach ->
|
||||
@@ -24,20 +21,20 @@ describe 'TextBuffer', ->
|
||||
describe "when given a path", ->
|
||||
describe "when a file exists for the path", ->
|
||||
it "loads the contents of that file", ->
|
||||
filePath = require.resolve 'fixtures/sample.txt'
|
||||
filePath = require.resolve './fixtures/sample.txt'
|
||||
buffer = project.bufferForPath(filePath)
|
||||
expect(buffer.getText()).toBe fsUtils.read(filePath)
|
||||
expect(buffer.getText()).toBe fs.read(filePath)
|
||||
|
||||
it "does not allow the initial state of the buffer to be undone", ->
|
||||
filePath = require.resolve 'fixtures/sample.txt'
|
||||
filePath = require.resolve './fixtures/sample.txt'
|
||||
buffer = project.bufferForPath(filePath)
|
||||
buffer.undo()
|
||||
expect(buffer.getText()).toBe fsUtils.read(filePath)
|
||||
expect(buffer.getText()).toBe fs.read(filePath)
|
||||
|
||||
describe "when no file exists for the path", ->
|
||||
it "is modified and is initially empty", ->
|
||||
filePath = "does-not-exist.txt"
|
||||
expect(fsUtils.exists(filePath)).toBeFalsy()
|
||||
expect(fs.exists(filePath)).toBeFalsy()
|
||||
buffer = project.bufferForPath(filePath)
|
||||
expect(buffer.isModified()).toBeTruthy()
|
||||
expect(buffer.getText()).toBe ''
|
||||
@@ -51,17 +48,17 @@ describe 'TextBuffer', ->
|
||||
[filePath, newPath, bufferToChange, eventHandler] = []
|
||||
|
||||
beforeEach ->
|
||||
filePath = path.join(fsUtils.resolveOnLoadPath("fixtures"), "atom-manipulate-me")
|
||||
filePath = path.join(__dirname, "fixtures", "atom-manipulate-me")
|
||||
newPath = "#{filePath}-i-moved"
|
||||
fsUtils.writeSync(filePath, "")
|
||||
fs.writeSync(filePath, "")
|
||||
bufferToChange = project.bufferForPath(filePath)
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
bufferToChange.on 'path-changed', eventHandler
|
||||
|
||||
afterEach ->
|
||||
bufferToChange.destroy()
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
|
||||
it "triggers a `path-changed` event when path is changed", ->
|
||||
bufferToChange.saveAs(newPath)
|
||||
@@ -70,8 +67,8 @@ describe 'TextBuffer', ->
|
||||
it "triggers a `path-changed` event when the file is moved", ->
|
||||
jasmine.unspy(window, "setTimeout")
|
||||
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fsUtils.move(filePath, newPath)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
fs.move(filePath, newPath)
|
||||
|
||||
waitsFor "buffer path change", ->
|
||||
eventHandler.callCount > 0
|
||||
@@ -84,14 +81,14 @@ describe 'TextBuffer', ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = "/tmp/tmp.txt"
|
||||
fsUtils.writeSync(filePath, "first")
|
||||
fs.writeSync(filePath, "first")
|
||||
buffer.release()
|
||||
buffer = project.bufferForPath(filePath).retain()
|
||||
|
||||
afterEach ->
|
||||
buffer.release()
|
||||
buffer = null
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
|
||||
it "does not trigger a change event when Atom modifies the file", ->
|
||||
buffer.insert([0,0], "HELLO!")
|
||||
@@ -107,7 +104,7 @@ describe 'TextBuffer', ->
|
||||
it "changes the memory contents of the buffer to match the new disk contents and triggers a 'changed' event", ->
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
buffer.on 'changed', changeHandler
|
||||
fsUtils.writeSync(filePath, "second")
|
||||
fs.writeSync(filePath, "second")
|
||||
|
||||
expect(changeHandler.callCount).toBe 0
|
||||
waitsFor "file to trigger change event", ->
|
||||
@@ -127,7 +124,7 @@ describe 'TextBuffer', ->
|
||||
buffer.file.on 'contents-changed', fileChangeHandler
|
||||
|
||||
buffer.insert([0, 0], "a change")
|
||||
fsUtils.writeSync(filePath, "second")
|
||||
fs.writeSync(filePath, "second")
|
||||
|
||||
expect(fileChangeHandler.callCount).toBe 0
|
||||
waitsFor "file to trigger 'contents-changed' event", ->
|
||||
@@ -142,7 +139,7 @@ describe 'TextBuffer', ->
|
||||
buffer.insert([0, 0], "a second change")
|
||||
|
||||
handler = jasmine.createSpy('fileChange')
|
||||
fsUtils.writeSync(filePath, "second")
|
||||
fs.writeSync(filePath, "second")
|
||||
buffer.on 'contents-conflicted', handler
|
||||
|
||||
expect(handler.callCount).toBe 0
|
||||
@@ -157,7 +154,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = "/tmp/atom-file-to-delete.txt"
|
||||
fsUtils.writeSync(filePath, 'delete me')
|
||||
fs.writeSync(filePath, 'delete me')
|
||||
bufferToDelete = project.bufferForPath(filePath)
|
||||
filePath = bufferToDelete.getPath() # symlinks may have been converted
|
||||
|
||||
@@ -166,7 +163,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
removeHandler = jasmine.createSpy('removeHandler')
|
||||
bufferToDelete.file.on 'removed', removeHandler
|
||||
fsUtils.remove(filePath)
|
||||
fs.remove(filePath)
|
||||
waitsFor "file to be removed", ->
|
||||
removeHandler.callCount > 0
|
||||
|
||||
@@ -182,7 +179,7 @@ describe 'TextBuffer', ->
|
||||
expect(bufferToDelete.fileExists()).toBeTruthy()
|
||||
expect(bufferToDelete.isInConflict()).toBeFalsy()
|
||||
|
||||
fsUtils.writeSync(filePath, 'moo')
|
||||
fs.writeSync(filePath, 'moo')
|
||||
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
bufferToDelete.on 'changed', changeHandler
|
||||
@@ -215,19 +212,19 @@ describe 'TextBuffer', ->
|
||||
it "reports the modified status changing to true after the underlying file is deleted", ->
|
||||
buffer.release()
|
||||
filePath = "/tmp/atom-tmp-file"
|
||||
fsUtils.writeSync(filePath, 'delete me')
|
||||
fs.writeSync(filePath, 'delete me')
|
||||
buffer = project.bufferForPath(filePath)
|
||||
modifiedHandler = jasmine.createSpy("modifiedHandler")
|
||||
buffer.on 'modified-status-changed', modifiedHandler
|
||||
|
||||
fsUtils.remove(filePath)
|
||||
fs.remove(filePath)
|
||||
|
||||
waitsFor "modified status to change", -> modifiedHandler.callCount
|
||||
runs -> expect(buffer.isModified()).toBe true
|
||||
|
||||
it "reports the modified status changing to false after a modified buffer is saved", ->
|
||||
filePath = "/tmp/atom-tmp-file"
|
||||
fsUtils.writeSync(filePath, '')
|
||||
fs.writeSync(filePath, '')
|
||||
buffer.release()
|
||||
buffer = project.bufferForPath(filePath)
|
||||
modifiedHandler = jasmine.createSpy("modifiedHandler")
|
||||
@@ -251,7 +248,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
it "reports the modified status changing to false after a modified buffer is reloaded", ->
|
||||
filePath = "/tmp/atom-tmp-file"
|
||||
fsUtils.writeSync(filePath, '')
|
||||
fs.writeSync(filePath, '')
|
||||
buffer.release()
|
||||
buffer = project.bufferForPath(filePath)
|
||||
modifiedHandler = jasmine.createSpy("modifiedHandler")
|
||||
@@ -274,8 +271,8 @@ describe 'TextBuffer', ->
|
||||
|
||||
it "reports the modified status changing to false after a buffer to a non-existent file is saved", ->
|
||||
filePath = "/tmp/atom-tmp-file"
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
expect(fsUtils.exists(filePath)).toBeFalsy()
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
expect(fs.exists(filePath)).toBeFalsy()
|
||||
buffer.release()
|
||||
buffer = project.bufferForPath(filePath)
|
||||
modifiedHandler = jasmine.createSpy("modifiedHandler")
|
||||
@@ -287,7 +284,7 @@ describe 'TextBuffer', ->
|
||||
modifiedHandler.reset()
|
||||
|
||||
buffer.save()
|
||||
expect(fsUtils.exists(filePath)).toBeTruthy()
|
||||
expect(fs.exists(filePath)).toBeTruthy()
|
||||
|
||||
expect(modifiedHandler).toHaveBeenCalledWith(false)
|
||||
expect(buffer.isModified()).toBe false
|
||||
@@ -454,16 +451,16 @@ describe 'TextBuffer', ->
|
||||
|
||||
beforeEach ->
|
||||
filePath = '/tmp/temp.txt'
|
||||
fsUtils.writeSync(filePath, "")
|
||||
fs.writeSync(filePath, "")
|
||||
saveBuffer = project.bufferForPath(filePath)
|
||||
saveBuffer.setText("blah")
|
||||
|
||||
it "saves the contents of the buffer to the path", ->
|
||||
saveBuffer.setText 'Buffer contents!'
|
||||
saveBuffer.save()
|
||||
expect(fsUtils.read(filePath)).toEqual 'Buffer contents!'
|
||||
expect(fs.read(filePath)).toEqual 'Buffer contents!'
|
||||
|
||||
it "fires will-be-saved and saved events around the call to fsUtils.writeSync", ->
|
||||
it "fires will-be-saved and saved events around the call to fs.writeSync", ->
|
||||
events = []
|
||||
beforeSave1 = -> events.push('beforeSave1')
|
||||
beforeSave2 = -> events.push('beforeSave2')
|
||||
@@ -472,12 +469,12 @@ describe 'TextBuffer', ->
|
||||
|
||||
saveBuffer.on 'will-be-saved', beforeSave1
|
||||
saveBuffer.on 'will-be-saved', beforeSave2
|
||||
spyOn(fsUtils, 'writeSync').andCallFake -> events.push 'fsUtils.writeSync'
|
||||
spyOn(fs, 'writeSync').andCallFake -> events.push 'fs.writeSync'
|
||||
saveBuffer.on 'saved', afterSave1
|
||||
saveBuffer.on 'saved', afterSave2
|
||||
|
||||
saveBuffer.save()
|
||||
expect(events).toEqual ['beforeSave1', 'beforeSave2', 'fsUtils.writeSync', 'afterSave1', 'afterSave2']
|
||||
expect(events).toEqual ['beforeSave1', 'beforeSave2', 'fs.writeSync', 'afterSave1', 'afterSave2']
|
||||
|
||||
it "fires will-reload and reloaded events when reloaded", ->
|
||||
events = []
|
||||
@@ -511,7 +508,7 @@ describe 'TextBuffer', ->
|
||||
|
||||
it "saves the contents of the buffer to the path", ->
|
||||
filePath = '/tmp/temp.txt'
|
||||
fsUtils.remove filePath if fsUtils.exists(filePath)
|
||||
fs.remove filePath if fs.exists(filePath)
|
||||
|
||||
saveAsBuffer = project.bufferForPath(null).retain()
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
@@ -519,14 +516,14 @@ describe 'TextBuffer', ->
|
||||
|
||||
saveAsBuffer.setText 'Buffer contents!'
|
||||
saveAsBuffer.saveAs(filePath)
|
||||
expect(fsUtils.read(filePath)).toEqual 'Buffer contents!'
|
||||
expect(fs.read(filePath)).toEqual 'Buffer contents!'
|
||||
|
||||
expect(eventHandler).toHaveBeenCalledWith(saveAsBuffer)
|
||||
|
||||
it "stops listening to events on previous path and begins listening to events on new path", ->
|
||||
originalPath = "/tmp/original.txt"
|
||||
newPath = "/tmp/new.txt"
|
||||
fsUtils.writeSync(originalPath, "")
|
||||
fs.writeSync(originalPath, "")
|
||||
|
||||
saveAsBuffer = project.bufferForPath(originalPath).retain()
|
||||
changeHandler = jasmine.createSpy('changeHandler')
|
||||
@@ -534,11 +531,11 @@ describe 'TextBuffer', ->
|
||||
saveAsBuffer.saveAs(newPath)
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
|
||||
fsUtils.writeSync(originalPath, "should not trigger buffer event")
|
||||
fs.writeSync(originalPath, "should not trigger buffer event")
|
||||
waits 20
|
||||
runs ->
|
||||
expect(changeHandler).not.toHaveBeenCalled()
|
||||
fsUtils.writeSync(newPath, "should trigger buffer event")
|
||||
fs.writeSync(newPath, "should trigger buffer event")
|
||||
|
||||
waitsFor ->
|
||||
changeHandler.callCount > 0
|
||||
@@ -547,24 +544,24 @@ describe 'TextBuffer', ->
|
||||
[filePath, newPath, bufferToChange, eventHandler] = []
|
||||
|
||||
beforeEach ->
|
||||
filePath = path.join(fsUtils.resolveOnLoadPath("fixtures"), "atom-manipulate-me")
|
||||
filePath = path.join(__dirname, "fixtures", "atom-manipulate-me")
|
||||
newPath = "#{filePath}-i-moved"
|
||||
fsUtils.writeSync(filePath, "")
|
||||
fs.writeSync(filePath, "")
|
||||
bufferToChange = project.bufferForPath(filePath)
|
||||
eventHandler = jasmine.createSpy('eventHandler')
|
||||
bufferToChange.on 'path-changed', eventHandler
|
||||
|
||||
afterEach ->
|
||||
bufferToChange.destroy()
|
||||
fsUtils.remove(filePath) if fsUtils.exists(filePath)
|
||||
fsUtils.remove(newPath) if fsUtils.exists(newPath)
|
||||
fs.remove(filePath) if fs.exists(filePath)
|
||||
fs.remove(newPath) if fs.exists(newPath)
|
||||
|
||||
it "updates when the text buffer's file is moved", ->
|
||||
expect(bufferToChange.getRelativePath()).toBe('atom-manipulate-me')
|
||||
|
||||
jasmine.unspy(window, "setTimeout")
|
||||
eventHandler.reset()
|
||||
fsUtils.move(filePath, newPath)
|
||||
fs.move(filePath, newPath)
|
||||
|
||||
waitsFor "buffer path change", ->
|
||||
eventHandler.callCount > 0
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
TextMateGrammar = require 'text-mate-grammar'
|
||||
TextMatePackage = require 'text-mate-package'
|
||||
plist = require 'plist'
|
||||
fsUtils = require 'fs-utils'
|
||||
_ = require 'underscore'
|
||||
TextMateGrammar = require '../src/text-mate-grammar'
|
||||
TextMatePackage = require '../src/text-mate-package'
|
||||
{_, fs} = require 'atom'
|
||||
|
||||
describe "TextMateGrammar", ->
|
||||
grammar = null
|
||||
@@ -19,13 +17,13 @@ describe "TextMateGrammar", ->
|
||||
|
||||
describe "@loadSync(path)", ->
|
||||
it "loads grammars from plists", ->
|
||||
grammar = TextMateGrammar.loadSync(fsUtils.resolveOnLoadPath('fixtures/sample.plist'))
|
||||
grammar = TextMateGrammar.loadSync(require.resolve('./fixtures/sample.plist'))
|
||||
expect(grammar.scopeName).toBe "text.plain"
|
||||
{tokens} = grammar.tokenizeLine("this text is so plain. i love it.")
|
||||
expect(tokens[0]).toEqual value: "this text is so plain. i love it.", scopes: ["text.plain", "meta.paragraph.text"]
|
||||
|
||||
it "loads grammars from cson files", ->
|
||||
grammar = TextMateGrammar.loadSync(fsUtils.resolveOnLoadPath('spec/fixtures/packages/package-with-grammars/grammars/alot.cson'))
|
||||
grammar = TextMateGrammar.loadSync(require.resolve('./fixtures/packages/package-with-grammars/grammars/alot.cson'))
|
||||
expect(grammar.scopeName).toBe "source.alot"
|
||||
{tokens} = grammar.tokenizeLine("this is alot of code")
|
||||
expect(tokens[1]).toEqual value: "alot", scopes: ["source.alot", "keyword.alot"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
textUtils = require 'text-utils'
|
||||
textUtils = require '../src/text-utils'
|
||||
|
||||
describe 'text utilities', ->
|
||||
describe '.getCharacterCount(string)', ->
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
$ = require 'jquery'
|
||||
{$} = require 'atom'
|
||||
|
||||
ThemeManager = require 'theme-manager'
|
||||
AtomPackage = require 'atom-package'
|
||||
ThemeManager = require '../src/theme-manager'
|
||||
AtomPackage = require '../src/atom-package'
|
||||
|
||||
describe "ThemeManager", ->
|
||||
themeManager = null
|
||||
@@ -30,7 +30,7 @@ describe "ThemeManager", ->
|
||||
themeManager.load()
|
||||
|
||||
config.set('core.themes', [])
|
||||
expect($('style.userTheme').length).toBe 0
|
||||
expect($('style.theme').length).toBe 0
|
||||
expect(reloadHandler).toHaveBeenCalled()
|
||||
|
||||
config.set('core.themes', ['atom-dark-syntax'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_ = require 'underscore'
|
||||
{_} = require 'atom'
|
||||
|
||||
module.exports =
|
||||
class TimeReporter extends jasmine.Reporter
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
TokenizedBuffer = require 'tokenized-buffer'
|
||||
{Range} = require 'telepath'
|
||||
_ = require 'underscore'
|
||||
TokenizedBuffer = require '../src/tokenized-buffer'
|
||||
{_} = require 'atom'
|
||||
|
||||
describe "TokenizedBuffer", ->
|
||||
[tokenizedBuffer, buffer, changeHandler] = []
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_ = require 'underscore'
|
||||
{_} = require 'atom'
|
||||
|
||||
describe "underscore extensions", ->
|
||||
describe "_.adviseBefore", ->
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
{$$} = require 'space-pen'
|
||||
fsUtils = require 'fs-utils'
|
||||
{$, $$, fs} = require 'atom'
|
||||
path = require 'path'
|
||||
{less} = require 'less'
|
||||
WindowEventHandler = require 'window-event-handler'
|
||||
WindowEventHandler = require '../src/window-event-handler'
|
||||
|
||||
describe "Window", ->
|
||||
[projectPath, windowEventHandler] = []
|
||||
@@ -88,7 +85,7 @@ describe "Window", ->
|
||||
|
||||
element = $('head style[id*="css.css"]')
|
||||
expect(element.attr('id')).toBe cssPath
|
||||
expect(element.text()).toBe fsUtils.read(cssPath)
|
||||
expect(element.text()).toBe fs.read(cssPath)
|
||||
|
||||
# doesn't append twice
|
||||
requireStylesheet(cssPath)
|
||||
@@ -120,9 +117,9 @@ describe "Window", ->
|
||||
$('head style[id*="sample.less"]').remove()
|
||||
|
||||
it "supports requiring css and less stylesheets without an explicit extension", ->
|
||||
requireStylesheet 'fixtures/css'
|
||||
requireStylesheet path.join(__dirname, 'fixtures', 'css')
|
||||
expect($('head style[id*="css.css"]').attr('id')).toBe project.resolve('css.css')
|
||||
requireStylesheet 'fixtures/sample'
|
||||
requireStylesheet path.join(__dirname, 'fixtures', 'sample')
|
||||
expect($('head style[id*="sample.less"]').attr('id')).toBe project.resolve('sample.less')
|
||||
|
||||
$('head style[id*="css.css"]').remove()
|
||||
@@ -130,7 +127,7 @@ describe "Window", ->
|
||||
|
||||
describe ".removeStylesheet(path)", ->
|
||||
it "removes styling applied by given stylesheet path", ->
|
||||
cssPath = require.resolve(path.join("fixtures", "css.css"))
|
||||
cssPath = require.resolve('./fixtures/css.css')
|
||||
|
||||
expect($(document.body).css('font-weight')).not.toBe("bold")
|
||||
requireStylesheet(cssPath)
|
||||
|
||||
@@ -224,7 +224,7 @@ class AtomApplication
|
||||
openedWindow = existingWindow
|
||||
openedWindow.openPath(pathToOpen, initialLine)
|
||||
else
|
||||
bootstrapScript = 'window-bootstrap'
|
||||
bootstrapScript = require.resolve('./window-bootstrap')
|
||||
if devMode
|
||||
resourcePath = global.devResourcePath
|
||||
else
|
||||
@@ -276,13 +276,21 @@ class AtomApplication
|
||||
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
|
||||
resourcePath = @resourcePath
|
||||
|
||||
bootstrapScript = 'spec-bootstrap'
|
||||
try
|
||||
bootstrapScript = require.resolve(path.resolve(global.devResourcePath, 'spec', 'spec-bootstrap'))
|
||||
catch error
|
||||
bootstrapScript = require.resolve(path.resolve(__dirname, '..', 'spec', 'spec-bootstrap'))
|
||||
|
||||
isSpec = true
|
||||
devMode = true
|
||||
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specDirectory})
|
||||
|
||||
runBenchmarks: ->
|
||||
bootstrapScript = 'benchmark/benchmark-bootstrap'
|
||||
try
|
||||
bootstrapScript = require.resolve(path.resolve(global.devResourcePath, 'benchmark', 'benchmark-bootstrap'))
|
||||
catch error
|
||||
bootstrapScript = require.resolve(path.resolve(__dirname, '..', 'benchmark', 'benchmark-bootstrap'))
|
||||
|
||||
isSpec = true # Needed because this flag adds the spec directory to the NODE_PATH
|
||||
new AtomWindow({bootstrapScript, @resourcePath, isSpec})
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
TextMateGrammar = require 'text-mate-grammar'
|
||||
Package = require 'package'
|
||||
fsUtils = require 'fs-utils'
|
||||
TextMateGrammar = require './text-mate-grammar'
|
||||
Package = require './package'
|
||||
fsUtils = require './fs-utils'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
$ = require 'jquery'
|
||||
_ = require './underscore-extensions'
|
||||
$ = require './jquery-extensions'
|
||||
CSON = require 'season'
|
||||
EventEmitter = require 'event-emitter'
|
||||
EventEmitter = require './event-emitter'
|
||||
|
||||
### Internal: Loads and resolves packages. ###
|
||||
|
||||
@@ -24,6 +24,8 @@ class AtomPackage extends Package
|
||||
resolvedMainModulePath: false
|
||||
mainModule: null
|
||||
|
||||
getType: -> 'atom'
|
||||
|
||||
load: ->
|
||||
try
|
||||
@metadata = Package.loadMetadata(@path)
|
||||
|
||||
@@ -44,18 +44,7 @@ class AtomWindow
|
||||
@openPath(pathToOpen, initialLine)
|
||||
|
||||
setupNodePath: (resourcePath) ->
|
||||
paths = [
|
||||
'src'
|
||||
'vendor'
|
||||
'static'
|
||||
'node_modules'
|
||||
]
|
||||
paths.push('spec') if @isSpec
|
||||
|
||||
paths = paths.map (relativePath) -> path.resolve(resourcePath, relativePath)
|
||||
paths.push(resourcePath)
|
||||
|
||||
process.env['NODE_PATH'] = paths.join path.delimiter
|
||||
process.env['NODE_PATH'] = path.resolve(resourcePath, 'exports')
|
||||
|
||||
getInitialPath: ->
|
||||
@browserWindow.loadSettings.initialPath
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fsUtils = require 'fs-utils'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
Package = require 'package'
|
||||
fsUtils = require './fs-utils'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
Package = require './package'
|
||||
ipc = require 'ipc'
|
||||
remote = require 'remote'
|
||||
crypto = require 'crypto'
|
||||
@@ -9,7 +9,7 @@ path = require 'path'
|
||||
dialog = remote.require 'dialog'
|
||||
app = remote.require 'app'
|
||||
telepath = require 'telepath'
|
||||
ThemeManager = require 'theme-manager'
|
||||
ThemeManager = require './theme-manager'
|
||||
|
||||
window.atom =
|
||||
loadedPackages: {}
|
||||
@@ -145,7 +145,7 @@ window.atom =
|
||||
@reloadBaseStylesheets()
|
||||
|
||||
reloadBaseStylesheets: ->
|
||||
requireStylesheet('atom')
|
||||
requireStylesheet('../static/atom')
|
||||
if nativeStylesheetPath = fsUtils.resolveOnLoadPath(process.platform, ['css', 'less'])
|
||||
requireStylesheet(nativeStylesheetPath)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
|
||||
Specificity = require 'specificity'
|
||||
Specificity = require '../vendor/specificity'
|
||||
PEG = require 'pegjs'
|
||||
|
||||
### Internal ###
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
BufferedProcess = require 'buffered-process'
|
||||
BufferedProcess = require './buffered-process'
|
||||
path = require 'path'
|
||||
|
||||
# Private: Like BufferedProcess, but accepts a node script instead of an
|
||||
# Public: Like BufferedProcess, but accepts a node script instead of an
|
||||
# executable, on Unix which allows running scripts and executables, this seems
|
||||
# unnecessary, but on Windows we have to separate scripts from executables since
|
||||
# it doesn't support shebang strings.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
ChildProcess = require 'child_process'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Private: A wrapper which provides buffering for ChildProcess.
|
||||
# Public: A wrapper which provides buffering for ChildProcess.
|
||||
module.exports =
|
||||
class BufferedProcess
|
||||
process: null
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
path = require 'path'
|
||||
fs = require 'fs'
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
async = require 'async'
|
||||
mkdirp = require 'mkdirp'
|
||||
fsUtils = require 'fs-utils'
|
||||
fsUtils = require './fs-utils'
|
||||
|
||||
symlinkCommand = (sourcePath, destinationPath, callback) ->
|
||||
mkdirp path.dirname(destinationPath), (error) ->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fsUtils = require 'fs-utils'
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require 'event-emitter'
|
||||
fsUtils = require './fs-utils'
|
||||
_ = require './underscore-extensions'
|
||||
EventEmitter = require './event-emitter'
|
||||
CSON = require 'season'
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
@@ -54,8 +54,8 @@ class Config
|
||||
# Private: Created during initialization, available as `global.config`
|
||||
constructor: ->
|
||||
@defaultSettings =
|
||||
core: _.clone(require('root-view').configDefaults)
|
||||
editor: _.clone(require('editor').configDefaults)
|
||||
core: _.clone(require('./root-view').configDefaults)
|
||||
editor: _.clone(require('./editor').configDefaults)
|
||||
@settings = {}
|
||||
@configFilePath = fsUtils.resolve(configDirPath, 'config', ['json', 'cson'])
|
||||
@configFilePath ?= path.join(configDirPath, 'config.cson')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{View} = require 'space-pen'
|
||||
{View} = require './space-pen-extensions'
|
||||
{Point, Range} = require 'telepath'
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
### Internal ###
|
||||
module.exports =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{Point, Range} = require 'telepath'
|
||||
EventEmitter = require 'event-emitter'
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require './event-emitter'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Public: The `Cursor` class represents the little blinking line identifying
|
||||
# where text can be inserted.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
fsUtils = require 'fs-utils'
|
||||
fsUtils = require './fs-utils'
|
||||
pathWatcher = require 'pathwatcher'
|
||||
File = require 'file'
|
||||
EventEmitter = require 'event-emitter'
|
||||
File = require './file'
|
||||
EventEmitter = require './event-emitter'
|
||||
|
||||
# Public: Represents a directory using {File}s
|
||||
module.exports =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{Range} = require 'telepath'
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Subscriber = require 'subscriber'
|
||||
_ = require './underscore-extensions'
|
||||
EventEmitter = require './event-emitter'
|
||||
Subscriber = require './subscriber'
|
||||
|
||||
# Private:
|
||||
module.exports =
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
guid = require 'guid'
|
||||
telepath = require 'telepath'
|
||||
{Point, Range} = telepath
|
||||
TokenizedBuffer = require 'tokenized-buffer'
|
||||
RowMap = require 'row-map'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Fold = require 'fold'
|
||||
Token = require 'token'
|
||||
DisplayBufferMarker = require 'display-buffer-marker'
|
||||
Subscriber = require 'subscriber'
|
||||
ConfigObserver = require 'config-observer'
|
||||
TokenizedBuffer = require './tokenized-buffer'
|
||||
RowMap = require './row-map'
|
||||
EventEmitter = require './event-emitter'
|
||||
Fold = require './fold'
|
||||
Token = require './token'
|
||||
DisplayBufferMarker = require './display-buffer-marker'
|
||||
Subscriber = require './subscriber'
|
||||
ConfigObserver = require './config-observer'
|
||||
|
||||
# Private:
|
||||
module.exports =
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
_ = require './underscore-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
path = require 'path'
|
||||
telepath = require 'telepath'
|
||||
guid = require 'guid'
|
||||
{Point, Range} = telepath
|
||||
Buffer = require 'text-buffer'
|
||||
LanguageMode = require 'language-mode'
|
||||
DisplayBuffer = require 'display-buffer'
|
||||
Cursor = require 'cursor'
|
||||
Selection = require 'selection'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Subscriber = require 'subscriber'
|
||||
LanguageMode = require './language-mode'
|
||||
DisplayBuffer = require './display-buffer'
|
||||
Cursor = require './cursor'
|
||||
Selection = require './selection'
|
||||
EventEmitter = require './event-emitter'
|
||||
Subscriber = require './subscriber'
|
||||
TextMateScopeSelector = require('first-mate').ScopeSelector
|
||||
|
||||
# Public: The core model of Atom.
|
||||
@@ -132,7 +131,7 @@ class EditSession
|
||||
|
||||
# Private:
|
||||
getViewClass: ->
|
||||
require 'editor'
|
||||
require './editor'
|
||||
|
||||
# Private:
|
||||
destroy: ->
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{View, $$} = require 'space-pen'
|
||||
TextBuffer = require 'text-buffer'
|
||||
Gutter = require 'gutter'
|
||||
{View, $$} = require './space-pen-extensions'
|
||||
TextBuffer = require './text-buffer'
|
||||
Gutter = require './gutter'
|
||||
{Point, Range} = require 'telepath'
|
||||
EditSession = require 'edit-session'
|
||||
CursorView = require 'cursor-view'
|
||||
SelectionView = require 'selection-view'
|
||||
fsUtils = require 'fs-utils'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
EditSession = require './edit-session'
|
||||
CursorView = require './cursor-view'
|
||||
SelectionView = require './selection-view'
|
||||
fsUtils = require './fs-utils'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Private: Represents the entire visual pane in Atom.
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Public: Provides a list of functions that can be used in Atom for event management.
|
||||
#
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
EventEmitter = require 'event-emitter'
|
||||
EventEmitter = require './event-emitter'
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
fsUtils = require 'fs-utils'
|
||||
fsUtils = require './fs-utils'
|
||||
pathWatcher = require 'pathwatcher'
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Public: Represents an individual file in the editor.
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
fs = require 'fs'
|
||||
mkdirp = require 'mkdirp'
|
||||
Module = require 'module'
|
||||
@@ -6,7 +6,8 @@ async = require 'async'
|
||||
rimraf = require 'rimraf'
|
||||
path = require 'path'
|
||||
|
||||
module.exports =
|
||||
# Public: Useful extensions to node's built-in fs module
|
||||
fsExtensions =
|
||||
# Make the given path absolute by resolving it against the
|
||||
# current working directory.
|
||||
absolute: (relativePath) ->
|
||||
@@ -301,3 +302,5 @@ module.exports =
|
||||
CSON.readFile(objectPath, done)
|
||||
else
|
||||
@readPlist(objectPath, done)
|
||||
|
||||
module.exports = _.extend({}, fs, fsExtensions)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
stringScore = require 'stringscore'
|
||||
stringScore = require '../vendor/stringscore'
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (candidates, query, options={}) ->
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
Subscriber = require 'subscriber'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Task = require 'task'
|
||||
_ = require './underscore-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
Subscriber = require './subscriber'
|
||||
EventEmitter = require './event-emitter'
|
||||
Task = require './task'
|
||||
GitUtils = require 'git-utils'
|
||||
|
||||
# Public: Represents the underlying git operations performed by Atom.
|
||||
@@ -247,7 +247,7 @@ class Git
|
||||
|
||||
# Private:
|
||||
refreshStatus: ->
|
||||
@statusTask = Task.once 'repository-status-handler', @getPath(), ({statuses, upstream}) =>
|
||||
@statusTask = Task.once require.resolve('./repository-status-handler'), @getPath(), ({statuses, upstream}) =>
|
||||
statusesUnchanged = _.isEqual(statuses, @statuses) and _.isEqual(upstream, @upstream)
|
||||
@statuses = statuses
|
||||
@upstream = upstream
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{View, $$, $$$} = require 'space-pen'
|
||||
{View, $$, $$$} = require './space-pen-extensions'
|
||||
{Range} = require 'telepath'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Private: Represents the portion of the {Editor} containing row numbers.
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
$ = require '../vendor/jquery'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
$.fn.scrollBottom = (newValue) ->
|
||||
if newValue?
|
||||
@@ -126,3 +126,5 @@ $.fn.intValue = ->
|
||||
$.Event.prototype.abortKeyBinding = ->
|
||||
$.Event.prototype.currentTargetView = -> $(this.currentTarget).view()
|
||||
$.Event.prototype.targetView = -> $(this.target).view()
|
||||
|
||||
module.exports = $
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
path = require 'path'
|
||||
CSON = require 'season'
|
||||
BindingSet = require 'binding-set'
|
||||
BindingSet = require './binding-set'
|
||||
|
||||
# Internal: Associates keymaps with actions.
|
||||
#
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
{Range} = require 'telepath'
|
||||
_ = require 'underscore'
|
||||
require 'underscore-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
{OnigRegExp} = require 'oniguruma'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Subscriber = require 'subscriber'
|
||||
EventEmitter = require './event-emitter'
|
||||
Subscriber = require './subscriber'
|
||||
|
||||
### Internal ###
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
path = require 'path'
|
||||
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
LessCache = require 'less-cache'
|
||||
|
||||
module.exports =
|
||||
|
||||
@@ -42,8 +42,8 @@ delegate.browserMainParts.preMainMessageLoopRun = ->
|
||||
args.pathsToOpen = args.pathsToOpen.map (pathToOpen) ->
|
||||
path.resolve(args.executedFrom ? process.cwd(), pathToOpen)
|
||||
|
||||
require('coffee-script')
|
||||
if args.devMode
|
||||
require('coffee-script')
|
||||
require(path.join(args.resourcePath, 'src', 'coffee-cache'))
|
||||
require('module').globalPaths.push(path.join(args.resourcePath, 'src'))
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Token = require 'token'
|
||||
EventEmitter = require 'event-emitter'
|
||||
_ = require 'underscore'
|
||||
Token = require './token'
|
||||
EventEmitter = require './event-emitter'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
### Internal ###
|
||||
module.exports =
|
||||
|
||||
@@ -5,8 +5,8 @@ CSON = require 'season'
|
||||
module.exports =
|
||||
class Package
|
||||
@build: (path) ->
|
||||
TextMatePackage = require 'text-mate-package'
|
||||
AtomPackage = require 'atom-package'
|
||||
TextMatePackage = require './text-mate-package'
|
||||
AtomPackage = require './atom-package'
|
||||
|
||||
if TextMatePackage.testName(path)
|
||||
new TextMatePackage(path)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
$ = require 'jquery'
|
||||
{View} = require 'space-pen'
|
||||
$ = require './jquery-extensions'
|
||||
{View} = require './space-pen-extensions'
|
||||
telepath = require 'telepath'
|
||||
|
||||
### Internal ###
|
||||
@@ -61,7 +61,7 @@ class PaneAxis extends View
|
||||
primitiveRemove(child)
|
||||
|
||||
container.adjustPaneDimensions()
|
||||
Pane = require 'pane'
|
||||
Pane = require './pane'
|
||||
container.trigger 'pane:removed', [child] if child instanceof Pane
|
||||
|
||||
detachChild: (child) ->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
PaneAxis = require 'pane-axis'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
PaneAxis = require './pane-axis'
|
||||
|
||||
# Internal:
|
||||
module.exports =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{View} = require 'space-pen'
|
||||
Pane = require 'pane'
|
||||
$ = require 'jquery'
|
||||
{View} = require './space-pen-extensions'
|
||||
Pane = require './pane'
|
||||
$ = require './jquery-extensions'
|
||||
telepath = require 'telepath'
|
||||
|
||||
# Private: Manages the list of panes within a {RootView}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
PaneAxis = require 'pane-axis'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
PaneAxis = require './pane-axis'
|
||||
|
||||
### Internal ###
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{dirname} = require 'path'
|
||||
{View} = require 'space-pen'
|
||||
$ = require 'jquery'
|
||||
_ = require 'underscore'
|
||||
{View} = require './space-pen-extensions'
|
||||
$ = require './jquery-extensions'
|
||||
_ = require './underscore-extensions'
|
||||
telepath = require 'telepath'
|
||||
PaneRow = require 'pane-row'
|
||||
PaneColumn = require 'pane-column'
|
||||
PaneRow = require './pane-row'
|
||||
PaneColumn = require './pane-column'
|
||||
|
||||
# Public: A container which can contains multiple items to be switched between.
|
||||
#
|
||||
@@ -402,7 +402,7 @@ class Pane extends View
|
||||
|
||||
# Private:
|
||||
split: (items, axis, side) ->
|
||||
PaneContainer = require 'pane-container'
|
||||
PaneContainer = require './pane-container'
|
||||
|
||||
parent = @parent().view()
|
||||
unless parent.hasClass(axis)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
fsUtils = require 'fs-utils'
|
||||
fsUtils = require './fs-utils'
|
||||
path = require 'path'
|
||||
url = require 'url'
|
||||
|
||||
_ = require 'underscore'
|
||||
$ = require 'jquery'
|
||||
_ = require './underscore-extensions'
|
||||
$ = require './jquery-extensions'
|
||||
telepath = require 'telepath'
|
||||
{Range} = telepath
|
||||
TextBuffer = require 'text-buffer'
|
||||
EditSession = require 'edit-session'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Directory = require 'directory'
|
||||
BufferedNodeProcess = require 'buffered-node-process'
|
||||
Git = require 'git'
|
||||
TextBuffer = require './text-buffer'
|
||||
EditSession = require './edit-session'
|
||||
EventEmitter = require './event-emitter'
|
||||
Directory = require './directory'
|
||||
BufferedNodeProcess = require './buffered-node-process'
|
||||
Git = require './git'
|
||||
|
||||
# Public: Represents a project that's opened in Atom.
|
||||
#
|
||||
@@ -29,17 +29,7 @@ class Project
|
||||
# Private:
|
||||
@deserialize: (state) -> new Project(state)
|
||||
|
||||
@openers: []
|
||||
|
||||
# Public:
|
||||
@registerOpener: (opener) ->
|
||||
@openers.push(opener)
|
||||
|
||||
# Public:
|
||||
@unregisterOpener: (opener) ->
|
||||
_.remove(@openers, opener)
|
||||
|
||||
# Public:
|
||||
# Public: Find the local path for the given repository URL.
|
||||
@pathForRepositoryUrl: (repoUrl) ->
|
||||
[repoName] = url.parse(repoUrl).path.split('/')[-1..]
|
||||
repoName = repoName.replace(/\.git$/, '')
|
||||
@@ -48,7 +38,13 @@ class Project
|
||||
rootDirectory: null
|
||||
editSessions: null
|
||||
ignoredPathRegexes: null
|
||||
openers: null
|
||||
|
||||
# Public:
|
||||
registerOpener: (opener) -> @openers.push(opener)
|
||||
|
||||
# Public:
|
||||
unregisterOpener: (opener) -> _.remove(@openers, opener)
|
||||
|
||||
# Private:
|
||||
destroy: ->
|
||||
@@ -66,6 +62,7 @@ class Project
|
||||
#
|
||||
# path - The {String} name of the path
|
||||
constructor: (pathOrState) ->
|
||||
@openers = []
|
||||
@editSessions = []
|
||||
@buffers = []
|
||||
|
||||
@@ -193,7 +190,7 @@ class Project
|
||||
# Returns an {EditSession}.
|
||||
open: (filePath, options={}) ->
|
||||
filePath = @resolve(filePath) if filePath?
|
||||
for opener in @constructor.openers
|
||||
for opener in @openers
|
||||
return resource if resource = opener(filePath, options)
|
||||
|
||||
@buildEditSessionForBuffer(@bufferForPath(filePath), options)
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
ipc = require 'ipc'
|
||||
path = require 'path'
|
||||
$ = require 'jquery'
|
||||
{$$} = require 'space-pen'
|
||||
fsUtils = require 'fs-utils'
|
||||
_ = require 'underscore'
|
||||
$ = require './jquery-extensions'
|
||||
{$$, View} = require './space-pen-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
_ = require './underscore-extensions'
|
||||
telepath = require 'telepath'
|
||||
{View} = require 'space-pen'
|
||||
Buffer = require 'text-buffer'
|
||||
Editor = require 'editor'
|
||||
Project = require 'project'
|
||||
Pane = require 'pane'
|
||||
PaneColumn = require 'pane-column'
|
||||
PaneRow = require 'pane-row'
|
||||
PaneContainer = require 'pane-container'
|
||||
EditSession = require 'edit-session'
|
||||
Editor = require './editor'
|
||||
Pane = require './pane'
|
||||
PaneColumn = require './pane-column'
|
||||
PaneRow = require './pane-row'
|
||||
PaneContainer = require './pane-container'
|
||||
EditSession = require './edit-session'
|
||||
|
||||
# Public: The container for the entire Atom application.
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{View} = require 'space-pen'
|
||||
{View} = require './space-pen-extensions'
|
||||
|
||||
# Public: Represents a view that scrolls.
|
||||
#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
$ = require 'jquery'
|
||||
{ View } = require 'space-pen'
|
||||
Editor = require 'editor'
|
||||
fuzzyFilter = require 'fuzzy-filter'
|
||||
$ = require './jquery-extensions'
|
||||
{ View } = require './space-pen-extensions'
|
||||
Editor = require './editor'
|
||||
fuzzyFilter = require './fuzzy-filter'
|
||||
|
||||
# Public: Provides a widget for users to make a selection from a list of
|
||||
# choices.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{Point, Range} = require 'telepath'
|
||||
{View, $$} = require 'space-pen'
|
||||
{View, $$} = require './space-pen-extensions'
|
||||
|
||||
# Internal:
|
||||
module.exports =
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{Range} = require 'telepath'
|
||||
EventEmitter = require 'event-emitter'
|
||||
_ = require 'underscore'
|
||||
EventEmitter = require './event-emitter'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Public: Represents a selection in the {EditSession}.
|
||||
module.exports =
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
_ = require 'underscore'
|
||||
{View} = require 'space-pen'
|
||||
jQuery = require 'jquery'
|
||||
ConfigObserver = require 'config-observer'
|
||||
Subscriber = require 'subscriber'
|
||||
_ = require './underscore-extensions'
|
||||
spacePen = require 'space-pen'
|
||||
jQuery = require './jquery-extensions'
|
||||
ConfigObserver = require './config-observer'
|
||||
Subscriber = require './subscriber'
|
||||
|
||||
_.extend View.prototype, ConfigObserver
|
||||
_.extend View.prototype, Subscriber
|
||||
_.extend spacePen.View.prototype, ConfigObserver
|
||||
_.extend spacePen.View.prototype, Subscriber
|
||||
|
||||
originalCleanData = jQuery.cleanData
|
||||
jQuery.cleanData = (elements) ->
|
||||
@@ -14,3 +14,5 @@ jQuery.cleanData = (elements) ->
|
||||
view.unobserveConfig()
|
||||
view.unsubscribe()
|
||||
originalCleanData(elements)
|
||||
|
||||
module.exports = spacePen
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
|
||||
# Public: Mixin for managing subscriptions of event listeners to different objects.
|
||||
#
|
||||
# Support unsubscribe from all register event listeners or just the listeners
|
||||
# registered on a given object.
|
||||
module.exports =
|
||||
subscribeWith: (eventEmitter, methodName, args) ->
|
||||
eventEmitter[methodName](args...)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
_ = require 'underscore'
|
||||
jQuery = require 'jquery'
|
||||
Specificity = require 'specificity'
|
||||
{$$} = require 'space-pen'
|
||||
fsUtils = require 'fs-utils'
|
||||
EventEmitter = require 'event-emitter'
|
||||
NullGrammar = require 'null-grammar'
|
||||
_ = require './underscore-extensions'
|
||||
jQuery = require './jquery-extensions'
|
||||
Specificity = require '../vendor/specificity'
|
||||
{$$} = require './space-pen-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
EventEmitter = require './event-emitter'
|
||||
NullGrammar = require './null-grammar'
|
||||
TextMateScopeSelector = require('first-mate').ScopeSelector
|
||||
|
||||
### Internal ###
|
||||
|
||||
@@ -28,8 +28,11 @@ setupGlobals = ->
|
||||
global.window = global
|
||||
|
||||
handleEvents = ->
|
||||
process.on 'uncaughtException', (error) -> console.error(error.message)
|
||||
process.on 'message', ({args}) ->
|
||||
process.on 'uncaughtException', (error) ->
|
||||
console.error(error.message, error.stack)
|
||||
process.on 'message', ({event, args}={}) ->
|
||||
return unless event is 'start'
|
||||
|
||||
isAsync = false
|
||||
async = ->
|
||||
isAsync = true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
child_process = require 'child_process'
|
||||
EventEmitter = require 'event-emitter'
|
||||
EventEmitter = require './event-emitter'
|
||||
|
||||
# Public: Run a node script in a separate process.
|
||||
#
|
||||
@@ -11,7 +11,7 @@ EventEmitter = require 'event-emitter'
|
||||
# * task:log - Emitted when console.log is called within the task.
|
||||
# * task:warn - Emitted when console.warn is called within the task.
|
||||
# * task:error - Emitted when console.error is called within the task.
|
||||
# * task:complete - Emitted when the task has succeeded or failed.
|
||||
# * task:completed - Emitted when the task has succeeded or failed.
|
||||
module.exports =
|
||||
class Task
|
||||
_.extend @prototype, EventEmitter
|
||||
@@ -43,14 +43,17 @@ class Task
|
||||
# The path to the Coffeescript/Javascript file that exports a single
|
||||
# function to execute.
|
||||
constructor: (taskPath) ->
|
||||
coffeeScriptRequire = "require('#{require.resolve('coffee-script')}');"
|
||||
coffeeCacheRequire = "require('#{require.resolve('./coffee-cache')}');"
|
||||
taskBootstrapRequire = "require('#{require.resolve('./task-bootstrap')}');"
|
||||
bootstrap = """
|
||||
require('coffee-script');
|
||||
require('coffee-cache');
|
||||
#{coffeeScriptRequire}
|
||||
#{coffeeCacheRequire}
|
||||
Object.defineProperty(require.extensions, '.coffee', {
|
||||
writable: false,
|
||||
value: require.extensions['.coffee']
|
||||
});
|
||||
require('task-bootstrap');
|
||||
#{taskBootstrapRequire}
|
||||
"""
|
||||
|
||||
taskPath = require.resolve(taskPath)
|
||||
@@ -83,7 +86,14 @@ class Task
|
||||
|
||||
@handleEvents()
|
||||
@callback = args.pop() if _.isFunction(args[args.length - 1])
|
||||
@childProcess.send({args})
|
||||
@send({event: 'start', args})
|
||||
|
||||
# Public: Send message to the task
|
||||
#
|
||||
# * message:
|
||||
# The message to send
|
||||
send: (message) ->
|
||||
@childProcess.send(message)
|
||||
|
||||
# Public: Forcefully stop the running task.
|
||||
#
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
_ = require 'underscore'
|
||||
_ = require './underscore-extensions'
|
||||
telepath = require 'telepath'
|
||||
{Point, Range} = telepath
|
||||
fsUtils = require 'fs-utils'
|
||||
File = require 'file'
|
||||
EventEmitter = require 'event-emitter'
|
||||
Subscriber = require 'subscriber'
|
||||
fsUtils = require './fs-utils'
|
||||
File = require './file'
|
||||
EventEmitter = require './event-emitter'
|
||||
Subscriber = require './subscriber'
|
||||
guid = require 'guid'
|
||||
|
||||
# Private: Represents the contents of a file.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
_ = require 'underscore'
|
||||
fsUtils = require 'fs-utils'
|
||||
_ = require './underscore-extensions'
|
||||
fsUtils = require './fs-utils'
|
||||
plist = require 'plist'
|
||||
Token = require 'token'
|
||||
Token = require './token'
|
||||
{OnigRegExp, OnigScanner} = require 'oniguruma'
|
||||
path = require 'path'
|
||||
EventEmitter = require 'event-emitter'
|
||||
EventEmitter = require './event-emitter'
|
||||
{ScopeSelector} = require 'first-mate'
|
||||
|
||||
pathSplitRegex = new RegExp("[#{path.sep}.]")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Package = require 'package'
|
||||
fsUtils = require 'fs-utils'
|
||||
Package = require './package'
|
||||
fsUtils = require './fs-utils'
|
||||
path = require 'path'
|
||||
_ = require 'underscore'
|
||||
TextMateGrammar = require 'text-mate-grammar'
|
||||
_ = require './underscore-extensions'
|
||||
TextMateGrammar = require './text-mate-grammar'
|
||||
async = require 'async'
|
||||
|
||||
### Internal ###
|
||||
@@ -26,6 +26,8 @@ class TextMatePackage extends Package
|
||||
@scopedProperties = []
|
||||
@metadata = {@name}
|
||||
|
||||
getType: -> 'textmate'
|
||||
|
||||
load: ({sync}={}) ->
|
||||
@metadata = Package.loadMetadata(@path, true)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user