From 288abbc57b85c8379449feec9e55ffeb9ade7785 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 13 Nov 2015 10:51:31 +0100 Subject: [PATCH 01/89] Add OS X dock menu with 'New Window' option --- src/browser/atom-application.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 8bb44349e..56c4ea216 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -82,6 +82,7 @@ class AtomApplication @listenForArgumentsFromNewProcess() @setupJavaScriptArguments() @handleEvents() + @setupDockMenu() @storageFolder = new StorageFolder(process.env.ATOM_HOME) if options.pathsToOpen?.length > 0 or options.urlsToOpen?.length > 0 or options.test @@ -280,6 +281,13 @@ class AtomApplication ipc.on 'write-to-stderr', (event, output) -> process.stderr.write(output) + setupDockMenu: -> + if process.platform is 'darwin' + dockMenu = Menu.buildFromTemplate [ + {label: 'New Window', click: => @emit('application:new-window')} + ] + app.dock.setMenu dockMenu + # Public: Executes the given command. # # If it isn't handled globally, delegate to the currently focused window. From c8843b1b56e6bc61a483a0f99286981f657ca828 Mon Sep 17 00:00:00 2001 From: Wliu Date: Tue, 17 Nov 2015 22:58:55 -0500 Subject: [PATCH 02/89] :checkered_flag: Add --no-shortcut flag to disable creating a desktop shortcut --- build/Gruntfile.coffee | 3 ++- build/tasks/install-task.coffee | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 8dd1c573b..cb6ff0c1e 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -37,6 +37,7 @@ module.exports = (grunt) -> buildDir ?= path.join(os.tmpdir(), 'atom-build') buildDir = path.resolve(buildDir) disableAutoUpdate = grunt.option('no-auto-update') ? false + disableShortcut = grunt.option('no-shortcut') ? false channel = grunt.option('channel') releasableBranches = ['stable', 'beta'] @@ -179,7 +180,7 @@ module.exports = (grunt) -> pkg: grunt.file.readJSON('package.json') atom: { - appName, channel, metadata, disableAutoUpdate, + appName, channel, metadata, disableAutoUpdate, disableShortcut, appFileName, apmFileName, appDir, buildDir, contentsDir, installDir, shellAppDir, symbolsDir, } diff --git a/build/tasks/install-task.coffee b/build/tasks/install-task.coffee index 54fd06022..ee38b1582 100644 --- a/build/tasks/install-task.coffee +++ b/build/tasks/install-task.coffee @@ -21,8 +21,9 @@ module.exports = (grunt) -> if runas('cmd', ['/c', copyFolder, shellAppDir, installDir], admin: true) isnt 0 grunt.log.error("Failed to copy #{shellAppDir} to #{installDir}") - createShortcut = path.resolve 'script', 'create-shortcut.cmd' - runas('cmd', ['/c', createShortcut, path.join(installDir, 'atom.exe'), appName]) + unless grunt.config.get('atom.disableShortcut') + createShortcut = path.resolve 'script', 'create-shortcut.cmd' + runas('cmd', ['/c', createShortcut, path.join(installDir, 'atom.exe'), appName]) else if process.platform is 'darwin' rm installDir mkdir path.dirname(installDir) From b4de9c6e871a0b52fa1053ff5ceca88e51e61507 Mon Sep 17 00:00:00 2001 From: Wliu Date: Tue, 17 Nov 2015 23:00:58 -0500 Subject: [PATCH 03/89] :memo: Document --no-shortcut --- docs/build-instructions/windows.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index debdd6570..fa7c32148 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -34,6 +34,7 @@ These instructions will assume the use of Git Shell. * `--install-dir` - Creates the final built application in this directory. * `--build-dir` - Build the application in this directory. * `--verbose` - Verbose mode. A lot more information output. + * `--no-shortcut` - Don't create a desktop shortcut. ## Why do I have to use GitHub Desktop? From ade1ef7a4cd275edd81e4ae3a58948891a7e16ef Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 18 Nov 2015 13:59:17 -0800 Subject: [PATCH 04/89] Load deserializers from files specified in package.json --- .../packages/package-with-deserializers/package.json | 7 +++++++ .../package-with-deserializers/the-deserializer.js | 6 ++++++ spec/package-manager-spec.coffee | 10 ++++++++++ src/package.coffee | 7 +++++++ 4 files changed, 30 insertions(+) create mode 100644 spec/fixtures/packages/package-with-deserializers/package.json create mode 100644 spec/fixtures/packages/package-with-deserializers/the-deserializer.js diff --git a/spec/fixtures/packages/package-with-deserializers/package.json b/spec/fixtures/packages/package-with-deserializers/package.json new file mode 100644 index 000000000..867457e0a --- /dev/null +++ b/spec/fixtures/packages/package-with-deserializers/package.json @@ -0,0 +1,7 @@ +{ + "name": "package-with-deserializers", + "version": "1.0.0", + "atom-deserializers": { + "TheDeserializerName": "./the-deserializer.js" + } +} diff --git a/spec/fixtures/packages/package-with-deserializers/the-deserializer.js b/spec/fixtures/packages/package-with-deserializers/the-deserializer.js new file mode 100644 index 000000000..d70e62bfd --- /dev/null +++ b/spec/fixtures/packages/package-with-deserializers/the-deserializer.js @@ -0,0 +1,6 @@ +module.exports = function (state) { + return { + wasDeserializedBy: 'TheDeserializer', + state: state + } +} diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 4b5f3c26d..59e076834 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -79,6 +79,16 @@ describe "PackageManager", -> expect(loadedPackage.name).toBe "package-with-main" + it "registers any deserializers specified in the package's package.json", -> + atom.packages.loadPackage("package-with-deserializers") + + state = {deserializer: 'TheDeserializerName', a: 'b'} + + expect(atom.deserializers.deserialize(state)).toEqual { + wasDeserializedBy: 'TheDeserializer' + state: state + } + describe "::unloadPackage(name)", -> describe "when the package is active", -> it "throws an error", -> diff --git a/src/package.coffee b/src/package.coffee index 4cd6a18fd..b40cabac3 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -84,6 +84,7 @@ class Package @loadKeymaps() @loadMenus() @loadStylesheets() + @loadDeserializers() @settingsPromise = @loadSettings() @requireMainModule() unless @mainModule? or @activationShouldBeDeferred() catch error @@ -253,6 +254,12 @@ class Package @stylesheets = @getStylesheetPaths().map (stylesheetPath) => [stylesheetPath, @themeManager.loadStylesheet(stylesheetPath, true)] + loadDeserializers: -> + for name, implementationPath of @metadata['atom-deserializers'] + deserialize = require(path.join(@path, implementationPath)) + atom.deserializers.add({name, deserialize}) + return + getStylesheetsPath: -> path.join(@path, 'styles') From 46272cd1927aac453a69397ffa6675c506ba3ac8 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 18 Nov 2015 14:31:16 -0800 Subject: [PATCH 05/89] Load deserializers lazily --- .../{the-deserializer.js => deserializer-1.js} | 2 +- .../package-with-deserializers/deserializer-2.js | 6 ++++++ .../package-with-deserializers/package.json | 3 ++- spec/package-manager-spec.coffee | 13 +++++++++---- src/package.coffee | 10 ++++++++-- 5 files changed, 26 insertions(+), 8 deletions(-) rename spec/fixtures/packages/package-with-deserializers/{the-deserializer.js => deserializer-1.js} (62%) create mode 100644 spec/fixtures/packages/package-with-deserializers/deserializer-2.js diff --git a/spec/fixtures/packages/package-with-deserializers/the-deserializer.js b/spec/fixtures/packages/package-with-deserializers/deserializer-1.js similarity index 62% rename from spec/fixtures/packages/package-with-deserializers/the-deserializer.js rename to spec/fixtures/packages/package-with-deserializers/deserializer-1.js index d70e62bfd..f4d7a1488 100644 --- a/spec/fixtures/packages/package-with-deserializers/the-deserializer.js +++ b/spec/fixtures/packages/package-with-deserializers/deserializer-1.js @@ -1,6 +1,6 @@ module.exports = function (state) { return { - wasDeserializedBy: 'TheDeserializer', + wasDeserializedBy: 'Deserializer1', state: state } } diff --git a/spec/fixtures/packages/package-with-deserializers/deserializer-2.js b/spec/fixtures/packages/package-with-deserializers/deserializer-2.js new file mode 100644 index 000000000..3099d2b15 --- /dev/null +++ b/spec/fixtures/packages/package-with-deserializers/deserializer-2.js @@ -0,0 +1,6 @@ +module.exports = function (state) { + return { + wasDeserializedBy: 'Deserializer2', + state: state + } +} diff --git a/spec/fixtures/packages/package-with-deserializers/package.json b/spec/fixtures/packages/package-with-deserializers/package.json index 867457e0a..377a5faf8 100644 --- a/spec/fixtures/packages/package-with-deserializers/package.json +++ b/spec/fixtures/packages/package-with-deserializers/package.json @@ -2,6 +2,7 @@ "name": "package-with-deserializers", "version": "1.0.0", "atom-deserializers": { - "TheDeserializerName": "./the-deserializer.js" + "Deserializer1": "./deserializer-1.js", + "Deserializer2": "./deserializer-2.js" } } diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 59e076834..843e9a932 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -82,11 +82,16 @@ describe "PackageManager", -> it "registers any deserializers specified in the package's package.json", -> atom.packages.loadPackage("package-with-deserializers") - state = {deserializer: 'TheDeserializerName', a: 'b'} + state1 = {deserializer: 'Deserializer1', a: 'b'} + expect(atom.deserializers.deserialize(state1)).toEqual { + wasDeserializedBy: 'Deserializer1' + state: state1 + } - expect(atom.deserializers.deserialize(state)).toEqual { - wasDeserializedBy: 'TheDeserializer' - state: state + state2 = {deserializer: 'Deserializer2', c: 'd'} + expect(atom.deserializers.deserialize(state2)).toEqual { + wasDeserializedBy: 'Deserializer2' + state: state2 } describe "::unloadPackage(name)", -> diff --git a/src/package.coffee b/src/package.coffee index b40cabac3..f933f93c3 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -256,8 +256,14 @@ class Package loadDeserializers: -> for name, implementationPath of @metadata['atom-deserializers'] - deserialize = require(path.join(@path, implementationPath)) - atom.deserializers.add({name, deserialize}) + do => + deserializePath = path.join(@path, implementationPath) + deserializeFunction = null + atom.deserializers.add + name: name, + deserialize: -> + deserializeFunction ?= require(deserializePath) + deserializeFunction.apply(this, arguments) return getStylesheetsPath: -> From a0a402c3f89be74fa90569f591a46708c41a6258 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 19 Nov 2015 14:12:03 -0800 Subject: [PATCH 06/89] Remove 'atom' prefix from deserializers package.json key --- spec/fixtures/packages/package-with-deserializers/package.json | 2 +- src/package.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/fixtures/packages/package-with-deserializers/package.json b/spec/fixtures/packages/package-with-deserializers/package.json index 377a5faf8..c55e1444a 100644 --- a/spec/fixtures/packages/package-with-deserializers/package.json +++ b/spec/fixtures/packages/package-with-deserializers/package.json @@ -1,7 +1,7 @@ { "name": "package-with-deserializers", "version": "1.0.0", - "atom-deserializers": { + "deserializers": { "Deserializer1": "./deserializer-1.js", "Deserializer2": "./deserializer-2.js" } diff --git a/src/package.coffee b/src/package.coffee index f933f93c3..a49c70868 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -255,7 +255,7 @@ class Package [stylesheetPath, @themeManager.loadStylesheet(stylesheetPath, true)] loadDeserializers: -> - for name, implementationPath of @metadata['atom-deserializers'] + for name, implementationPath of @metadata.deserializers do => deserializePath = path.join(@path, implementationPath) deserializeFunction = null From 91b651e86c52f48ed2911158369ea8b434ec987c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 19 Nov 2015 15:54:47 -0800 Subject: [PATCH 07/89] Make model constructor argument to addViewProvider optional --- spec/view-registry-spec.coffee | 15 ++++++++ src/view-registry.coffee | 66 ++++++++++++++++++++++------------ 2 files changed, 59 insertions(+), 22 deletions(-) diff --git a/spec/view-registry-spec.coffee b/spec/view-registry-spec.coffee index a2b4965a5..16672b25d 100644 --- a/spec/view-registry-spec.coffee +++ b/spec/view-registry-spec.coffee @@ -47,6 +47,21 @@ describe "ViewRegistry", -> expect(view2 instanceof TestView).toBe true expect(view2.model).toBe subclassModel + describe "when a view provider is registered generically, and works with the object", -> + it "constructs a view element and assigns the model on it", -> + model = {a: 'b'} + + registry.addViewProvider (model) -> + if model.a is 'b' + element = document.createElement('div') + element.className = 'test-element' + element + + view = registry.getView({a: 'b'}) + expect(view.className).toBe 'test-element' + + expect(-> registry.getView({a: 'c'})).toThrow() + describe "when no view provider is registered for the object's constructor", -> it "throws an exception", -> expect(-> registry.getView(new Object)).toThrow() diff --git a/src/view-registry.coffee b/src/view-registry.coffee index 0f07600ae..e754a010b 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -3,6 +3,8 @@ Grim = require 'grim' {Disposable} = require 'event-kit' _ = require 'underscore-plus' +AnyConstructor = Symbol('any-constructor') + # Essential: `ViewRegistry` handles the association between model and view # types in Atom. We call this association a View Provider. As in, for a given # model, this class can provide a view via {::getView}, as long as the @@ -76,16 +78,27 @@ class ViewRegistry # textEditorElement # ``` # - # * `modelConstructor` Constructor {Function} for your model. + # * `modelConstructor` (optional) Constructor {Function} for your model. If + # a constructor is given, the `createView` function will only be used + # for model objects inheriting from that constructor. Otherwise, it will + # will be called for any object. # * `createView` Factory {Function} that is passed an instance of your model - # and must return a subclass of `HTMLElement` or `undefined`. + # and must return a subclass of `HTMLElement` or `undefined`. If it returns + # `undefined`, then the registry will continue to search for other view + # providers. # # Returns a {Disposable} on which `.dispose()` can be called to remove the # added provider. addViewProvider: (modelConstructor, createView) -> if arguments.length is 1 - Grim.deprecate("atom.views.addViewProvider now takes 2 arguments: a model constructor and a createView function. See docs for details.") - provider = modelConstructor + switch typeof modelConstructor + when 'function' + provider = {createView: modelConstructor, modelConstructor: AnyConstructor} + when 'object' + Grim.deprecate("atom.views.addViewProvider now takes 2 arguments: a model constructor and a createView function. See docs for details.") + provider = modelConstructor + else + throw new TypeError("Arguments to addViewProvider must be functions") else provider = {modelConstructor, createView} @@ -153,25 +166,34 @@ class ViewRegistry createView: (object) -> if object instanceof HTMLElement - object - else if object?.element instanceof HTMLElement - object.element - else if object?.jquery - object[0] - else if provider = @findProvider(object) - element = provider.createView?(object, @atomEnvironment) - unless element? - element = new provider.viewConstructor - element.initialize?(object) ? element.setModel?(object) - element - else if viewConstructor = object?.getViewClass?() - view = new viewConstructor(object) - view[0] - else - throw new Error("Can't create a view for #{object.constructor.name} instance. Please register a view provider.") + return object - findProvider: (object) -> - find @providers, ({modelConstructor}) -> object instanceof modelConstructor + if object?.element instanceof HTMLElement + return object.element + + if object?.jquery + return object[0] + + for provider in @providers + if provider.modelConstructor is AnyConstructor + if element = provider.createView(object, @atomEnvironment) + return element + continue + + if object instanceof provider.modelConstructor + if element = provider.createView?(object, @atomEnvironment) + return element + + if viewConstructor = provider.viewConstructor + element = new viewConstructor + element.initialize?(object) ? element.setModel?(object) + return element + + if viewConstructor = object?.getViewClass?() + view = new viewConstructor(object) + return view[0] + + throw new Error("Can't create a view for #{object.constructor.name} instance. Please register a view provider.") updateDocument: (fn) -> @documentWriters.push(fn) From cb2b068d779a7e182c50e0f9ed47998e46f0f992 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 19 Nov 2015 16:58:08 -0800 Subject: [PATCH 08/89] Load view providers from files specified in package.json --- .../package-with-view-providers/package.json | 8 ++++++++ .../package-with-view-providers/view-provider-1.js | 9 +++++++++ .../package-with-view-providers/view-provider-2.js | 9 +++++++++ spec/package-manager-spec.coffee | 13 +++++++++++++ spec/package-spec.coffee | 1 + src/atom-environment.coffee | 2 +- src/package-manager.coffee | 6 ++++-- src/package.coffee | 8 +++++++- 8 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 spec/fixtures/packages/package-with-view-providers/package.json create mode 100644 spec/fixtures/packages/package-with-view-providers/view-provider-1.js create mode 100644 spec/fixtures/packages/package-with-view-providers/view-provider-2.js diff --git a/spec/fixtures/packages/package-with-view-providers/package.json b/spec/fixtures/packages/package-with-view-providers/package.json new file mode 100644 index 000000000..7f7405c32 --- /dev/null +++ b/spec/fixtures/packages/package-with-view-providers/package.json @@ -0,0 +1,8 @@ +{ + "name": "package-with-view-providers", + "version": "1.0.0", + "viewProviders": [ + "./view-provider-1", + "./view-provider-2" + ] +} diff --git a/spec/fixtures/packages/package-with-view-providers/view-provider-1.js b/spec/fixtures/packages/package-with-view-providers/view-provider-1.js new file mode 100644 index 000000000..e4f0dcc0b --- /dev/null +++ b/spec/fixtures/packages/package-with-view-providers/view-provider-1.js @@ -0,0 +1,9 @@ +'use strict' + +module.exports = function (model) { + if (model.worksWithViewProvider1) { + let element = document.createElement('div') + element.dataset['createdBy'] = 'view-provider-1' + return element + } +} diff --git a/spec/fixtures/packages/package-with-view-providers/view-provider-2.js b/spec/fixtures/packages/package-with-view-providers/view-provider-2.js new file mode 100644 index 000000000..a3b58a3aa --- /dev/null +++ b/spec/fixtures/packages/package-with-view-providers/view-provider-2.js @@ -0,0 +1,9 @@ +'use strict' + +module.exports = function (model) { + if (model.worksWithViewProvider2) { + let element = document.createElement('div') + element.dataset['createdBy'] = 'view-provider-2' + return element + } +} diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 843e9a932..169e09b76 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -94,6 +94,19 @@ describe "PackageManager", -> state: state2 } + it "registers any view providers specified in the package's package.json", -> + atom.packages.loadPackage("package-with-view-providers") + + model1 = {worksWithViewProvider1: true} + element1 = atom.views.getView(model1) + expect(element1 instanceof HTMLDivElement).toBe true + expect(element1.dataset.createdBy).toBe 'view-provider-1' + + model2 = {worksWithViewProvider2: true} + element2 = atom.views.getView(model2) + expect(element2 instanceof HTMLDivElement).toBe true + expect(element2.dataset.createdBy).toBe 'view-provider-2' + describe "::unloadPackage(name)", -> describe "when the package is active", -> it "throws an error", -> diff --git a/spec/package-spec.coffee b/spec/package-spec.coffee index 63a80a7db..f49d2ed7c 100644 --- a/spec/package-spec.coffee +++ b/spec/package-spec.coffee @@ -10,6 +10,7 @@ describe "Package", -> keymapManager: atom.keymaps, commandRegistry: atom.command, grammarRegistry: atom.grammars, themeManager: atom.themes, menuManager: atom.menu, contextMenuManager: atom.contextMenu, + deserializerManager: atom.deserializers, viewRegistry: atom.views, devMode: false ) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index ac76daf04..c56bcb493 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -151,7 +151,7 @@ class AtomEnvironment extends Model @packages = new PackageManager({ devMode, configDirPath, resourcePath, safeMode, @config, styleManager: @styles, commandRegistry: @commands, keymapManager: @keymaps, notificationManager: @notifications, - grammarRegistry: @grammars + grammarRegistry: @grammars, deserializerManager: @deserializers, viewRegistry: @views }) @themes = new ThemeManager({ diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 789b2eae5..5b0264212 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -31,7 +31,8 @@ class PackageManager constructor: (params) -> { configDirPath, @devMode, safeMode, @resourcePath, @config, @styleManager, - @notificationManager, @keymapManager, @commandRegistry, @grammarRegistry + @notificationManager, @keymapManager, @commandRegistry, @grammarRegistry, + @deserializerManager, @viewRegistry } = params @emitter = new Emitter @@ -375,7 +376,8 @@ class PackageManager options = { path: packagePath, metadata, packageManager: this, @config, @styleManager, @commandRegistry, @keymapManager, @devMode, @notificationManager, - @grammarRegistry, @themeManager, @menuManager, @contextMenuManager + @grammarRegistry, @themeManager, @menuManager, @contextMenuManager, + @deserializerManager, @viewRegistry } if metadata.theme pack = new ThemePackage(options) diff --git a/src/package.coffee b/src/package.coffee index a49c70868..1d98c8161 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -33,7 +33,7 @@ class Package { @path, @metadata, @packageManager, @config, @styleManager, @commandRegistry, @keymapManager, @devMode, @notificationManager, @grammarRegistry, @themeManager, - @menuManager, @contextMenuManager + @menuManager, @contextMenuManager, @deserializerManager, @viewRegistry } = params @emitter = new Emitter @@ -85,6 +85,7 @@ class Package @loadMenus() @loadStylesheets() @loadDeserializers() + @loadViewProviders() @settingsPromise = @loadSettings() @requireMainModule() unless @mainModule? or @activationShouldBeDeferred() catch error @@ -266,6 +267,11 @@ class Package deserializeFunction.apply(this, arguments) return + loadViewProviders: -> + for implementationPath in @metadata.viewProviders + @viewRegistry.addViewProvider(require(path.join(@path, implementationPath))) + return + getStylesheetsPath: -> path.join(@path, 'styles') From 4e5912c5453cff723aa93b847569d9d2878d9204 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 13:54:01 -0800 Subject: [PATCH 09/89] Upload to S3 as well. --- build/tasks/publish-build-task.coffee | 34 ++++++++++++++++++++++++--- package.json | 1 + 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index fc96121ae..c8da8a895 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -6,6 +6,7 @@ async = require 'async' fs = require 'fs-plus' GitHub = require 'github-releases' request = require 'request' +AWS = require 'aws-sdk' grunt = null @@ -210,7 +211,7 @@ deleteExistingAssets = (release, assetNames, callback) -> async.parallel(tasks, callback) uploadAssets = (release, buildDir, assets, callback) -> - upload = (release, assetName, assetPath, callback) -> + uploadToReleases = (release, assetName, assetPath, callback) -> options = uri: release.upload_url.replace(/\{.*$/, "?name=#{assetName}") method: 'POST' @@ -221,15 +222,42 @@ uploadAssets = (release, buildDir, assets, callback) -> assetRequest = request options, (error, response, body='') -> if error? or response.statusCode >= 400 - logError("Upload release asset #{assetName} failed", error, body) + logError("Upload release asset #{assetName} to Releases failed", error, body) callback(error ? new Error(response.statusCode)) else callback(null, release) fs.createReadStream(assetPath).pipe(assetRequest) + uploadToS3 = (release, assetName, assetPath, callback) -> + s3Key = process.env.BUILD_ATOM_RELEASES_S3_KEY + s3Secret = process.env.BUILD_ATOM_RELEASES_S3_SECRET + s3Bucket = process.env.BUILD_ATOM_RELEASES_S3_BUCKET + + unless s3Key && s3Secret && s3Bucket + callback(new Error('BUILD_ATOM_RELEASES_S3_KEY, BUILD_ATOM_RELEASES_S3_SECRET, and BUILD_ATOM_RELEASES_S3_BUCKET environment variables must be set.')) + return + + s3Info = + accessKeyId: s3Key + secretAccessKey: s3Secret + s3 = new AWS.S3 s3Info + + uploadParams = + Bucket: s3Bucket + ACL: 'public-read' + Key: "releases/#{assetName}" + Body: fs.createReadStream(assetPath) + s3.upload uploadParams, (error, data) -> + if error? + console.log("Upload release asset #{assetName} to S3 failed", error) + callback(error) + else + callback(null, release) + tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - tasks.push(upload.bind(this, release, assetName, assetPath)) + tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) diff --git a/package.json b/package.json index 9c9afc546..c11b3345e 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "dependencies": { "async": "0.2.6", "atom-keymap": "^6.1.1", + "aws-sdk": "^2.2.18", "babel-core": "^5.8.21", "bootstrap": "^3.3.4", "cached-run-in-this-context": "0.4.0", From ad7a67d8e4a07987a4602a0f01d77035cbb6c5c3 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 14:05:05 -0800 Subject: [PATCH 10/89] Re-export the variables for the Linux builds. --- script/cibuild-atom-linux | 3 +++ script/cibuild-atom-rpm | 3 +++ 2 files changed, 6 insertions(+) diff --git a/script/cibuild-atom-linux b/script/cibuild-atom-linux index c4e957189..2c3395608 100755 --- a/script/cibuild-atom-linux +++ b/script/cibuild-atom-linux @@ -3,6 +3,9 @@ set -e export ATOM_ACCESS_TOKEN=$BUILD_ATOM_LINUX_ACCESS_TOKEN +export BUILD_ATOM_RELEASES_S3_KEY=$BUILD_ATOM_LINUX_RELEASES_S3_KEY +export BUILD_ATOM_RELEASES_S3_SECRET=$BUILD_ATOM_LINUX_RELEASES_S3_SECRET +export BUILD_ATOM_RELEASES_S3_BUCKET=$BUILD_ATOM_LINUX_RELEASES_S3_BUCKET if [ -d /usr/local/share/nodenv ]; then export NODENV_ROOT=/usr/local/share/nodenv diff --git a/script/cibuild-atom-rpm b/script/cibuild-atom-rpm index a861a068b..2faa89347 100755 --- a/script/cibuild-atom-rpm +++ b/script/cibuild-atom-rpm @@ -8,5 +8,8 @@ docker run \ --env JANKY_SHA1="$JANKY_SHA1" \ --env JANKY_BRANCH="$JANKY_BRANCH" \ --env ATOM_ACCESS_TOKEN="$BUILD_ATOM_RPM_ACCESS_TOKEN" \ + --env BUILD_ATOM_RELEASES_S3_KEY="$BUILD_ATOM_RPM_RELEASES_S3_KEY" \ + --env BUILD_ATOM_RELEASES_S3_SECRET="$BUILD_ATOM_RPM_RELEASES_S3_SECRET" \ + --env BUILD_ATOM_RELEASES_S3_BUCKET="$BUILD_ATOM_RPM_RELEASES_S3_BUCKET" \ atom-rpm /atom/script/rpmbuild docker rmi atom-rpm From 67b713ffb4013f5d60355be30ff10f91d359e951 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 14:08:56 -0800 Subject: [PATCH 11/89] Re-export the variables for Windows too. --- script/cibuild.cmd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/cibuild.cmd b/script/cibuild.cmd index 79197d1b1..a596b7eba 100644 --- a/script/cibuild.cmd +++ b/script/cibuild.cmd @@ -1,3 +1,7 @@ +SET BUILD_ATOM_RELEASES_S3_KEY=%BUILD_ATOM_WIN_RELEASES_S3_KEY% +SET BUILD_ATOM_RELEASES_S3_SECRET=%BUILD_ATOM_WIN_RELEASES_S3_SECRET% +SET BUILD_ATOM_RELEASES_S3_BUCKET=%BUILD_ATOM_WIN_RELEASES_S3_BUCKET% + @IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\cibuild" %* ) ELSE ( From 220b0e67e63b43145f42b1620591469503ae8341 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 14:58:19 -0800 Subject: [PATCH 12/89] Hacks on hacks on hacks to test on test on test --- build/tasks/publish-build-task.coffee | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index c8da8a895..910254360 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - else - return + # else + # return doneCallback = @async() startTime = Date.now() @@ -55,12 +55,16 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - getAtomDraftRelease isPrerelease, channel, (error, release) -> - return done(error) if error? - assetNames = (asset.assetName for asset in assets) - deleteExistingAssets release, assetNames, (error) -> - return done(error) if error? - uploadAssets(release, buildDir, assets, done) + uploadAssets(null, buildDir, assets, done) + + # zipAssets buildDir, assets, (error) -> + # return done(error) if error? + # getAtomDraftRelease isPrerelease, channel, (error, release) -> + # return done(error) if error? + # assetNames = (asset.assetName for asset in assets) + # deleteExistingAssets release, assetNames, (error) -> + # return done(error) if error? + # uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -258,6 +262,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) From 785da0aa6c5536754fe90732bac9575aba3e9ea1 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 15:33:15 -0800 Subject: [PATCH 13/89] Linty --- build/tasks/publish-build-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index 910254360..0a1042766 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -238,7 +238,7 @@ uploadAssets = (release, buildDir, assets, callback) -> s3Secret = process.env.BUILD_ATOM_RELEASES_S3_SECRET s3Bucket = process.env.BUILD_ATOM_RELEASES_S3_BUCKET - unless s3Key && s3Secret && s3Bucket + unless s3Key and s3Secret and s3Bucket callback(new Error('BUILD_ATOM_RELEASES_S3_KEY, BUILD_ATOM_RELEASES_S3_SECRET, and BUILD_ATOM_RELEASES_S3_BUCKET environment variables must be set.')) return From 00120ef4823e77d07b2bb65c64bdf3669f4d7566 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 16:05:22 -0800 Subject: [PATCH 14/89] Namespace by tag name. --- build/tasks/publish-build-task.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index 0a1042766..b0011f921 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -247,10 +247,11 @@ uploadAssets = (release, buildDir, assets, callback) -> secretAccessKey: s3Secret s3 = new AWS.S3 s3Info + key = "releases/#{release.tag_name}/#{assetName}" uploadParams = Bucket: s3Bucket ACL: 'public-read' - Key: "releases/#{assetName}" + Key: key Body: fs.createReadStream(assetPath) s3.upload uploadParams, (error, data) -> if error? From c08e408a718785c1f09dd8ec74ad5dec72844969 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 16:09:55 -0800 Subject: [PATCH 15/89] Dummy out the tag name for now. --- build/tasks/publish-build-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index b0011f921..58e8df9a1 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -55,7 +55,7 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - uploadAssets(null, buildDir, assets, done) + uploadAssets({tag_name: '1.1'}, buildDir, assets, done) # zipAssets buildDir, assets, (error) -> # return done(error) if error? From 35d9c3dfffa67a3bc3206e533f3b6ff8f35a6baa Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 16:33:18 -0800 Subject: [PATCH 16/89] REMOVE ME hacks on hacks on hacks --- build/tasks/set-version-task.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 28abb6493..99c147c53 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta'] + releasableBranches = ['stable', 'beta', 'upload-to-s3'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = if channel in releasableBranches then false else true + shouldUseCommitHash = false # if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository From 9cd5a0c31c2421aa5e045a6fa882b2d58d7e6e30 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 16:42:37 -0800 Subject: [PATCH 17/89] aws-sdk is a build dependency. --- build/package.json | 1 + package.json | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/build/package.json b/build/package.json index de9053006..40e5b309a 100644 --- a/build/package.json +++ b/build/package.json @@ -8,6 +8,7 @@ "dependencies": { "asar": "^0.8.0", "async": "~0.2.9", + "aws-sdk": "^2.2.18", "donna": "^1.0.13", "formidable": "~1.0.14", "fs-plus": "2.x", diff --git a/package.json b/package.json index c11b3345e..9c9afc546 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "dependencies": { "async": "0.2.6", "atom-keymap": "^6.1.1", - "aws-sdk": "^2.2.18", "babel-core": "^5.8.21", "bootstrap": "^3.3.4", "cached-run-in-this-context": "0.4.0", From f77699694e37b80c7196f4f8d5f8bd3dcdbaffa7 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 20 Nov 2015 17:15:10 -0800 Subject: [PATCH 18/89] Revert ":arrow_up: text-buffer :racehorse:" This reverts commit fcab30e822e25d2c1d6e0d85c3e9bcecd224b9a5. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbd79970d..d141f8c71 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "service-hub": "^0.7.0", "source-map-support": "^0.3.2", "temp": "0.8.1", - "text-buffer": "^8.0.5", + "text-buffer": "^8.0.4", "typescript-simple": "1.0.0", "underscore-plus": "^1.6.6", "yargs": "^3.23.0" From 71bdeb5010bd1d40dd8fb1243fb2729353a429ec Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 17:32:09 -0800 Subject: [PATCH 19/89] Try copying the Windows vars in cibuild. --- script/cibuild | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/cibuild b/script/cibuild index b3f0b3f83..c4fa533d0 100755 --- a/script/cibuild +++ b/script/cibuild @@ -41,6 +41,10 @@ function setEnvironmentVariables() { process.env.CXX = 'clang++'; process.env.npm_config_clang = '1'; } + + process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY + process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_RELEASES_S3_SECRET + process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_RELEASES_S3_BUCKET } function removeNodeModules() { From 481cacb5d31d28251da8ee276dba6b203753e869 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 17:32:15 -0800 Subject: [PATCH 20/89] Let's see if we get here. --- script/cibuild.cmd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/cibuild.cmd b/script/cibuild.cmd index a596b7eba..9065be470 100644 --- a/script/cibuild.cmd +++ b/script/cibuild.cmd @@ -2,6 +2,8 @@ SET BUILD_ATOM_RELEASES_S3_KEY=%BUILD_ATOM_WIN_RELEASES_S3_KEY% SET BUILD_ATOM_RELEASES_S3_SECRET=%BUILD_ATOM_WIN_RELEASES_S3_SECRET% SET BUILD_ATOM_RELEASES_S3_BUCKET=%BUILD_ATOM_WIN_RELEASES_S3_BUCKET% +ECHO Here I go Windowsing again + @IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\cibuild" %* ) ELSE ( From fbf3265f5af7cbcc5d68f9b16b058e0ddf2292a7 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 17:59:59 -0800 Subject: [PATCH 21/89] Revert "Let's see if we get here." This reverts commit 481cacb5d31d28251da8ee276dba6b203753e869. --- script/cibuild.cmd | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/cibuild.cmd b/script/cibuild.cmd index 9065be470..a596b7eba 100644 --- a/script/cibuild.cmd +++ b/script/cibuild.cmd @@ -2,8 +2,6 @@ SET BUILD_ATOM_RELEASES_S3_KEY=%BUILD_ATOM_WIN_RELEASES_S3_KEY% SET BUILD_ATOM_RELEASES_S3_SECRET=%BUILD_ATOM_WIN_RELEASES_S3_SECRET% SET BUILD_ATOM_RELEASES_S3_BUCKET=%BUILD_ATOM_WIN_RELEASES_S3_BUCKET% -ECHO Here I go Windowsing again - @IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\cibuild" %* ) ELSE ( From 0f9cdbec775ccf69834464cedcc53289b0de4a69 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 18:03:14 -0800 Subject: [PATCH 22/89] It helps if you get the names right. --- script/cibuild | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/script/cibuild b/script/cibuild index c4fa533d0..e562b0ea7 100755 --- a/script/cibuild +++ b/script/cibuild @@ -40,11 +40,10 @@ function setEnvironmentVariables() { process.env.CC = 'clang'; process.env.CXX = 'clang++'; process.env.npm_config_clang = '1'; + process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY + process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_WIN_RELEASES_S3_SECRET + process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_WIN_RELEASES_S3_BUCKET } - - process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY - process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_RELEASES_S3_SECRET - process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_RELEASES_S3_BUCKET } function removeNodeModules() { From 10628351ea365b42f5748afb031aa3bcefae6c8a Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 20 Nov 2015 18:03:21 -0800 Subject: [PATCH 23/89] Only do it on Windows. --- script/cibuild | 1 + 1 file changed, 1 insertion(+) diff --git a/script/cibuild b/script/cibuild index e562b0ea7..860e0a938 100755 --- a/script/cibuild +++ b/script/cibuild @@ -40,6 +40,7 @@ function setEnvironmentVariables() { process.env.CC = 'clang'; process.env.CXX = 'clang++'; process.env.npm_config_clang = '1'; + } else if (process.platform === 'win32') { process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_WIN_RELEASES_S3_SECRET process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_WIN_RELEASES_S3_BUCKET From b11d0c25851d9d784abccd7e9d0c96c2fa25eee3 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 16 Nov 2015 11:59:47 +0100 Subject: [PATCH 24/89] Use em-dash in window title and exclude app name on OS X --- spec/workspace-spec.coffee | 14 +++++++------- src/workspace.coffee | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e150761af..74e98e1e4 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -76,7 +76,7 @@ describe "Workspace", -> expect(editor4.getCursorScreenPosition()).toEqual [2, 4] expect(atom.workspace.getActiveTextEditor().getPath()).toBe editor3.getPath() - expect(document.title).toBe "#{path.basename(editor3.getLongTitle())} - #{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{path.basename(editor3.getLongTitle())}\ \u2014\ #{atom.project.getPaths()[0]}/// describe "where there are no open panes or editors", -> it "constructs the view with no open editors", -> @@ -732,7 +732,7 @@ describe "Workspace", -> describe "when the project has no path", -> it "sets the title to 'untitled'", -> atom.project.setPaths([]) - expect(document.title).toBe 'untitled - Atom' + expect(document.title).toMatch ///^untitled/// describe "when the project has a path", -> beforeEach -> @@ -742,25 +742,25 @@ describe "Workspace", -> describe "when there is an active pane item", -> it "sets the title to the pane item's title plus the project path", -> item = atom.workspace.getActivePaneItem() - expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{item.getTitle()}\ \u2014\ #{atom.project.getPaths()[0]}/// describe "when the title of the active pane item changes", -> it "updates the window title based on the item's new title", -> editor = atom.workspace.getActivePaneItem() editor.buffer.setPath(path.join(temp.dir, 'hi')) - expect(document.title).toBe "#{editor.getTitle()} - #{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{editor.getTitle()}\ \u2014\ #{atom.project.getPaths()[0]}/// describe "when the active pane's item changes", -> it "updates the title to the new item's title plus the project path", -> atom.workspace.getActivePane().activateNextItem() item = atom.workspace.getActivePaneItem() - expect(document.title).toBe "#{item.getTitle()} - #{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{item.getTitle()}\ \u2014\ #{atom.project.getPaths()[0]}/// describe "when the last pane item is removed", -> it "updates the title to contain the project's path", -> atom.workspace.getActivePane().destroy() expect(atom.workspace.getActivePaneItem()).toBeUndefined() - expect(document.title).toBe "#{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{atom.project.getPaths()[0]}/// describe "when an inactive pane's item changes", -> it "does not update the title", -> @@ -784,7 +784,7 @@ describe "Workspace", -> }) workspace2.deserialize(atom.workspace.serialize(), atom.deserializers) item = workspace2.getActivePaneItem() - expect(document.title).toBe "#{item.getLongTitle()} - #{atom.project.getPaths()[0]} - Atom" + expect(document.title).toMatch ///^#{item.getLongTitle()}\ \u2014\ #{atom.project.getPaths()[0]}/// workspace2.destroy() describe "document edited status", -> diff --git a/src/workspace.coffee b/src/workspace.coffee index 04feef61e..f64f58ee0 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -161,15 +161,22 @@ class Workspace extends Model itemTitle ?= "untitled" projectPath ?= projectPaths[0] + titleParts = [] if item? and projectPath? - document.title = "#{itemTitle} - #{projectPath} - #{appName}" - @applicationDelegate.setRepresentedFilename(itemPath ? projectPath) + titleParts.push itemTitle, projectPath + representedPath = itemPath ? projectPath else if projectPath? - document.title = "#{projectPath} - #{appName}" - @applicationDelegate.setRepresentedFilename(projectPath) + titleParts.push projectPath + representedPath = projectPath else - document.title = "#{itemTitle} - #{appName}" - @applicationDelegate.setRepresentedFilename("") + titleParts.push itemTitle + representedPath = "" + + unless process.platform is 'darwin' + titleParts.push appName + + document.title = titleParts.join(" \u2014 ") + @applicationDelegate.setRepresentedFilename(representedPath) # On OS X, fades the application window's proxy icon when the current file # has been modified. From 6d20ffc06e31dc88211d49587587cdac7864bc12 Mon Sep 17 00:00:00 2001 From: joshaber Date: Sat, 21 Nov 2015 05:34:39 -0800 Subject: [PATCH 25/89] What you got. --- script/cibuild | 2 ++ 1 file changed, 2 insertions(+) diff --git a/script/cibuild b/script/cibuild index 860e0a938..ae3316cad 100755 --- a/script/cibuild +++ b/script/cibuild @@ -41,6 +41,8 @@ function setEnvironmentVariables() { process.env.CXX = 'clang++'; process.env.npm_config_clang = '1'; } else if (process.platform === 'win32') { + console.log("env:") + console.log(process.env) process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_WIN_RELEASES_S3_SECRET process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_WIN_RELEASES_S3_BUCKET From bb69ffe015df00d1e0bf01ebaafc518ce8f373fd Mon Sep 17 00:00:00 2001 From: joshaber Date: Sat, 21 Nov 2015 05:47:18 -0800 Subject: [PATCH 26/89] Revert "What you got." This reverts commit 6d20ffc06e31dc88211d49587587cdac7864bc12. --- script/cibuild | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/cibuild b/script/cibuild index ae3316cad..860e0a938 100755 --- a/script/cibuild +++ b/script/cibuild @@ -41,8 +41,6 @@ function setEnvironmentVariables() { process.env.CXX = 'clang++'; process.env.npm_config_clang = '1'; } else if (process.platform === 'win32') { - console.log("env:") - console.log(process.env) process.env.BUILD_ATOM_RELEASES_S3_KEY = process.env.BUILD_ATOM_WIN_RELEASES_S3_KEY process.env.BUILD_ATOM_RELEASES_S3_SECRET = process.env.BUILD_ATOM_WIN_RELEASES_S3_SECRET process.env.BUILD_ATOM_RELEASES_S3_BUCKET = process.env.BUILD_ATOM_WIN_RELEASES_S3_BUCKET From 5648cd633e7f5b511cdc521d19abf34d928961bd Mon Sep 17 00:00:00 2001 From: joshaber Date: Sat, 21 Nov 2015 05:53:57 -0800 Subject: [PATCH 27/89] This is just used for Appveyor, which doesn't need these. --- script/cibuild.cmd | 4 ---- 1 file changed, 4 deletions(-) diff --git a/script/cibuild.cmd b/script/cibuild.cmd index a596b7eba..79197d1b1 100644 --- a/script/cibuild.cmd +++ b/script/cibuild.cmd @@ -1,7 +1,3 @@ -SET BUILD_ATOM_RELEASES_S3_KEY=%BUILD_ATOM_WIN_RELEASES_S3_KEY% -SET BUILD_ATOM_RELEASES_S3_SECRET=%BUILD_ATOM_WIN_RELEASES_S3_SECRET% -SET BUILD_ATOM_RELEASES_S3_BUCKET=%BUILD_ATOM_WIN_RELEASES_S3_BUCKET% - @IF EXIST "%~dp0\node.exe" ( "%~dp0\node.exe" "%~dp0\cibuild" %* ) ELSE ( From cc84246e4ddd0ba9547d1e7955be1f8ef176bb6f Mon Sep 17 00:00:00 2001 From: joshaber Date: Sat, 21 Nov 2015 06:08:13 -0800 Subject: [PATCH 28/89] Revert "REMOVE ME hacks on hacks on hacks" This reverts commit 35d9c3dfffa67a3bc3206e533f3b6ff8f35a6baa. --- build/tasks/set-version-task.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 99c147c53..28abb6493 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta', 'upload-to-s3'] + releasableBranches = ['stable', 'beta'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = false # if channel in releasableBranches then false else true + shouldUseCommitHash = if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository From 8e79796f3cbbf92aa1615cee14c158a36b924272 Mon Sep 17 00:00:00 2001 From: joshaber Date: Sat, 21 Nov 2015 06:08:48 -0800 Subject: [PATCH 29/89] Revert "Hacks on hacks on hacks to test on test on test" This reverts commit 220b0e67e63b43145f42b1620591469503ae8341. --- build/tasks/publish-build-task.coffee | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index 58e8df9a1..d8dffd1ea 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - # else - # return + else + return doneCallback = @async() startTime = Date.now() @@ -55,16 +55,12 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - uploadAssets({tag_name: '1.1'}, buildDir, assets, done) - - # zipAssets buildDir, assets, (error) -> - # return done(error) if error? - # getAtomDraftRelease isPrerelease, channel, (error, release) -> - # return done(error) if error? - # assetNames = (asset.assetName for asset in assets) - # deleteExistingAssets release, assetNames, (error) -> - # return done(error) if error? - # uploadAssets(release, buildDir, assets, done) + getAtomDraftRelease isPrerelease, channel, (error, release) -> + return done(error) if error? + assetNames = (asset.assetName for asset in assets) + deleteExistingAssets release, assetNames, (error) -> + return done(error) if error? + uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -263,6 +259,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) From 2d29fd6e79262bd5b8c902f86456ef5a21f224ae Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 20 Nov 2015 13:28:05 -0800 Subject: [PATCH 30/89] Load config schemas from packages' package.json files --- .../package-with-json-config-schema/package.json | 13 +++++++++++++ spec/package-manager-spec.coffee | 15 +++++++++++++++ src/package.coffee | 13 ++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 spec/fixtures/packages/package-with-json-config-schema/package.json diff --git a/spec/fixtures/packages/package-with-json-config-schema/package.json b/spec/fixtures/packages/package-with-json-config-schema/package.json new file mode 100644 index 000000000..960d87fc1 --- /dev/null +++ b/spec/fixtures/packages/package-with-json-config-schema/package.json @@ -0,0 +1,13 @@ +{ + "name": "package-with-json-config-schema", + "configSchema": { + "a": { + "type": "number", + "default": 5 + }, + "b": { + "type": "string", + "default": "five" + } + } +} diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 169e09b76..656b4b691 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -194,6 +194,21 @@ describe "PackageManager", -> expect(atom.config.set('package-with-config-schema.numbers.one', '10')).toBe true expect(atom.config.get('package-with-config-schema.numbers.one')).toBe 10 + it "assigns the config schema when the package contains a schema in its package.json", -> + expect(atom.config.get('package-with-json-config-schema')).toBeUndefined() + + waitsForPromise -> + atom.packages.activatePackage('package-with-json-config-schema') + + runs -> + expect(atom.config.getSchema('package-with-json-config-schema')).toEqual { + type: 'object' + properties: { + a: {type: 'number', default: 5} + b: {type: 'string', default: 'five'} + } + } + describe "when the package metadata includes `activationCommands`", -> [mainModule, promise, workspaceCommandListener, registration] = [] diff --git a/src/package.coffee b/src/package.coffee index 1d98c8161..d1354340f 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -133,11 +133,14 @@ class Package activateConfig: -> return if @configActivated - @requireMainModule() unless @mainModule? - if @mainModule? - if @mainModule.config? and typeof @mainModule.config is 'object' - @config.setSchema @name, {type: 'object', properties: @mainModule.config} - @mainModule.activateConfig?() + if configSchema = @metadata.configSchema + @config.setSchema @name, {type: 'object', properties: configSchema} + else + @requireMainModule() unless @mainModule? + if @mainModule? + if @mainModule.config? and typeof @mainModule.config is 'object' + @config.setSchema @name, {type: 'object', properties: @mainModule.config} + @mainModule.activateConfig?() @configActivated = true activateStylesheets: -> From 5f1947ef1f15393fd25b929914de5fcb6f40c37f Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 20 Nov 2015 13:42:17 -0800 Subject: [PATCH 31/89] Guard for undefined package.json fields --- src/package.coffee | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index d1354340f..b2a87d1d8 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -259,21 +259,23 @@ class Package [stylesheetPath, @themeManager.loadStylesheet(stylesheetPath, true)] loadDeserializers: -> - for name, implementationPath of @metadata.deserializers - do => - deserializePath = path.join(@path, implementationPath) - deserializeFunction = null - atom.deserializers.add - name: name, - deserialize: -> - deserializeFunction ?= require(deserializePath) - deserializeFunction.apply(this, arguments) - return + if @metadata.deserializers? + for name, implementationPath of @metadata.deserializers + do => + deserializePath = path.join(@path, implementationPath) + deserializeFunction = null + atom.deserializers.add + name: name, + deserialize: -> + deserializeFunction ?= require(deserializePath) + deserializeFunction.apply(this, arguments) + return loadViewProviders: -> - for implementationPath in @metadata.viewProviders - @viewRegistry.addViewProvider(require(path.join(@path, implementationPath))) - return + if @metadata.viewProviders? + for implementationPath in @metadata.viewProviders + @viewRegistry.addViewProvider(require(path.join(@path, implementationPath))) + return getStylesheetsPath: -> path.join(@path, 'styles') From d6e5ea85642155cf28e224034a558254dd4922fe Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 23 Nov 2015 16:05:32 -0800 Subject: [PATCH 32/89] Defer requiring packages' main modules if they use new package.json fields --- .../package-with-deserializers/index.js | 3 ++ .../package-with-deserializers/package.json | 1 + .../package-with-view-providers/index.js | 3 ++ .../package-with-view-providers/package.json | 1 + spec/package-manager-spec.coffee | 36 ++++++++-------- src/package.coffee | 43 +++++++++++-------- 6 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 spec/fixtures/packages/package-with-deserializers/index.js create mode 100644 spec/fixtures/packages/package-with-view-providers/index.js diff --git a/spec/fixtures/packages/package-with-deserializers/index.js b/spec/fixtures/packages/package-with-deserializers/index.js new file mode 100644 index 000000000..19bba5ecb --- /dev/null +++ b/spec/fixtures/packages/package-with-deserializers/index.js @@ -0,0 +1,3 @@ +module.exports = { + activate: function() {} +} diff --git a/spec/fixtures/packages/package-with-deserializers/package.json b/spec/fixtures/packages/package-with-deserializers/package.json index c55e1444a..daa5776bf 100644 --- a/spec/fixtures/packages/package-with-deserializers/package.json +++ b/spec/fixtures/packages/package-with-deserializers/package.json @@ -1,6 +1,7 @@ { "name": "package-with-deserializers", "version": "1.0.0", + "main": "./index", "deserializers": { "Deserializer1": "./deserializer-1.js", "Deserializer2": "./deserializer-2.js" diff --git a/spec/fixtures/packages/package-with-view-providers/index.js b/spec/fixtures/packages/package-with-view-providers/index.js new file mode 100644 index 000000000..19bba5ecb --- /dev/null +++ b/spec/fixtures/packages/package-with-view-providers/index.js @@ -0,0 +1,3 @@ +module.exports = { + activate: function() {} +} diff --git a/spec/fixtures/packages/package-with-view-providers/package.json b/spec/fixtures/packages/package-with-view-providers/package.json index 7f7405c32..989473f95 100644 --- a/spec/fixtures/packages/package-with-view-providers/package.json +++ b/spec/fixtures/packages/package-with-view-providers/package.json @@ -1,5 +1,6 @@ { "name": "package-with-view-providers", + "main": "./index", "version": "1.0.0", "viewProviders": [ "./view-provider-1", diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 656b4b691..94a6c43c5 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -80,7 +80,7 @@ describe "PackageManager", -> expect(loadedPackage.name).toBe "package-with-main" it "registers any deserializers specified in the package's package.json", -> - atom.packages.loadPackage("package-with-deserializers") + pack = atom.packages.loadPackage("package-with-deserializers") state1 = {deserializer: 'Deserializer1', a: 'b'} expect(atom.deserializers.deserialize(state1)).toEqual { @@ -94,8 +94,10 @@ describe "PackageManager", -> state: state2 } + expect(pack.mainModule).toBeNull() + it "registers any view providers specified in the package's package.json", -> - atom.packages.loadPackage("package-with-view-providers") + pack = atom.packages.loadPackage("package-with-view-providers") model1 = {worksWithViewProvider1: true} element1 = atom.views.getView(model1) @@ -107,6 +109,21 @@ describe "PackageManager", -> expect(element2 instanceof HTMLDivElement).toBe true expect(element2.dataset.createdBy).toBe 'view-provider-2' + expect(pack.mainModule).toBeNull() + + it "registers the config schema in the package's metadata, if present", -> + pack = atom.packages.loadPackage("package-with-json-config-schema") + + expect(atom.config.getSchema('package-with-json-config-schema')).toEqual { + type: 'object' + properties: { + a: {type: 'number', default: 5} + b: {type: 'string', default: 'five'} + } + } + + expect(pack.mainModule).toBeNull() + describe "::unloadPackage(name)", -> describe "when the package is active", -> it "throws an error", -> @@ -194,21 +211,6 @@ describe "PackageManager", -> expect(atom.config.set('package-with-config-schema.numbers.one', '10')).toBe true expect(atom.config.get('package-with-config-schema.numbers.one')).toBe 10 - it "assigns the config schema when the package contains a schema in its package.json", -> - expect(atom.config.get('package-with-json-config-schema')).toBeUndefined() - - waitsForPromise -> - atom.packages.activatePackage('package-with-json-config-schema') - - runs -> - expect(atom.config.getSchema('package-with-json-config-schema')).toEqual { - type: 'object' - properties: { - a: {type: 'number', default: 5} - b: {type: 'string', default: 'five'} - } - } - describe "when the package metadata includes `activationCommands`", -> [mainModule, promise, workspaceCommandListener, registration] = [] diff --git a/src/package.coffee b/src/package.coffee index b2a87d1d8..b97424d04 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -86,12 +86,22 @@ class Package @loadStylesheets() @loadDeserializers() @loadViewProviders() + @registerConfigSchemaFromMetadata() @settingsPromise = @loadSettings() - @requireMainModule() unless @mainModule? or @activationShouldBeDeferred() + if @shouldRequireMainModuleOnLoad() and not @mainModule? + @requireMainModule() catch error @handleError("Failed to load the #{@name} package", error) this + shouldRequireMainModuleOnLoad: -> + not ( + @metadata.deserializers? or + @metadata.viewProviders? or + @metadata.configSchema? or + @activationShouldBeDeferred() + ) + reset: -> @stylesheets = [] @keymaps = [] @@ -119,9 +129,11 @@ class Package activateNow: -> try - @activateConfig() + @requireMainModule() unless @mainModule? + @registerConfigSchemaFromMainModule() @activateStylesheets() if @mainModule? and not @mainActivated + @mainModule.activateConfig?() @mainModule.activate?(@packageManager.getPackageState(@name) ? {}) @mainActivated = true @activateServices() @@ -130,18 +142,19 @@ class Package @resolveActivationPromise?() - activateConfig: -> - return if @configActivated - + registerConfigSchemaFromMetadata: -> if configSchema = @metadata.configSchema @config.setSchema @name, {type: 'object', properties: configSchema} - else - @requireMainModule() unless @mainModule? - if @mainModule? - if @mainModule.config? and typeof @mainModule.config is 'object' - @config.setSchema @name, {type: 'object', properties: @mainModule.config} - @mainModule.activateConfig?() - @configActivated = true + @configSchemaRegistered = true + + registerConfigSchemaFromMainModule: -> + return if @configSchemaRegistered + + if @mainModule? + if @mainModule.config? and typeof @mainModule.config is 'object' + @config.setSchema @name, {type: 'object', properties: @mainModule.config} + + @configSchemaRegistered = true activateStylesheets: -> return if @stylesheetsActivated @@ -368,20 +381,16 @@ class Package @resolveActivationPromise = null @activationCommandSubscriptions?.dispose() @deactivateResources() - @deactivateConfig() @deactivateKeymaps() if @mainActivated try @mainModule?.deactivate?() + @mainModule?.deactivateConfig?() @mainActivated = false catch e console.error "Error deactivating package '#{@name}'", e.stack @emitter.emit 'did-deactivate' - deactivateConfig: -> - @mainModule?.deactivateConfig?() - @configActivated = false - deactivateResources: -> grammar.deactivate() for grammar in @grammars settings.deactivate() for settings in @settings From 24938c0361366be8715a1a1886e336dfd20dade5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 23 Nov 2015 16:28:08 -0800 Subject: [PATCH 33/89] Defer loading view providers until activation or deserializer use Signed-off-by: Nathan Sobo --- .../deserializer.js | 3 + .../package-with-view-providers/package.json | 3 + spec/package-manager-spec.coffee | 59 +++++++++++++++---- src/package.coffee | 11 ++-- 4 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 spec/fixtures/packages/package-with-view-providers/deserializer.js diff --git a/spec/fixtures/packages/package-with-view-providers/deserializer.js b/spec/fixtures/packages/package-with-view-providers/deserializer.js new file mode 100644 index 000000000..334e7b2ab --- /dev/null +++ b/spec/fixtures/packages/package-with-view-providers/deserializer.js @@ -0,0 +1,3 @@ +module.exports = function (state) { + return {state: state} +} diff --git a/spec/fixtures/packages/package-with-view-providers/package.json b/spec/fixtures/packages/package-with-view-providers/package.json index 989473f95..f67477280 100644 --- a/spec/fixtures/packages/package-with-view-providers/package.json +++ b/spec/fixtures/packages/package-with-view-providers/package.json @@ -2,6 +2,9 @@ "name": "package-with-view-providers", "main": "./index", "version": "1.0.0", + "deserializers": { + "DeserializerFromPackageWithViewProviders": "./deserializer" + }, "viewProviders": [ "./view-provider-1", "./view-provider-2" diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 94a6c43c5..d82f37acb 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -96,20 +96,57 @@ describe "PackageManager", -> expect(pack.mainModule).toBeNull() - it "registers any view providers specified in the package's package.json", -> - pack = atom.packages.loadPackage("package-with-view-providers") - + describe "when there are view providers specified in the package's package.json", -> model1 = {worksWithViewProvider1: true} - element1 = atom.views.getView(model1) - expect(element1 instanceof HTMLDivElement).toBe true - expect(element1.dataset.createdBy).toBe 'view-provider-1' - model2 = {worksWithViewProvider2: true} - element2 = atom.views.getView(model2) - expect(element2 instanceof HTMLDivElement).toBe true - expect(element2.dataset.createdBy).toBe 'view-provider-2' - expect(pack.mainModule).toBeNull() + afterEach -> + atom.packages.deactivatePackage('package-with-view-providers') + atom.packages.unloadPackage('package-with-view-providers') + + it "does not load the view providers immediately", -> + pack = atom.packages.loadPackage("package-with-view-providers") + expect(pack.mainModule).toBeNull() + + expect(-> atom.views.getView(model1)).toThrow() + expect(-> atom.views.getView(model2)).toThrow() + + it "registers the view providers when the package is activated", -> + pack = atom.packages.loadPackage("package-with-view-providers") + + waitsForPromise -> + atom.packages.activatePackage("package-with-view-providers").then -> + element1 = atom.views.getView(model1) + expect(element1 instanceof HTMLDivElement).toBe true + expect(element1.dataset.createdBy).toBe 'view-provider-1' + + element2 = atom.views.getView(model2) + expect(element2 instanceof HTMLDivElement).toBe true + expect(element2.dataset.createdBy).toBe 'view-provider-2' + + it "registers the view providers when any of the package's deserializers are used", -> + pack = atom.packages.loadPackage("package-with-view-providers") + + spyOn(atom.views, 'addViewProvider').andCallThrough() + atom.deserializers.deserialize({ + deserializer: 'DeserializerFromPackageWithViewProviders', + a: 'b' + }) + expect(atom.views.addViewProvider.callCount).toBe 2 + + atom.deserializers.deserialize({ + deserializer: 'DeserializerFromPackageWithViewProviders', + a: 'b' + }) + expect(atom.views.addViewProvider.callCount).toBe 2 + + element1 = atom.views.getView(model1) + expect(element1 instanceof HTMLDivElement).toBe true + expect(element1.dataset.createdBy).toBe 'view-provider-1' + + element2 = atom.views.getView(model2) + expect(element2 instanceof HTMLDivElement).toBe true + expect(element2.dataset.createdBy).toBe 'view-provider-2' it "registers the config schema in the package's metadata, if present", -> pack = atom.packages.loadPackage("package-with-json-config-schema") diff --git a/src/package.coffee b/src/package.coffee index b97424d04..f437d327a 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -85,7 +85,6 @@ class Package @loadMenus() @loadStylesheets() @loadDeserializers() - @loadViewProviders() @registerConfigSchemaFromMetadata() @settingsPromise = @loadSettings() if @shouldRequireMainModuleOnLoad() and not @mainModule? @@ -131,6 +130,7 @@ class Package try @requireMainModule() unless @mainModule? @registerConfigSchemaFromMainModule() + @registerViewProviders() @activateStylesheets() if @mainModule? and not @mainActivated @mainModule.activateConfig?() @@ -279,16 +279,17 @@ class Package deserializeFunction = null atom.deserializers.add name: name, - deserialize: -> + deserialize: => + @registerViewProviders() deserializeFunction ?= require(deserializePath) deserializeFunction.apply(this, arguments) return - loadViewProviders: -> - if @metadata.viewProviders? + registerViewProviders: -> + if @metadata.viewProviders? and not @registeredViewProviders for implementationPath in @metadata.viewProviders @viewRegistry.addViewProvider(require(path.join(@path, implementationPath))) - return + @registeredViewProviders = true getStylesheetsPath: -> path.join(@path, 'styles') From 327cf6997bbff1a058d47baa3cdf8ceab90489e5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 23 Nov 2015 17:35:38 -0800 Subject: [PATCH 34/89] Remember which packages use atom APIs at main module load time Signed-off-by: Nathan Sobo --- .../package-with-eval-time-api-calls/index.js | 5 ++++ .../package.json | 5 ++++ .../packages/package-with-main/package.cson | 1 + spec/package-manager-spec.coffee | 24 +++++++++++++++++++ spec/package-spec.coffee | 11 +++------ spec/spec-helper.coffee | 6 +++++ src/deserializer-manager.coffee | 3 +++ src/package.coffee | 12 +++++++++- src/view-registry.coffee | 3 +++ 9 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 spec/fixtures/packages/package-with-eval-time-api-calls/index.js create mode 100644 spec/fixtures/packages/package-with-eval-time-api-calls/package.json diff --git a/spec/fixtures/packages/package-with-eval-time-api-calls/index.js b/spec/fixtures/packages/package-with-eval-time-api-calls/index.js new file mode 100644 index 000000000..e16db0743 --- /dev/null +++ b/spec/fixtures/packages/package-with-eval-time-api-calls/index.js @@ -0,0 +1,5 @@ +atom.deserializers.add('MyDeserializer', function (state) { + return {state: state, a: 'b'} +}) + +exports.activate = function () {} diff --git a/spec/fixtures/packages/package-with-eval-time-api-calls/package.json b/spec/fixtures/packages/package-with-eval-time-api-calls/package.json new file mode 100644 index 000000000..7a76abb5f --- /dev/null +++ b/spec/fixtures/packages/package-with-eval-time-api-calls/package.json @@ -0,0 +1,5 @@ +{ + "name": "package-with-eval-time-api-calls", + "version": "1.2.3", + "main": "./index" +} diff --git a/spec/fixtures/packages/package-with-main/package.cson b/spec/fixtures/packages/package-with-main/package.cson index e799f6ca8..75910bbcc 100644 --- a/spec/fixtures/packages/package-with-main/package.cson +++ b/spec/fixtures/packages/package-with-main/package.cson @@ -1 +1,2 @@ 'main': 'main-module.coffee' +'version': '2.3.4' diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index d82f37acb..4e88a1c2f 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -1,6 +1,7 @@ path = require 'path' Package = require '../src/package' {Disposable} = require 'atom' +{mockLocalStorage} = require './spec-helper' describe "PackageManager", -> workspaceElement = null @@ -161,6 +162,29 @@ describe "PackageManager", -> expect(pack.mainModule).toBeNull() + describe "when a package does not have deserializers, view providers or a config schema in its package.json", -> + beforeEach -> + atom.packages.unloadPackage('package-with-main') + mockLocalStorage() + + it "defers loading the package's main module if the package previously used no Atom APIs when its main module was required", -> + pack1 = atom.packages.loadPackage('package-with-main') + expect(pack1.mainModule).toBeDefined() + + atom.packages.unloadPackage('package-with-main') + + pack2 = atom.packages.loadPackage('package-with-main') + expect(pack2.mainModule).toBeNull() + + it "does not defer loading the package's main module if the package previously used Atom APIs when its main module was required", -> + pack1 = atom.packages.loadPackage('package-with-eval-time-api-calls') + expect(pack1.mainModule).toBeDefined() + + atom.packages.unloadPackage('package-with-eval-time-api-calls') + + pack2 = atom.packages.loadPackage('package-with-eval-time-api-calls') + expect(pack2.mainModule).not.toBeNull() + describe "::unloadPackage(name)", -> describe "when the package is active", -> it "throws an error", -> diff --git a/spec/package-spec.coffee b/spec/package-spec.coffee index f49d2ed7c..92218e749 100644 --- a/spec/package-spec.coffee +++ b/spec/package-spec.coffee @@ -1,6 +1,7 @@ path = require 'path' Package = require '../src/package' ThemePackage = require '../src/theme-package' +{mockLocalStorage} = require './spec-helper' describe "Package", -> build = (constructor, path) -> @@ -20,10 +21,7 @@ describe "Package", -> describe "when the package contains incompatible native modules", -> beforeEach -> - items = {} - spyOn(global.localStorage, 'setItem').andCallFake (key, item) -> items[key] = item; undefined - spyOn(global.localStorage, 'getItem').andCallFake (key) -> items[key] ? null - spyOn(global.localStorage, 'removeItem').andCallFake (key) -> delete items[key]; undefined + mockLocalStorage() it "does not activate it", -> packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-incompatible-native-module') @@ -55,10 +53,7 @@ describe "Package", -> describe "::rebuild()", -> beforeEach -> - items = {} - spyOn(global.localStorage, 'setItem').andCallFake (key, item) -> items[key] = item; undefined - spyOn(global.localStorage, 'getItem').andCallFake (key) -> items[key] ? null - spyOn(global.localStorage, 'removeItem').andCallFake (key) -> delete items[key]; undefined + mockLocalStorage() it "returns a promise resolving to the results of `apm rebuild`", -> packagePath = atom.project.getDirectories()[0]?.resolve('packages/package-with-index') diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee index f31c67298..67883511b 100644 --- a/spec/spec-helper.coffee +++ b/spec/spec-helper.coffee @@ -265,3 +265,9 @@ window.advanceClock = (delta=1) -> true callback() for callback in callbacks + +exports.mockLocalStorage = -> + items = {} + spyOn(global.localStorage, 'setItem').andCallFake (key, item) -> items[key] = item.toString(); undefined + spyOn(global.localStorage, 'getItem').andCallFake (key) -> items[key] ? null + spyOn(global.localStorage, 'removeItem').andCallFake (key) -> delete items[key]; undefined diff --git a/src/deserializer-manager.coffee b/src/deserializer-manager.coffee index 7f6cb0f65..3c73a0b02 100644 --- a/src/deserializer-manager.coffee +++ b/src/deserializer-manager.coffee @@ -39,6 +39,9 @@ class DeserializerManager delete @deserializers[deserializer.name] for deserializer in deserializers return + getDeserializerCount: -> + Object.keys(@deserializers).length + # Public: Deserialize the state and params. # # * `state` The state {Object} to deserialize. diff --git a/src/package.coffee b/src/package.coffee index f437d327a..5ff008ec7 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -98,7 +98,8 @@ class Package @metadata.deserializers? or @metadata.viewProviders? or @metadata.configSchema? or - @activationShouldBeDeferred() + @activationShouldBeDeferred() or + localStorage.getItem(@getCanDeferMainModuleRequireStorageKey()) is 'true' ) reset: -> @@ -426,7 +427,13 @@ class Package mainModulePath = @getMainModulePath() if fs.isFileSync(mainModulePath) @mainModuleRequired = true + + previousViewProviderCount = @viewRegistry.getViewProviderCount() + previousDeserializerCount = @deserializerManager.getDeserializerCount() @mainModule = require(mainModulePath) + if (@viewRegistry.getViewProviderCount() is previousViewProviderCount and + @deserializerManager.getDeserializerCount() is previousDeserializerCount) + localStorage.setItem(@getCanDeferMainModuleRequireStorageKey(), 'true') getMainModulePath: -> return @mainModulePath if @resolvedMainModulePath @@ -620,6 +627,9 @@ class Package electronVersion = process.versions['electron'] ? process.versions['atom-shell'] "installed-packages:#{@name}:#{@metadata.version}:electron-#{electronVersion}:incompatible-native-modules" + getCanDeferMainModuleRequireStorageKey: -> + "installed-packages:#{@name}:#{@metadata.version}:can-defer-main-module-require" + # Get the incompatible native modules that this package depends on. # This recurses through all dependencies and requires all modules that # contain a `.node` file. diff --git a/src/view-registry.coffee b/src/view-registry.coffee index e754a010b..ef7151353 100644 --- a/src/view-registry.coffee +++ b/src/view-registry.coffee @@ -106,6 +106,9 @@ class ViewRegistry new Disposable => @providers = @providers.filter (p) -> p isnt provider + getViewProviderCount: -> + @providers.length + # Essential: Get the view associated with an object in the workspace. # # If you're just *using* the workspace, you shouldn't need to access the view From f35dddee2f40a0a5edbd3c7afd0b1c19404ae3b6 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 23 Nov 2015 18:01:26 -0800 Subject: [PATCH 35/89] Reregister config schema when package is reactivated Signed-off-by: Nathan Sobo --- src/package.coffee | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/package.coffee b/src/package.coffee index 5ff008ec7..08b434583 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -85,7 +85,7 @@ class Package @loadMenus() @loadStylesheets() @loadDeserializers() - @registerConfigSchemaFromMetadata() + @configSchemaRegisteredOnLoad = @registerConfigSchemaFromMetadata() @settingsPromise = @loadSettings() if @shouldRequireMainModuleOnLoad() and not @mainModule? @requireMainModule() @@ -130,7 +130,7 @@ class Package activateNow: -> try @requireMainModule() unless @mainModule? - @registerConfigSchemaFromMainModule() + @configSchemaRegisteredOnActivate = @registerConfigSchemaFromMainModule() @registerViewProviders() @activateStylesheets() if @mainModule? and not @mainActivated @@ -146,16 +146,16 @@ class Package registerConfigSchemaFromMetadata: -> if configSchema = @metadata.configSchema @config.setSchema @name, {type: 'object', properties: configSchema} - @configSchemaRegistered = true + true + else + false registerConfigSchemaFromMainModule: -> - return if @configSchemaRegistered - - if @mainModule? + if @mainModule? and not @configSchemaRegisteredOnLoad if @mainModule.config? and typeof @mainModule.config is 'object' @config.setSchema @name, {type: 'object', properties: @mainModule.config} - - @configSchemaRegistered = true + return true + false activateStylesheets: -> return if @stylesheetsActivated @@ -382,6 +382,7 @@ class Package @activationPromise = null @resolveActivationPromise = null @activationCommandSubscriptions?.dispose() + @configSchemaRegisteredOnActivate = false @deactivateResources() @deactivateKeymaps() if @mainActivated From 7b976bc689e479995ca1ce40a5f2cc357aa5984a Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 24 Nov 2015 13:07:05 -0500 Subject: [PATCH 36/89] Don't cache me bro. --- build/tasks/publish-build-task.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index d8dffd1ea..b375123d3 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -249,6 +249,7 @@ uploadAssets = (release, buildDir, assets, callback) -> ACL: 'public-read' Key: key Body: fs.createReadStream(assetPath) + CacheControl: 'max-age=0' s3.upload uploadParams, (error, data) -> if error? console.log("Upload release asset #{assetName} to S3 failed", error) From 338d429d48cc7491d507f4df2b7ac73dd79e3ee7 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 24 Nov 2015 15:41:28 -0500 Subject: [PATCH 37/89] REVERT ME: Hacks on hacks on hacks to test. --- build/tasks/publish-build-task.coffee | 22 +++++++++++++--------- build/tasks/set-version-task.coffee | 4 ++-- package.json | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index b375123d3..518ccc77e 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - else - return + # else + # return doneCallback = @async() startTime = Date.now() @@ -55,12 +55,16 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - getAtomDraftRelease isPrerelease, channel, (error, release) -> - return done(error) if error? - assetNames = (asset.assetName for asset in assets) - deleteExistingAssets release, assetNames, (error) -> - return done(error) if error? - uploadAssets(release, buildDir, assets, done) + uploadAssets({tag_name: 'v1.1'}, buildDir, assets, done) + + # zipAssets buildDir, assets, (error) -> + # return done(error) if error? + # getAtomDraftRelease isPrerelease, channel, (error, release) -> + # return done(error) if error? + # assetNames = (asset.assetName for asset in assets) + # deleteExistingAssets release, assetNames, (error) -> + # return done(error) if error? + # uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -260,6 +264,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 28abb6493..99c147c53 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta'] + releasableBranches = ['stable', 'beta', 'upload-to-s3'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = if channel in releasableBranches then false else true + shouldUseCommitHash = false # if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository diff --git a/package.json b/package.json index 0ffc69221..2b563bf7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.4.0-dev", + "version": "1.1.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 4d21f1418efaefea003161dd6010071ee0a3ac7d Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 24 Nov 2015 16:08:01 -0500 Subject: [PATCH 38/89] REVERT ME: Test again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b563bf7c..bc4359ae1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.1.0-dev", + "version": "1.2.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 212afba8b1ca6fd25034a0728376bb366a53a340 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 24 Nov 2015 17:07:05 -0500 Subject: [PATCH 39/89] Revert "REVERT ME: Test again" This reverts commit 4d21f1418efaefea003161dd6010071ee0a3ac7d. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc4359ae1..2b563bf7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.2.0-dev", + "version": "1.1.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 233e6e47818ba740c6da3a0be26608313bd556c1 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 24 Nov 2015 17:07:09 -0500 Subject: [PATCH 40/89] Revert "REVERT ME: Hacks on hacks on hacks to test." This reverts commit 338d429d48cc7491d507f4df2b7ac73dd79e3ee7. --- build/tasks/publish-build-task.coffee | 22 +++++++++------------- build/tasks/set-version-task.coffee | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index 518ccc77e..b375123d3 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - # else - # return + else + return doneCallback = @async() startTime = Date.now() @@ -55,16 +55,12 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - uploadAssets({tag_name: 'v1.1'}, buildDir, assets, done) - - # zipAssets buildDir, assets, (error) -> - # return done(error) if error? - # getAtomDraftRelease isPrerelease, channel, (error, release) -> - # return done(error) if error? - # assetNames = (asset.assetName for asset in assets) - # deleteExistingAssets release, assetNames, (error) -> - # return done(error) if error? - # uploadAssets(release, buildDir, assets, done) + getAtomDraftRelease isPrerelease, channel, (error, release) -> + return done(error) if error? + assetNames = (asset.assetName for asset in assets) + deleteExistingAssets release, assetNames, (error) -> + return done(error) if error? + uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -264,6 +260,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 99c147c53..28abb6493 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta', 'upload-to-s3'] + releasableBranches = ['stable', 'beta'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = false # if channel in releasableBranches then false else true + shouldUseCommitHash = if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository diff --git a/package.json b/package.json index 2b563bf7c..0ffc69221 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.1.0-dev", + "version": "1.4.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From aecc2598f9d3af978334df37df5badddc8b512d0 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 24 Nov 2015 15:14:39 -0800 Subject: [PATCH 41/89] Restore private activateConfig method to fix settings-view --- src/package.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/package.coffee b/src/package.coffee index 08b434583..b831b3c55 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -157,6 +157,9 @@ class Package return true false + # TODO: Remove. Settings view calls this method currently. + activateConfig: -> @registerConfigSchemaFromMainModule() + activateStylesheets: -> return if @stylesheetsActivated From aac52b70206ac4fc2b4224402a23b46c280f7d95 Mon Sep 17 00:00:00 2001 From: Ross Allen Date: Tue, 24 Nov 2015 15:45:11 -0800 Subject: [PATCH 42/89] Correct config.coffee doc references to `scope` The scope selector is referred to with the key `scope` on the options object, not `scopeDescriptor` as the current docs claim. Reference `scope` correctly. Mark `options` as optional for `::observe` because the arguments collection is checked for length, and a length of 2 assumes the second argument is `callback`. `options` is actually optional. --- src/config.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 489e16016..d2759fcb4 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -381,8 +381,8 @@ class Config # ``` # # * `keyPath` {String} name of the key to observe - # * `options` {Object} - # * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from + # * `options` (optional) {Object} + # * `scope` (optional) {ScopeDescriptor} describing a path from # the root of the syntax tree to a token. Get one by calling # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) @@ -412,8 +412,8 @@ class Config # # * `keyPath` (optional) {String} name of the key to observe. Must be # specified if `scopeDescriptor` is specified. - # * `optional` (optional) {Object} - # * `scopeDescriptor` (optional) {ScopeDescriptor} describing a path from + # * `options` (optional) {Object} + # * `scope` (optional) {ScopeDescriptor} describing a path from # the root of the syntax tree to a token. Get one by calling # {editor.getLastCursor().getScopeDescriptor()}. See {::get} for examples. # See [the scopes docs](https://atom.io/docs/latest/behind-atom-scoped-settings-scopes-and-scope-descriptors) From 237d80fd2c47a50b57c115f568ed2366a9a31ad5 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Thu, 26 Nov 2015 11:13:10 -0500 Subject: [PATCH 43/89] :arrow_up: language-c@0.50.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 52a04e53e..11236f142 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "welcome": "0.33.0", "whitespace": "0.32.1", "wrap-guide": "0.38.1", - "language-c": "0.50.0", + "language-c": "0.50.1", "language-clojure": "0.18.0", "language-coffee-script": "0.45.0", "language-csharp": "0.11.0", From 5ae2a4a7fc3cf6071dba4fce0f29a9d908a1ce65 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Thu, 26 Nov 2015 11:13:26 -0500 Subject: [PATCH 44/89] :arrow_up: language-javascript@0.102.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 11236f142..7c345fe53 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "language-html": "0.42.0", "language-hyperlink": "0.15.0", "language-java": "0.17.0", - "language-javascript": "0.102.1", + "language-javascript": "0.102.2", "language-json": "0.17.1", "language-less": "0.29.0", "language-make": "0.20.0", From f2155fa22465234999e3a92d02a00edc8e16ca35 Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 27 Nov 2015 15:16:02 +0900 Subject: [PATCH 45/89] :arrow_up: settings-view@v0.232.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c345fe53..47521c4ea 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "open-on-github": "0.40.0", "package-generator": "0.41.0", "release-notes": "0.53.0", - "settings-view": "0.232.0", + "settings-view": "0.232.1", "snippets": "1.0.1", "spell-check": "0.63.0", "status-bar": "0.80.0", From d23a28538497cc7b6bb40874f07633b6761efa5d Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sun, 29 Nov 2015 11:03:59 -0500 Subject: [PATCH 46/89] :arrow_up: language-coffee-script@0.46.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 47521c4ea..4eb575535 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "wrap-guide": "0.38.1", "language-c": "0.50.1", "language-clojure": "0.18.0", - "language-coffee-script": "0.45.0", + "language-coffee-script": "0.46.0", "language-csharp": "0.11.0", "language-css": "0.35.1", "language-gfm": "0.81.0", From 9bd81d00e9d82e73c8a65d7ab29b217968cf4daf Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 10:16:13 -0500 Subject: [PATCH 47/89] Don't use a zero max age anymore. --- build/tasks/publish-build-task.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index b375123d3..d8dffd1ea 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -249,7 +249,6 @@ uploadAssets = (release, buildDir, assets, callback) -> ACL: 'public-read' Key: key Body: fs.createReadStream(assetPath) - CacheControl: 'max-age=0' s3.upload uploadParams, (error, data) -> if error? console.log("Upload release asset #{assetName} to S3 failed", error) From 1340597c5f78f1bdea7c0ba06a4090b8d3f13b04 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 11:09:45 -0500 Subject: [PATCH 48/89] Revert "Revert "REVERT ME: Hacks on hacks on hacks to test."" This reverts commit 233e6e47818ba740c6da3a0be26608313bd556c1. --- build/tasks/publish-build-task.coffee | 22 +++++++++++++--------- build/tasks/set-version-task.coffee | 4 ++-- package.json | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index d8dffd1ea..ea1188350 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - else - return + # else + # return doneCallback = @async() startTime = Date.now() @@ -55,12 +55,16 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - getAtomDraftRelease isPrerelease, channel, (error, release) -> - return done(error) if error? - assetNames = (asset.assetName for asset in assets) - deleteExistingAssets release, assetNames, (error) -> - return done(error) if error? - uploadAssets(release, buildDir, assets, done) + uploadAssets({tag_name: 'v1.1'}, buildDir, assets, done) + + # zipAssets buildDir, assets, (error) -> + # return done(error) if error? + # getAtomDraftRelease isPrerelease, channel, (error, release) -> + # return done(error) if error? + # assetNames = (asset.assetName for asset in assets) + # deleteExistingAssets release, assetNames, (error) -> + # return done(error) if error? + # uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -259,6 +263,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 28abb6493..99c147c53 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta'] + releasableBranches = ['stable', 'beta', 'upload-to-s3'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = if channel in releasableBranches then false else true + shouldUseCommitHash = false # if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository diff --git a/package.json b/package.json index 4eb575535..d24638a73 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.4.0-dev", + "version": "1.1.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 1fd7267f10d693bdfd1260f5694069d8399f62f8 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 11:34:08 -0500 Subject: [PATCH 49/89] REVERT ME: Tests gonna test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d24638a73..ed33be9a6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.1.0-dev", + "version": "1.2.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From 9fabac6fde4dd25357ed7998af530e2b77f44f59 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 12:27:05 -0500 Subject: [PATCH 50/89] Revert "REVERT ME: Tests gonna test" This reverts commit 1fd7267f10d693bdfd1260f5694069d8399f62f8. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ed33be9a6..d24638a73 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.2.0-dev", + "version": "1.1.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From d223e0738977e5071ba946fe8713151d9f02c4ed Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 12:27:09 -0500 Subject: [PATCH 51/89] Revert "Revert "Revert "REVERT ME: Hacks on hacks on hacks to test.""" This reverts commit 1340597c5f78f1bdea7c0ba06a4090b8d3f13b04. --- build/tasks/publish-build-task.coffee | 22 +++++++++------------- build/tasks/set-version-task.coffee | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index ea1188350..d8dffd1ea 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -37,8 +37,8 @@ module.exports = (gruntObject) -> isPrerelease = false when 'beta' isPrerelease = true - # else - # return + else + return doneCallback = @async() startTime = Date.now() @@ -55,16 +55,12 @@ module.exports = (gruntObject) -> zipAssets buildDir, assets, (error) -> return done(error) if error? - uploadAssets({tag_name: 'v1.1'}, buildDir, assets, done) - - # zipAssets buildDir, assets, (error) -> - # return done(error) if error? - # getAtomDraftRelease isPrerelease, channel, (error, release) -> - # return done(error) if error? - # assetNames = (asset.assetName for asset in assets) - # deleteExistingAssets release, assetNames, (error) -> - # return done(error) if error? - # uploadAssets(release, buildDir, assets, done) + getAtomDraftRelease isPrerelease, channel, (error, release) -> + return done(error) if error? + assetNames = (asset.assetName for asset in assets) + deleteExistingAssets release, assetNames, (error) -> + return done(error) if error? + uploadAssets(release, buildDir, assets, done) getAssets = -> {cp} = require('./task-helpers')(grunt) @@ -263,6 +259,6 @@ uploadAssets = (release, buildDir, assets, callback) -> tasks = [] for {assetName} in assets assetPath = path.join(buildDir, assetName) - # tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) + tasks.push(uploadToReleases.bind(this, release, assetName, assetPath)) tasks.push(uploadToS3.bind(this, release, assetName, assetPath)) async.parallel(tasks, callback) diff --git a/build/tasks/set-version-task.coffee b/build/tasks/set-version-task.coffee index 99c147c53..28abb6493 100644 --- a/build/tasks/set-version-task.coffee +++ b/build/tasks/set-version-task.coffee @@ -5,9 +5,9 @@ module.exports = (grunt) -> {spawn} = require('./task-helpers')(grunt) getVersion = (callback) -> - releasableBranches = ['stable', 'beta', 'upload-to-s3'] + releasableBranches = ['stable', 'beta'] channel = grunt.config.get('atom.channel') - shouldUseCommitHash = false # if channel in releasableBranches then false else true + shouldUseCommitHash = if channel in releasableBranches then false else true inRepository = fs.existsSync(path.resolve(__dirname, '..', '..', '.git')) {version} = require(path.join(grunt.config.get('atom.appDir'), 'package.json')) if shouldUseCommitHash and inRepository diff --git a/package.json b/package.json index d24638a73..4eb575535 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.1.0-dev", + "version": "1.4.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From a2f14685fcdfa2970db7658e97f046c9493c2a0a Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 30 Nov 2015 10:15:16 -0800 Subject: [PATCH 52/89] :arrow_up: autocomplete-snippets --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b488ba3ce..31086502b 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "autocomplete-css": "0.11.0", "autocomplete-html": "0.7.2", "autocomplete-plus": "2.23.0", - "autocomplete-snippets": "1.8.0", + "autocomplete-snippets": "1.9.0", "autoflow": "0.26.0", "autosave": "0.23.0", "background-tips": "0.26.0", From 6cd31f94e9a1f5cca8ea954954ad2f8df808b036 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 30 Nov 2015 13:21:25 -0500 Subject: [PATCH 53/89] Use logError instead of console.log. --- build/tasks/publish-build-task.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/tasks/publish-build-task.coffee b/build/tasks/publish-build-task.coffee index d8dffd1ea..4f8df6336 100644 --- a/build/tasks/publish-build-task.coffee +++ b/build/tasks/publish-build-task.coffee @@ -251,7 +251,7 @@ uploadAssets = (release, buildDir, assets, callback) -> Body: fs.createReadStream(assetPath) s3.upload uploadParams, (error, data) -> if error? - console.log("Upload release asset #{assetName} to S3 failed", error) + logError("Upload release asset #{assetName} to S3 failed", error) callback(error) else callback(null, release) From 228e67838c7705c9e1fca19d84ba8a6bf7000fbd Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 30 Nov 2015 10:51:03 -0800 Subject: [PATCH 54/89] Suppress false coffeelint error --- spec/workspace-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/workspace-spec.coffee b/spec/workspace-spec.coffee index e150761af..0587a2629 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -661,7 +661,7 @@ describe "Workspace", -> describe "::isTextEditor(obj)", -> it "returns true when the passed object is an instance of `TextEditor`", -> expect(workspace.isTextEditor(atom.workspace.buildTextEditor())).toBe(true) - expect(workspace.isTextEditor({getText: ->})).toBe(false) + expect(workspace.isTextEditor({getText: -> null})).toBe(false) expect(workspace.isTextEditor(null)).toBe(false) expect(workspace.isTextEditor(undefined)).toBe(false) From f139992585fddd88ffdea3513c64503db6be0516 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 30 Nov 2015 10:47:40 -0800 Subject: [PATCH 55/89] Avoid infinite recursion in Error.prepareStackTrace Previously, prepareStackTraceWithStackAssignment could end up calling itself when third-party code assigned Error.prepareStackTrace back to its original value. Now, we short-circuit this process if the rawStack property has already been assigned. Signed-off-by: Max Brunsfeld --- spec/compile-cache-spec.coffee | 23 ++++++++++++++++++++++- src/compile-cache.js | 8 ++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/spec/compile-cache-spec.coffee b/spec/compile-cache-spec.coffee index 8a6cc214e..848da6b49 100644 --- a/spec/compile-cache-spec.coffee +++ b/spec/compile-cache-spec.coffee @@ -81,6 +81,27 @@ describe 'CompileCache', -> waits(1) runs -> error = new Error("Oops again") - console.log error.stack expect(error.stack).toContain('compile-cache-spec.coffee') expect(Array.isArray(error.getRawStack())).toBe true + + it 'does not infinitely loop when the original prepareStackTrace value is reassigned', -> + originalPrepareStackTrace = Error.prepareStackTrace + + Error.prepareStackTrace = -> 'a-stack-trace' + Error.prepareStackTrace = originalPrepareStackTrace + + error = new Error('Oops') + expect(error.stack).toContain('compile-cache-spec.coffee') + expect(Array.isArray(error.getRawStack())).toBe true + + it 'does not infinitely loop when the assigned prepareStackTrace calls the original prepareStackTrace', -> + originalPrepareStackTrace = Error.prepareStackTrace + + Error.prepareStackTrace = (error, stack) -> + error.foo = 'bar' + originalPrepareStackTrace(error, stack) + + error = new Error('Oops') + expect(error.stack).toContain('compile-cache-spec.coffee') + expect(error.foo).toBe('bar') + expect(Array.isArray(error.getRawStack())).toBe true diff --git a/src/compile-cache.js b/src/compile-cache.js index bedbd2549..8da229a50 100644 --- a/src/compile-cache.js +++ b/src/compile-cache.js @@ -163,8 +163,12 @@ var prepareStackTraceWithSourceMapping = Error.prepareStackTrace let prepareStackTrace = prepareStackTraceWithSourceMapping function prepareStackTraceWithRawStackAssignment (error, frames) { - error.rawStack = frames - return prepareStackTrace(error, frames) + if (error.rawStack) { // avoid infinite recursion + return prepareStackTraceWithSourceMapping(error, frames) + } else { + error.rawStack = frames + return prepareStackTrace(error, frames) + } } Object.defineProperty(Error, 'prepareStackTrace', { From 3836b5cbaac4acb6251c402a178ee8018ccffa4b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Nov 2015 16:14:37 -0800 Subject: [PATCH 56/89] :arrow_up: language-make@0.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a5aa9437..006984454 100644 --- a/package.json +++ b/package.json @@ -130,7 +130,7 @@ "language-javascript": "0.102.2", "language-json": "0.17.1", "language-less": "0.29.0", - "language-make": "0.20.0", + "language-make": "0.21.0", "language-mustache": "0.13.0", "language-objective-c": "0.15.0", "language-perl": "0.31.0", From c26d2be959a1941f51895330cac28b6328370a2e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Nov 2015 16:43:33 -0800 Subject: [PATCH 57/89] :arrow_up: markdown-preview@0.157 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 006984454..cf099f2d3 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "keybinding-resolver": "0.33.0", "line-ending-selector": "0.3.0", "link": "0.31.0", - "markdown-preview": "0.156.2", + "markdown-preview": "0.157.0", "metrics": "0.53.1", "notifications": "0.62.1", "open-on-github": "0.40.0", From a69f5d54683c3dc86d09dea046016d52d9959c17 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Nov 2015 16:46:00 -0800 Subject: [PATCH 58/89] :arrow_up: language-shellscript@0.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf099f2d3..67a51bbc3 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "language-ruby": "0.64.1", "language-ruby-on-rails": "0.24.0", "language-sass": "0.44.1", - "language-shellscript": "0.20.0", + "language-shellscript": "0.21.0", "language-source": "0.9.0", "language-sql": "0.19.0", "language-text": "0.7.0", From d0cbcdf0703ff570332f32363502c266c1741faa Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Nov 2015 17:03:10 -0800 Subject: [PATCH 59/89] :arrow_up: language-javascript@0.103.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 67a51bbc3..05f14ceaf 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "language-html": "0.42.0", "language-hyperlink": "0.15.0", "language-java": "0.17.0", - "language-javascript": "0.102.2", + "language-javascript": "0.103.0", "language-json": "0.17.1", "language-less": "0.29.0", "language-make": "0.21.0", From 73e83e83ac77b56afc066380dee057691da2f537 Mon Sep 17 00:00:00 2001 From: Wliu Date: Mon, 30 Nov 2015 20:12:16 -0500 Subject: [PATCH 60/89] Entirely :fire: shortcut creation --- build/Gruntfile.coffee | 3 +-- build/tasks/install-task.coffee | 4 ---- docs/build-instructions/windows.md | 1 - script/create-shortcut.cmd | 23 ----------------------- 4 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 script/create-shortcut.cmd diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index cb6ff0c1e..8dd1c573b 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -37,7 +37,6 @@ module.exports = (grunt) -> buildDir ?= path.join(os.tmpdir(), 'atom-build') buildDir = path.resolve(buildDir) disableAutoUpdate = grunt.option('no-auto-update') ? false - disableShortcut = grunt.option('no-shortcut') ? false channel = grunt.option('channel') releasableBranches = ['stable', 'beta'] @@ -180,7 +179,7 @@ module.exports = (grunt) -> pkg: grunt.file.readJSON('package.json') atom: { - appName, channel, metadata, disableAutoUpdate, disableShortcut, + appName, channel, metadata, disableAutoUpdate, appFileName, apmFileName, appDir, buildDir, contentsDir, installDir, shellAppDir, symbolsDir, } diff --git a/build/tasks/install-task.coffee b/build/tasks/install-task.coffee index ee38b1582..2d9054385 100644 --- a/build/tasks/install-task.coffee +++ b/build/tasks/install-task.coffee @@ -20,10 +20,6 @@ module.exports = (grunt) -> copyFolder = path.resolve 'script', 'copy-folder.cmd' if runas('cmd', ['/c', copyFolder, shellAppDir, installDir], admin: true) isnt 0 grunt.log.error("Failed to copy #{shellAppDir} to #{installDir}") - - unless grunt.config.get('atom.disableShortcut') - createShortcut = path.resolve 'script', 'create-shortcut.cmd' - runas('cmd', ['/c', createShortcut, path.join(installDir, 'atom.exe'), appName]) else if process.platform is 'darwin' rm installDir mkdir path.dirname(installDir) diff --git a/docs/build-instructions/windows.md b/docs/build-instructions/windows.md index fa7c32148..debdd6570 100644 --- a/docs/build-instructions/windows.md +++ b/docs/build-instructions/windows.md @@ -34,7 +34,6 @@ These instructions will assume the use of Git Shell. * `--install-dir` - Creates the final built application in this directory. * `--build-dir` - Build the application in this directory. * `--verbose` - Verbose mode. A lot more information output. - * `--no-shortcut` - Don't create a desktop shortcut. ## Why do I have to use GitHub Desktop? diff --git a/script/create-shortcut.cmd b/script/create-shortcut.cmd deleted file mode 100644 index ca295d434..000000000 --- a/script/create-shortcut.cmd +++ /dev/null @@ -1,23 +0,0 @@ -@echo off - -set USAGE=Usage: %0 source name-on-desktop - -if [%1] == [] ( - echo %USAGE% - exit 1 -) -if [%2] == [] ( - echo %USAGE% - exit 2 -) - -set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs" - -echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT% -echo sLinkFile = "%USERPROFILE%\Desktop\%2.lnk" >> %SCRIPT% -echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT% -echo oLink.TargetPath = %1 >> %SCRIPT% -echo oLink.Save >> %SCRIPT% - -cscript /nologo %SCRIPT% -del %SCRIPT% From 7c9d32d8d62abbcd8a24bc2a3a1ae9690c2693d9 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 30 Nov 2015 17:26:23 -0800 Subject: [PATCH 61/89] :arrow_up: language-html@0.43 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05f14ceaf..23d7aa55e 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "language-gfm": "0.81.0", "language-git": "0.10.0", "language-go": "0.40.0", - "language-html": "0.42.0", + "language-html": "0.43.0", "language-hyperlink": "0.15.0", "language-java": "0.17.0", "language-javascript": "0.103.0", From 3da93a10458122f06ddb0a0bcb0eb1868220d54b Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Tue, 1 Dec 2015 17:17:41 -0500 Subject: [PATCH 62/89] :arrow_up: language-ruby@0.65.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 23d7aa55e..6cda226fd 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "language-php": "0.34.0", "language-property-list": "0.8.0", "language-python": "0.42.1", - "language-ruby": "0.64.1", + "language-ruby": "0.65.0", "language-ruby-on-rails": "0.24.0", "language-sass": "0.44.1", "language-shellscript": "0.21.0", From 5b81f11711bd7f44cc1de87ad241fe9076e2b7b9 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Tue, 1 Dec 2015 22:40:33 -0500 Subject: [PATCH 63/89] :arrow_up: language-objective-c@0.15.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6cda226fd..0e2c0f997 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "language-less": "0.29.0", "language-make": "0.21.0", "language-mustache": "0.13.0", - "language-objective-c": "0.15.0", + "language-objective-c": "0.15.1", "language-perl": "0.31.0", "language-php": "0.34.0", "language-property-list": "0.8.0", From ed7a80b5aade6422822e5bc6429a62eef6bee36c Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Fri, 20 Nov 2015 21:59:48 -0600 Subject: [PATCH 64/89] bump Contributor Covenant version to 1.3 --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36de7b46c..6e0a1fede 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ These are just guidelines, not rules, use your best judgment and feel free to pr ### Code of Conduct -This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0). +This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0). By participating, you are expected to uphold this code. Please report unacceptable behavior to [atom@github.com](mailto:atom@github.com). diff --git a/README.md b/README.md index 168124ac5..6d1d8a385 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https:/ Follow [@AtomEditor](https://twitter.com/atomeditor) on Twitter for important announcements. -This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0). +This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0). By participating, you are expected to uphold this code. Please report unacceptable behavior to atom@github.com. ## Documentation From df34bd8b3f2c22457ab7a9dadcdb850a5e666a95 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 2 Dec 2015 16:15:34 -0600 Subject: [PATCH 65/89] add CODE_OF_CONDUCT.md with atom@github.com email address --- CODE_OF_CONDUCT.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..444ce0b4c --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,24 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery +- Personal attacks +- Trolling or insulting/derogatory comments +- Public or private harassment +- Publishing other's private information, such as physical or electronic addresses, without explicit permission +- Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a project maintainer at [atom@github.com](mailto:atom@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident. + +This Code of Conduct is adapted from the Contributor Covenant, version 1.3.0, available from http://contributor-covenant.org/version/1/3/0/ From effb01c7e6ac65b29ca8abed90c40ef271499085 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 18:18:16 -0500 Subject: [PATCH 66/89] :arrow_up: language-css@0.36.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e2c0f997..fe0d9c811 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "language-clojure": "0.18.0", "language-coffee-script": "0.46.0", "language-csharp": "0.11.0", - "language-css": "0.35.1", + "language-css": "0.36.0", "language-gfm": "0.81.0", "language-git": "0.10.0", "language-go": "0.40.0", From bb2278e8cd3eb09a2b2a6e1aad139ad2e806de91 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 18:19:32 -0500 Subject: [PATCH 67/89] :arrow_up: language-sass@0.45.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fe0d9c811..f8dcd822e 100644 --- a/package.json +++ b/package.json @@ -139,7 +139,7 @@ "language-python": "0.42.1", "language-ruby": "0.65.0", "language-ruby-on-rails": "0.24.0", - "language-sass": "0.44.1", + "language-sass": "0.45.0", "language-shellscript": "0.21.0", "language-source": "0.9.0", "language-sql": "0.19.0", From db93dd46e2ed9356e353e15e441d8d9e288197aa Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 18:22:18 -0500 Subject: [PATCH 68/89] :arrow_up: language-c@0.51.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f8dcd822e..3678a1b3a 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "welcome": "0.33.0", "whitespace": "0.32.1", "wrap-guide": "0.38.1", - "language-c": "0.50.1", + "language-c": "0.51.0", "language-clojure": "0.18.0", "language-coffee-script": "0.46.0", "language-csharp": "0.11.0", From 63c7f1cf9aac3899e2796360ac1628c6d450d52b Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 18:22:59 -0500 Subject: [PATCH 69/89] :arrow_up: language-json@0.17.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3678a1b3a..85ba0be29 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "language-hyperlink": "0.15.0", "language-java": "0.17.0", "language-javascript": "0.103.0", - "language-json": "0.17.1", + "language-json": "0.17.2", "language-less": "0.29.0", "language-make": "0.21.0", "language-mustache": "0.13.0", From 2bec69fcc2cf7e63fece0212fa75350d28d59190 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 18:26:20 -0500 Subject: [PATCH 70/89] :arrow_up: language-yaml@0.24.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85ba0be29..e7cfc5c8c 100644 --- a/package.json +++ b/package.json @@ -147,7 +147,7 @@ "language-todo": "0.27.0", "language-toml": "0.17.0", "language-xml": "0.34.1", - "language-yaml": "0.24.0" + "language-yaml": "0.24.1" }, "private": true, "scripts": { From 837b003e0027824ac777632c4b816c67cbc93f33 Mon Sep 17 00:00:00 2001 From: Wliu Date: Wed, 2 Dec 2015 20:47:06 -0500 Subject: [PATCH 71/89] :arrow_up: language-javascript@0.104.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e7cfc5c8c..265e046dc 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "language-html": "0.43.0", "language-hyperlink": "0.15.0", "language-java": "0.17.0", - "language-javascript": "0.103.0", + "language-javascript": "0.104.0", "language-json": "0.17.2", "language-less": "0.29.0", "language-make": "0.21.0", From ecd14f33902bd542d525506fc4c45c3b8e1eed52 Mon Sep 17 00:00:00 2001 From: Wliu Date: Wed, 2 Dec 2015 20:47:27 -0500 Subject: [PATCH 72/89] :green_heart: let and var are now storage.type.var.js Refs atom/language-javascript#277 --- spec/text-editor-component-spec.js | 2 +- spec/text-editor-presenter-spec.coffee | 2 +- spec/tokenized-buffer-spec.coffee | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/text-editor-component-spec.js b/spec/text-editor-component-spec.js index 609d20291..d5e9f5425 100644 --- a/spec/text-editor-component-spec.js +++ b/spec/text-editor-component-spec.js @@ -484,7 +484,7 @@ describe('TextEditorComponent', function () { it('displays newlines as their own token outside of the other tokens\' scopeDescriptor', async function () { editor.setText('let\n') await nextViewUpdatePromise() - expect(component.lineNodeForScreenRow(0).innerHTML).toBe('let' + invisibles.eol + '') + expect(component.lineNodeForScreenRow(0).innerHTML).toBe('let' + invisibles.eol + '') }) it('displays trailing carriage returns using a visible, non-empty value', async function () { diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index 8dd34fde8..f3800220e 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -611,7 +611,7 @@ describe "TextEditorPresenter", -> expect(presenter.getState().hiddenInput.width).toBe 15 expectStateUpdate presenter, -> - presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.modifier.js'], 'r', 20) + presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.type.var.js'], 'r', 20) presenter.characterWidthsChanged() expect(presenter.getState().hiddenInput.width).toBe 20 diff --git a/spec/tokenized-buffer-spec.coffee b/spec/tokenized-buffer-spec.coffee index 5d6d3cfdc..692e758a9 100644 --- a/spec/tokenized-buffer-spec.coffee +++ b/spec/tokenized-buffer-spec.coffee @@ -198,7 +198,7 @@ describe "TokenizedBuffer", -> buffer.setTextInRange([[1, 0], [3, 0]], "foo()") # previous line 0 remains - expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.modifier.js']) + expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual(value: 'var', scopes: ['source.js', 'storage.type.var.js']) # previous line 3 should be combined with input to form line 1 expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js', 'meta.function-call.js', 'entity.name.function.js']) @@ -242,7 +242,7 @@ describe "TokenizedBuffer", -> buffer.setTextInRange([[1, 0], [2, 0]], "foo()\nbar()\nbaz()\nquux()") # previous line 0 remains - expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual( value: 'var', scopes: ['source.js', 'storage.modifier.js']) + expect(tokenizedBuffer.tokenizedLineForRow(0).tokens[0]).toEqual( value: 'var', scopes: ['source.js', 'storage.type.var.js']) # 3 new lines inserted expect(tokenizedBuffer.tokenizedLineForRow(1).tokens[0]).toEqual(value: 'foo', scopes: ['source.js', 'meta.function-call.js', 'entity.name.function.js']) @@ -582,7 +582,7 @@ describe "TokenizedBuffer", -> fullyTokenize(tokenizedBuffer) expect(tokenizedBuffer.tokenForPosition([1, 0]).scopes).toEqual ["source.js"] expect(tokenizedBuffer.tokenForPosition([1, 1]).scopes).toEqual ["source.js"] - expect(tokenizedBuffer.tokenForPosition([1, 2]).scopes).toEqual ["source.js", "storage.modifier.js"] + expect(tokenizedBuffer.tokenForPosition([1, 2]).scopes).toEqual ["source.js", "storage.type.var.js"] describe ".bufferRangeForScopeAtPosition(selector, position)", -> beforeEach -> @@ -599,8 +599,8 @@ describe "TokenizedBuffer", -> describe "when the selector matches a single token at the position", -> it "returns the range covered by the token", -> - expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.modifier.js', [0, 1])).toEqual [[0, 0], [0, 3]] - expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.modifier.js', [0, 3])).toEqual [[0, 0], [0, 3]] + expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.type.var.js', [0, 1])).toEqual [[0, 0], [0, 3]] + expect(tokenizedBuffer.bufferRangeForScopeAtPosition('.storage.type.var.js', [0, 3])).toEqual [[0, 0], [0, 3]] describe "when the selector matches a run of multiple tokens at the position", -> it "returns the range covered by all contigous tokens (within a single line)", -> From d85af0d3f40ecce205bf36ecea9d345ee23ce0e2 Mon Sep 17 00:00:00 2001 From: Wliu Date: Wed, 2 Dec 2015 21:39:12 -0500 Subject: [PATCH 73/89] :green_heart: again --- spec/text-editor-presenter-spec.coffee | 4 ++-- spec/text-editor-spec.coffee | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/text-editor-presenter-spec.coffee b/spec/text-editor-presenter-spec.coffee index f3800220e..2aeb8822e 100644 --- a/spec/text-editor-presenter-spec.coffee +++ b/spec/text-editor-presenter-spec.coffee @@ -1449,12 +1449,12 @@ describe "TextEditorPresenter", -> presenter = buildPresenter(explicitHeight: 20) expectStateUpdate presenter, -> - presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.modifier.js'], 'v', 20) + presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.type.var.js'], 'v', 20) presenter.characterWidthsChanged() expect(stateForCursor(presenter, 0)).toEqual {top: 1 * 10, left: (3 * 10) + 20, width: 10, height: 10} expectStateUpdate presenter, -> - presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.modifier.js'], 'r', 20) + presenter.getLinesYardstick().setScopedCharacterWidth(['source.js', 'storage.type.var.js'], 'r', 20) presenter.characterWidthsChanged() expect(stateForCursor(presenter, 0)).toEqual {top: 1 * 10, left: (3 * 10) + 20, width: 20, height: 10} diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 0cee8215a..1797e25bf 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -5337,7 +5337,7 @@ describe "TextEditor", -> tokens = atom.grammars.decodeTokens(line, tags) expect(tokens[0].value).toBe "var" - expect(tokens[0].scopes).toEqual ["source.js", "storage.modifier.js"] + expect(tokens[0].scopes).toEqual ["source.js", "storage.type.var.js"] expect(tokens[6].value).toBe "http://github.com" expect(tokens[6].scopes).toEqual ["source.js", "comment.line.double-slash.js", "markup.underline.link.http.hyperlink"] From 26929810a0f4ded720245b3b7f9c504334f542ab Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Wed, 2 Dec 2015 22:10:55 -0500 Subject: [PATCH 74/89] :arrow_up: language-html@0.43.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 265e046dc..fadb21d55 100644 --- a/package.json +++ b/package.json @@ -124,7 +124,7 @@ "language-gfm": "0.81.0", "language-git": "0.10.0", "language-go": "0.40.0", - "language-html": "0.43.0", + "language-html": "0.43.1", "language-hyperlink": "0.15.0", "language-java": "0.17.0", "language-javascript": "0.104.0", From e047741ff362f43b3f35bf10a9f9d938f6ed1983 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Wed, 2 Dec 2015 23:36:29 -0600 Subject: [PATCH 75/89] link to CoC from README and CONTRIBUTING docs [ci skip] --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e0a1fede..0fdf8b43d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ These are just guidelines, not rules, use your best judgment and feel free to pr ### Code of Conduct -This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0). +This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0) (see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)). By participating, you are expected to uphold this code. Please report unacceptable behavior to [atom@github.com](mailto:atom@github.com). diff --git a/README.md b/README.md index 6d1d8a385..fdca068ab 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https:/ Follow [@AtomEditor](https://twitter.com/atomeditor) on Twitter for important announcements. -This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0). +This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0) (see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)). By participating, you are expected to uphold this code. Please report unacceptable behavior to atom@github.com. ## Documentation From c6cca659abc32c500a10efbd536072dc5ec2b869 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Thu, 3 Dec 2015 10:33:14 -0500 Subject: [PATCH 76/89] :arrow_up: language-clojure@0.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e7cfc5c8c..00fcadf25 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "whitespace": "0.32.1", "wrap-guide": "0.38.1", "language-c": "0.51.0", - "language-clojure": "0.18.0", + "language-clojure": "0.19.0", "language-coffee-script": "0.46.0", "language-csharp": "0.11.0", "language-css": "0.36.0", From d81e2a23b9f45927e73a60a2f7eb194ed195e9ab Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Thu, 3 Dec 2015 10:08:03 -0600 Subject: [PATCH 77/89] remove links to Contributor Covenant CoC --- CONTRIBUTING.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0fdf8b43d..ada420a40 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,7 +30,7 @@ These are just guidelines, not rules, use your best judgment and feel free to pr ### Code of Conduct -This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0) (see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)). +This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [atom@github.com](mailto:atom@github.com). diff --git a/README.md b/README.md index fdca068ab..7f7acb5fe 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Visit [atom.io](https://atom.io) to learn more or visit the [Atom forum](https:/ Follow [@AtomEditor](https://twitter.com/atomeditor) on Twitter for important announcements. -This project adheres to the [Contributor Covenant 1.3](http://contributor-covenant.org/version/1/3/0) (see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)). +This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to atom@github.com. ## Documentation From 71d2761c1ad1f0a2128a3a716b97118634ba21e0 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Dec 2015 10:30:09 -0800 Subject: [PATCH 78/89] Merge pull request #9763 from dranzerashi/patch-1 --- spec/text-editor-spec.coffee | 27 +++++++++++++++++++++++++++ src/cursor.coffee | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 0cee8215a..dbc5289f7 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -767,6 +767,20 @@ describe "TextEditor", -> editor.moveToBeginningOfWord() expect(editor.getCursorBufferPosition()).toEqual [9, 2] + it "treats lines with only whitespace as a word (CRLF line ending)", -> + editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) + editor.setCursorBufferPosition([11, 0]) + editor.moveToBeginningOfWord() + expect(editor.getCursorBufferPosition()).toEqual [10, 0] + editor.buffer.setText(buffer.getText().replace(/\r\n/g, "\n")) + + it "works when the current line is blank (CRLF line ending)", -> + editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) + editor.setCursorBufferPosition([10, 0]) + editor.moveToBeginningOfWord() + expect(editor.getCursorBufferPosition()).toEqual [9, 2] + editor.buffer.setText(buffer.getText().replace(/\r\n/g, "\n")) + describe ".moveToPreviousWordBoundary()", -> it "moves the cursor to the previous word boundary", -> editor.setCursorBufferPosition [0, 8] @@ -826,6 +840,19 @@ describe "TextEditor", -> editor.moveToEndOfWord() expect(editor.getCursorBufferPosition()).toEqual [11, 8] + it "treats lines with only whitespace as a word (CRLF line ending)", -> + editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) + editor.setCursorBufferPosition([9, 4]) + editor.moveToEndOfWord() + expect(editor.getCursorBufferPosition()).toEqual [10, 0] + + it "works when the current line is blank (CRLF line ending)", -> + editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) + editor.setCursorBufferPosition([10, 0]) + editor.moveToEndOfWord() + expect(editor.getCursorBufferPosition()).toEqual [11, 8] + editor.buffer.setText(buffer.getText().replace(/\r\n/g, "\n")) + describe ".moveToBeginningOfNextWord()", -> it "moves the cursor before the first character of the next word", -> editor.setCursorBufferPosition [0, 6] diff --git a/src/cursor.coffee b/src/cursor.coffee index 0f87c2760..9368a5a9c 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -606,7 +606,7 @@ class Cursor extends Model wordRegExp: ({includeNonWordCharacters}={}) -> includeNonWordCharacters ?= true nonWordCharacters = @config.get('editor.nonWordCharacters', scope: @getScopeDescriptor()) - segments = ["^[\t ]*$"] + segments = ["\\r?\\n[\\t\\s]*\\r?\\n"] segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+") if includeNonWordCharacters segments.push("[#{_.escapeRegExp(nonWordCharacters)}]+") From 76b6ca5043a83cffa5c4c44fb9cd3691b5fcffaa Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Dec 2015 11:52:45 -0800 Subject: [PATCH 79/89] Make CRLF word-movement tests pass --- spec/text-editor-spec.coffee | 22 +++++++++----------- src/cursor.coffee | 40 +++++++++++++++++++----------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index dbc5289f7..23312ca2b 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -762,17 +762,16 @@ describe "TextEditor", -> editor.moveToBeginningOfWord() expect(editor.getCursorBufferPosition()).toEqual [10, 0] - it "works when the current line is blank", -> - editor.setCursorBufferPosition([10, 0]) - editor.moveToBeginningOfWord() - expect(editor.getCursorBufferPosition()).toEqual [9, 2] - it "treats lines with only whitespace as a word (CRLF line ending)", -> editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) editor.setCursorBufferPosition([11, 0]) editor.moveToBeginningOfWord() expect(editor.getCursorBufferPosition()).toEqual [10, 0] - editor.buffer.setText(buffer.getText().replace(/\r\n/g, "\n")) + + it "works when the current line is blank", -> + editor.setCursorBufferPosition([10, 0]) + editor.moveToBeginningOfWord() + expect(editor.getCursorBufferPosition()).toEqual [9, 2] it "works when the current line is blank (CRLF line ending)", -> editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) @@ -835,23 +834,22 @@ describe "TextEditor", -> editor.moveToEndOfWord() expect(editor.getCursorBufferPosition()).toEqual [10, 0] - it "works when the current line is blank", -> - editor.setCursorBufferPosition([10, 0]) - editor.moveToEndOfWord() - expect(editor.getCursorBufferPosition()).toEqual [11, 8] - it "treats lines with only whitespace as a word (CRLF line ending)", -> editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) editor.setCursorBufferPosition([9, 4]) editor.moveToEndOfWord() expect(editor.getCursorBufferPosition()).toEqual [10, 0] + it "works when the current line is blank", -> + editor.setCursorBufferPosition([10, 0]) + editor.moveToEndOfWord() + expect(editor.getCursorBufferPosition()).toEqual [11, 8] + it "works when the current line is blank (CRLF line ending)", -> editor.buffer.setText(buffer.getText().replace(/\n/g, "\r\n")) editor.setCursorBufferPosition([10, 0]) editor.moveToEndOfWord() expect(editor.getCursorBufferPosition()).toEqual [11, 8] - editor.buffer.setText(buffer.getText().replace(/\r\n/g, "\n")) describe ".moveToBeginningOfNextWord()", -> it "moves the cursor before the first character of the next word", -> diff --git a/src/cursor.coffee b/src/cursor.coffee index 9368a5a9c..c63485fd2 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -467,10 +467,13 @@ class Cursor extends Model scanRange = [[previousNonBlankRow, 0], currentBufferPosition] beginningOfWordPosition = null - @editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp(options)), scanRange, ({range, stop}) -> - if range.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious - beginningOfWordPosition = range.start - if not beginningOfWordPosition?.isEqual(currentBufferPosition) + @editor.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp(options)), scanRange, ({range, matchText, stop}) -> + # Ignore 'empty line' matches between '\r' and '\n' + return if matchText is '' and range.start.column isnt 0 + + if range.start.isLessThan(currentBufferPosition) + if range.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious + beginningOfWordPosition = range.start stop() if beginningOfWordPosition? @@ -496,13 +499,12 @@ class Cursor extends Model scanRange = [currentBufferPosition, @editor.getEofBufferPosition()] endOfWordPosition = null - @editor.scanInBufferRange (options.wordRegex ? @wordRegExp(options)), scanRange, ({range, stop}) -> - if allowNext - if range.end.isGreaterThan(currentBufferPosition) - endOfWordPosition = range.end - stop() - else - if range.start.isLessThanOrEqual(currentBufferPosition) + @editor.scanInBufferRange (options.wordRegex ? @wordRegExp(options)), scanRange, ({range, matchText, stop}) -> + # Ignore 'empty line' matches between '\r' and '\n' + return if matchText is '' and range.start.column isnt 0 + + if range.end.isGreaterThan(currentBufferPosition) + if allowNext or range.start.isLessThanOrEqual(currentBufferPosition) endOfWordPosition = range.end stop() @@ -603,14 +605,14 @@ class Cursor extends Model # non-word characters in the regex. (default: true) # # Returns a {RegExp}. - wordRegExp: ({includeNonWordCharacters}={}) -> - includeNonWordCharacters ?= true - nonWordCharacters = @config.get('editor.nonWordCharacters', scope: @getScopeDescriptor()) - segments = ["\\r?\\n[\\t\\s]*\\r?\\n"] - segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+") - if includeNonWordCharacters - segments.push("[#{_.escapeRegExp(nonWordCharacters)}]+") - new RegExp(segments.join("|"), "g") + wordRegExp: (options) -> + scope = @getScopeDescriptor() + nonWordCharacters = _.escapeRegExp(@config.get('editor.nonWordCharacters', {scope})) + + source = "^[\t ]*$|[^\\s#{nonWordCharacters}]+" + if options?.includeNonWordCharacters ? true + source += "|" + "[#{nonWordCharacters}]+" + new RegExp(source, "g") # Public: Get the RegExp used by the cursor to determine what a "subword" is. # From fe5b1b70e8b0b85a3d7fa2a06fee625aca3e70ca Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Dec 2015 12:07:15 -0800 Subject: [PATCH 80/89] Fix paragraph motions in the presence of CRLF line endings --- spec/text-editor-spec.coffee | 30 +++++++++++++++++++++++++++++- src/cursor.coffee | 16 ++++++++-------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/spec/text-editor-spec.coffee b/spec/text-editor-spec.coffee index 23312ca2b..a646457fc 100644 --- a/spec/text-editor-spec.coffee +++ b/spec/text-editor-spec.coffee @@ -1080,8 +1080,36 @@ describe "TextEditor", -> editor.moveToBeginningOfNextParagraph() expect(editor.getCursorBufferPosition()).toEqual [0, 0] + it "moves the cursor before the first line of the next paragraph (CRLF line endings)", -> + editor.setText(editor.getText().replace(/\n/g, '\r\n')) + + editor.setCursorBufferPosition [0, 6] + editor.foldBufferRow(4) + + editor.moveToBeginningOfNextParagraph() + expect(editor.getCursorBufferPosition()).toEqual [10, 0] + + editor.setText("") + editor.setCursorBufferPosition [0, 0] + editor.moveToBeginningOfNextParagraph() + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + describe ".moveToBeginningOfPreviousParagraph()", -> - it "moves the cursor before the first line of the pevious paragraph", -> + it "moves the cursor before the first line of the previous paragraph", -> + editor.setCursorBufferPosition [10, 0] + editor.foldBufferRow(4) + + editor.moveToBeginningOfPreviousParagraph() + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + + editor.setText("") + editor.setCursorBufferPosition [0, 0] + editor.moveToBeginningOfPreviousParagraph() + expect(editor.getCursorBufferPosition()).toEqual [0, 0] + + it "moves the cursor before the first line of the previous paragraph (CRLF line endings)", -> + editor.setText(editor.getText().replace(/\n/g, '\r\n')) + editor.setCursorBufferPosition [10, 0] editor.foldBufferRow(4) diff --git a/src/cursor.coffee b/src/cursor.coffee index c63485fd2..5b3b23b73 100644 --- a/src/cursor.coffee +++ b/src/cursor.coffee @@ -3,6 +3,8 @@ _ = require 'underscore-plus' Model = require './model' +EmptyLineRegExp = /(\r\n[\t ]*\r\n)|(\n[\t ]*\n)/g + # Extended: The `Cursor` class represents the little blinking line identifying # where text can be inserted. # @@ -668,10 +670,9 @@ class Cursor extends Model {row, column} = eof position = new Point(row, column - 1) - @editor.scanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - unless range.start.isEqual(start) - position = range.start - stop() + @editor.scanInBufferRange EmptyLineRegExp, scanRange, ({range, stop}) -> + position = range.start.traverse(Point(1, 0)) + stop() unless position.isEqual(start) position getBeginningOfPreviousParagraphBufferPosition: -> @@ -681,8 +682,7 @@ class Cursor extends Model scanRange = [[row-1, column], [0, 0]] position = new Point(0, 0) zero = new Point(0, 0) - @editor.backwardsScanInBufferRange /^\n*$/g, scanRange, ({range, stop}) -> - unless range.start.isEqual(zero) - position = range.start - stop() + @editor.backwardsScanInBufferRange EmptyLineRegExp, scanRange, ({range, stop}) -> + position = range.start.traverse(Point(1, 0)) + stop() unless position.isEqual(start) position From 33ea4f55f5e7077b132dc2590000a365f77b763c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Thu, 3 Dec 2015 13:46:44 -0800 Subject: [PATCH 81/89] :arrow_up: autocomplete-plus --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 00fcadf25..60efc39fc 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "autocomplete-atom-api": "0.9.2", "autocomplete-css": "0.11.0", "autocomplete-html": "0.7.2", - "autocomplete-plus": "2.23.1", + "autocomplete-plus": "2.24.0", "autocomplete-snippets": "1.9.0", "autoflow": "0.26.0", "autosave": "0.23.0", From 4fc88264e314e9bcc336637ba0680ec97e0ae0ff Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 15:34:00 -0800 Subject: [PATCH 82/89] :arrow_up: language-hyperlink@0.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 693263b6f..66650e710 100644 --- a/package.json +++ b/package.json @@ -125,7 +125,7 @@ "language-git": "0.10.0", "language-go": "0.40.0", "language-html": "0.43.1", - "language-hyperlink": "0.15.0", + "language-hyperlink": "0.16.0", "language-java": "0.17.0", "language-javascript": "0.104.0", "language-json": "0.17.2", From e58ea27e911e306bc358c90dfb23876ca9c9330f Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Thu, 3 Dec 2015 15:52:13 -0800 Subject: [PATCH 83/89] :arrow_up: find-and-replace@0.192.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 66650e710..9910ad884 100644 --- a/package.json +++ b/package.json @@ -87,7 +87,7 @@ "dev-live-reload": "0.47.0", "encoding-selector": "0.21.0", "exception-reporting": "0.37.0", - "find-and-replace": "0.191.0", + "find-and-replace": "0.192.0", "fuzzy-finder": "0.93.0", "git-diff": "0.57.0", "go-to-line": "0.30.0", From a90fa150e5694f29d5b6dcd8fab4fea49e86b538 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 15:47:38 -0800 Subject: [PATCH 84/89] :arrow_up: language-toml@0.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9910ad884..b5cefa506 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "language-sql": "0.19.0", "language-text": "0.7.0", "language-todo": "0.27.0", - "language-toml": "0.17.0", + "language-toml": "0.18.0", "language-xml": "0.34.1", "language-yaml": "0.24.1" }, From b43036c323c6d01c0937ae4c39683a23ffcb7920 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 16:10:53 -0800 Subject: [PATCH 85/89] :arrow_up: language-git@0.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b5cefa506..733221e53 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "language-csharp": "0.11.0", "language-css": "0.36.0", "language-gfm": "0.81.0", - "language-git": "0.10.0", + "language-git": "0.11.0", "language-go": "0.40.0", "language-html": "0.43.1", "language-hyperlink": "0.16.0", From 834115bb073d13c8ddf1790fda73380d017faf1e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 16:11:22 -0800 Subject: [PATCH 86/89] :arrow_up: language-yaml@0.25 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 733221e53..26dbed649 100644 --- a/package.json +++ b/package.json @@ -147,7 +147,7 @@ "language-todo": "0.27.0", "language-toml": "0.18.0", "language-xml": "0.34.1", - "language-yaml": "0.24.1" + "language-yaml": "0.25.0" }, "private": true, "scripts": { From 65464225e84d25acb998a8bf2b94b645eb62144f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 16:17:46 -0800 Subject: [PATCH 87/89] :arrow_up: language-perl@0.32 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 26dbed649..b141397a2 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "language-make": "0.21.0", "language-mustache": "0.13.0", "language-objective-c": "0.15.1", - "language-perl": "0.31.0", + "language-perl": "0.32.0", "language-php": "0.34.0", "language-property-list": "0.8.0", "language-python": "0.42.1", From 5c6375d9de319a871d560d76eba06c0aa85b6b60 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 16:34:10 -0800 Subject: [PATCH 88/89] :arrow_up: language-sql@0.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b141397a2..6ba1a2d53 100644 --- a/package.json +++ b/package.json @@ -142,7 +142,7 @@ "language-sass": "0.45.0", "language-shellscript": "0.21.0", "language-source": "0.9.0", - "language-sql": "0.19.0", + "language-sql": "0.20.0", "language-text": "0.7.0", "language-todo": "0.27.0", "language-toml": "0.18.0", From d377e725e091371331bccfb05882eda0125e6b98 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 3 Dec 2015 16:36:37 -0800 Subject: [PATCH 89/89] :arrow_up: language-gfm@0.82 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ba1a2d53..5ca330287 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "language-coffee-script": "0.46.0", "language-csharp": "0.11.0", "language-css": "0.36.0", - "language-gfm": "0.81.0", + "language-gfm": "0.82.0", "language-git": "0.11.0", "language-go": "0.40.0", "language-html": "0.43.1",