From f672f8ea925b804e49b623ef4b9acddd6827928b Mon Sep 17 00:00:00 2001 From: Giuseppe Piscopo Date: Tue, 15 Sep 2015 11:44:38 +0200 Subject: [PATCH 01/73] squirrel-update test on desktop shortcut groups too many assertions Every test on desktop shortcut now tends to have 1 assertion. They have been rearranged to show more clearly what is the actual test intent. Expectation already checked somewhere else have been removed. --- spec/squirrel-update-spec.coffee | 91 +++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 32 deletions(-) diff --git a/spec/squirrel-update-spec.coffee b/spec/squirrel-update-spec.coffee index b71a9b0c4..e3891ed1c 100644 --- a/spec/squirrel-update-spec.coffee +++ b/spec/squirrel-update-spec.coffee @@ -5,25 +5,25 @@ path = require 'path' temp = require 'temp' SquirrelUpdate = require '../src/browser/squirrel-update' -describe "Windows squirrel updates", -> +describe "Windows Squirrel Update", -> tempHomeDirectory = null + originalSpawn = ChildProcess.spawn + + harmlessSpawn = -> + # Just spawn something that won't actually modify the host + if process.platform is 'win32' + originalSpawn('dir') + else + originalSpawn('ls') beforeEach -> - # Prevent the actually home directory from being manipulated + # Prevent the actual home directory from being manipulated tempHomeDirectory = temp.mkdirSync('atom-temp-home-') spyOn(fs, 'getHomeDirectory').andReturn(tempHomeDirectory) # Prevent any commands from actually running and affecting the host - originalSpawn = ChildProcess.spawn spyOn(ChildProcess, 'spawn').andCallFake (command, args) -> - if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' - fs.writeFileSync(path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk'), '') - - # Just spawn something that won't actually modify the host - if process.platform is 'win32' - originalSpawn('dir') - else - originalSpawn('ls') + harmlessSpawn() it "ignores errors spawning Squirrel", -> jasmine.unspy(ChildProcess, 'spawn') @@ -67,28 +67,55 @@ describe "Windows squirrel updates", -> runs -> expect(SquirrelUpdate.handleStartupEvent(app, '--not-squirrel')).toBe false - it "keeps the desktop shortcut deleted on updates if it was previously deleted after install", -> - desktopShortcutPath = path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk') - expect(fs.existsSync(desktopShortcutPath)).toBe false - - app = quit: jasmine.createSpy('quit') - expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-install')).toBe true - - waitsFor -> - app.quit.callCount is 1 - - runs -> - app.quit.reset() - expect(fs.existsSync(desktopShortcutPath)).toBe true - fs.removeSync(desktopShortcutPath) - expect(fs.existsSync(desktopShortcutPath)).toBe false - expect(SquirrelUpdate.handleStartupEvent(app, '--squirrel-updated')).toBe true - - waitsFor -> - app.quit.callCount is 1 - - runs -> + describe "Desktop shortcut", -> + desktopShortcutPath = '/non/existing/path' + + beforeEach -> + desktopShortcutPath = path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk') + + jasmine.unspy(ChildProcess, 'spawn') + spyOn(ChildProcess, 'spawn').andCallFake (command, args) -> + if path.basename(command) is 'Update.exe' and args?[0] is '--createShortcut' + fs.writeFileSync(path.join(tempHomeDirectory, 'Desktop', 'Atom.lnk'), '') + harmlessSpawn() + else + throw new Error("API not mocked") + + it "does not exist before install", -> expect(fs.existsSync(desktopShortcutPath)).toBe false + + describe "on install", -> + beforeEach -> + app = quit: jasmine.createSpy('quit') + SquirrelUpdate.handleStartupEvent(app, '--squirrel-install') + waitsFor -> + app.quit.callCount is 1 + + it "creates desktop shortcut", -> + expect(fs.existsSync(desktopShortcutPath)).toBe true + + describe "when shortcut is deleted and then app is updated", -> + beforeEach -> + fs.removeSync(desktopShortcutPath) + expect(fs.existsSync(desktopShortcutPath)).toBe false + + app = quit: jasmine.createSpy('quit') + SquirrelUpdate.handleStartupEvent(app, '--squirrel-updated') + waitsFor -> + app.quit.callCount is 1 + + it "does not recreate shortcut", -> + expect(fs.existsSync(desktopShortcutPath)).toBe false + + describe "when shortcut is kept and app is updated", -> + beforeEach -> + app = quit: jasmine.createSpy('quit') + SquirrelUpdate.handleStartupEvent(app, '--squirrel-updated') + waitsFor -> + app.quit.callCount is 1 + + it "still has desktop shortcut", -> + expect(fs.existsSync(desktopShortcutPath)).toBe true describe ".restartAtom", -> it "quits the app and spawns a new one", -> From 2d4474eb8b31af3c952bcb68543bb0540d849c5d Mon Sep 17 00:00:00 2001 From: Carl Henderson Date: Mon, 22 Feb 2016 15:13:38 -0500 Subject: [PATCH 02/73] search only new data for new lines rather than entire buffer --- src/buffered-process.coffee | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/buffered-process.coffee b/src/buffered-process.coffee index c7097d711..183a1d99a 100644 --- a/src/buffered-process.coffee +++ b/src/buffered-process.coffee @@ -111,11 +111,12 @@ class BufferedProcess stream.on 'data', (data) => return if @killed + bufferedLength = buffered.length buffered += data - lastNewlineIndex = buffered.lastIndexOf('\n') + lastNewlineIndex = data.lastIndexOf('\n') if lastNewlineIndex isnt -1 - onLines(buffered.substring(0, lastNewlineIndex + 1)) - buffered = buffered.substring(lastNewlineIndex + 1) + onLines(buffered.substring(0, lastNewlineIndex + bufferedLength + 1)) + buffered = buffered.substring(lastNewlineIndex + bufferedLength + 1) stream.on 'close', => return if @killed From 0d7b182c2dba7daedc605ee4a65ba2c892842c5a Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 10 Mar 2016 10:31:24 -0500 Subject: [PATCH 03/73] :arrow_up: status-bar@1.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b449d0de..353e470be 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "settings-view": "0.232.4", "snippets": "1.0.1", "spell-check": "0.67.0", - "status-bar": "1.1.0", + "status-bar": "1.1.1", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.91.3", From 501eadccca0c8aaad9f7b027c596a87e2bcd873a Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 10 Mar 2016 11:00:48 -0800 Subject: [PATCH 04/73] :arrow_up: notifications@0.62.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 353e470be..d2cb82195 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "link": "0.31.0", "markdown-preview": "0.157.3", "metrics": "0.53.1", - "notifications": "0.62.3", + "notifications": "0.62.4", "open-on-github": "1.0.0", "package-generator": "0.41.1", "settings-view": "0.232.4", From 3201d7f7469811f7ca7d38810e0bf2900dd90cd6 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 3 Mar 2016 21:15:52 -0800 Subject: [PATCH 05/73] Add basic atom.project.getEnv API --- spec/fixtures/sample.txt | 2 +- spec/project-spec.coffee | 53 ++++++++++++++++++++++++++++++++++++++++ src/project.coffee | 39 +++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/spec/fixtures/sample.txt b/spec/fixtures/sample.txt index 9701a96c5..0a2b6a502 100644 --- a/spec/fixtures/sample.txt +++ b/spec/fixtures/sample.txt @@ -1 +1 @@ -Some textSome textSome text. +Some textSome textSome textSome text. diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 499efd017..61dd244e8 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -537,3 +537,56 @@ describe "Project", -> randomPath = path.join("some", "random", "path") expect(atom.project.contains(randomPath)).toBe false + + describe ".getEnv", -> + afterEach -> + delete atom.project.env + + it "returns a copy of the environment", -> + env = atom.project.getEnv() + + env.PROJECT_GET_ENV_TESTING = "foo" + expect(process.env.PROJECT_GET_ENV_TESTING).not.toEqual "foo" + expect(atom.project.getEnv().PROJECT_GET_ENV_TESTING).not.toEqual "foo" + + describe "on platforms other than OS X", -> + beforeEach -> + spyOn(process, "platform").andReturn("foo") + + describe "when TERM is not set", -> + it "returns the PATH unchanged", -> + spyOn(process.env, "TERM").andReturn(undefined) + + expect(atom.project.getEnv().PATH).toEqual process.env.PATH + + describe "when TERM is set", -> + it "returns the PATH unchanged", -> + spyOn(process.env, "TERM").andReturn("foo") + + expect(atom.project.getEnv().PATH).toEqual process.env.PATH + + describe "on OS X", -> + beforeEach -> + spyOn(process, "platform").andReturn("darwin") + + describe "when TERM is not set", -> + it "replaces the PATH with the one obtained from the shell", -> + env = _.clone(process.env) + delete env.TERM + + spyOn(process, "env").andReturn(env) + + spyOn(atom.project, "getShellEnv").andReturn """ + FOO=BAR + TERM=xterm-something + PATH=/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist + """ + + expect(atom.project.getShellPath()).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" + expect(atom.project.getEnv().PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" + + describe "when TERM is set", -> + it "returns the PATH unchanged", -> + spyOn(process.env, "TERM").andReturn("foo") + + expect(atom.project.getEnv().PATH).toEqual process.env.PATH diff --git a/src/project.coffee b/src/project.coffee index 93a3ed496..f2ace97e2 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -12,6 +12,9 @@ TextEditor = require './text-editor' Task = require './task' GitRepositoryProvider = require './git-repository-provider' +child_process = require 'child_process' +os = require 'os' + # Extended: Represents a project that's opened in Atom. # # An instance of this class is always available as the `atom.project` global. @@ -271,6 +274,42 @@ class Project extends Model contains: (pathToCheck) -> @rootDirectories.some (dir) -> dir.contains(pathToCheck) + ### + Section: Environment + ### + + getEnv: -> + unless @env? + @env = _.clone(process.env) + if process.platform is "darwin" and not process.env.TERM? + @env.PATH = @getShellPath() + + _.clone(@env) + + getShellPath: -> + shellEnvText = @getShellEnv() + env = {} + + for line in shellEnvText.split(os.EOL) + if line.includes("=") + components = line.split("=") + if components.length is 2 + env[components[0]] = components[1] + else + k = components.shift() + v = components.join("=") + env[k] = v + + env.PATH + + getShellEnv: -> + shell = process.env.SHELL ? "/bin/bash" + results = child_process.spawnSync shell, ["--login"], input: "env", encoding: "utf8" + return if results.error? + return unless results.stdout and results.stdout.length > 0 + + results.stdout + ### Section: Private ### From a46740522d06ee9aa2af5ebde920c09a6871aa9a Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 3 Mar 2016 21:21:26 -0800 Subject: [PATCH 06/73] :memo: Add documentation for atom.project.getEnv --- src/project.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/project.coffee b/src/project.coffee index f2ace97e2..4f5dc37bc 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -278,6 +278,12 @@ class Project extends Model Section: Environment ### + # Public: Retrieves a normalized copy of the environment. + # + # On OS X, the `PATH` can be different depending on whether Atom is launched + # from the Dock, Spotlight or the terminal. This detects how Atom was started + # and corrects the `PATH` environment variable before returning a copy of the + # environment. getEnv: -> unless @env? @env = _.clone(process.env) From 2e64be6b000e7aecba237763baf69147c71441a5 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 3 Mar 2016 22:18:39 -0800 Subject: [PATCH 07/73] Move new functions to private section --- src/project.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 4f5dc37bc..d91ec3a39 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -292,6 +292,10 @@ class Project extends Model _.clone(@env) + ### + Section: Private + ### + getShellPath: -> shellEnvText = @getShellEnv() env = {} @@ -316,10 +320,6 @@ class Project extends Model results.stdout - ### - Section: Private - ### - consumeServices: ({serviceHub}) -> serviceHub.consume( 'atom.directory-provider', From 7f6fd92c7a859b573677b8fbacc907ba63c76c1d Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 7 Mar 2016 14:19:32 -0800 Subject: [PATCH 08/73] :fire: Revert change to test fixture --- spec/fixtures/sample.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/fixtures/sample.txt b/spec/fixtures/sample.txt index 0a2b6a502..9701a96c5 100644 --- a/spec/fixtures/sample.txt +++ b/spec/fixtures/sample.txt @@ -1 +1 @@ -Some textSome textSome textSome text. +Some textSome textSome text. From 9916c78ce23ffb8dde835517d9b37c2e20f38259 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 7 Mar 2016 14:27:19 -0800 Subject: [PATCH 09/73] Add --interactive option to get the user's full PATH with all the trimmings --- src/project.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.coffee b/src/project.coffee index d91ec3a39..e13942f28 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -314,7 +314,7 @@ class Project extends Model getShellEnv: -> shell = process.env.SHELL ? "/bin/bash" - results = child_process.spawnSync shell, ["--login"], input: "env", encoding: "utf8" + results = child_process.spawnSync shell, ["--login", "--interactive"], input: "env", encoding: "utf8" return if results.error? return unless results.stdout and results.stdout.length > 0 From 96b8f0ce38d4870672f89276450ae27da82dd043 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 7 Mar 2016 14:28:30 -0800 Subject: [PATCH 10/73] :memo: Add Finder to the list of ways an app can be launched --- src/project.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index e13942f28..5d5448dc7 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -281,9 +281,9 @@ class Project extends Model # Public: Retrieves a normalized copy of the environment. # # On OS X, the `PATH` can be different depending on whether Atom is launched - # from the Dock, Spotlight or the terminal. This detects how Atom was started - # and corrects the `PATH` environment variable before returning a copy of the - # environment. + # from the Dock, Finder, Spotlight or the terminal. This detects how Atom was + # started and corrects the `PATH` environment variable before returning a copy + # of the environment. getEnv: -> unless @env? @env = _.clone(process.env) From 6bf785faa0b5f795e33d53b76eeec93b504f7c72 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 7 Mar 2016 15:42:11 -0800 Subject: [PATCH 11/73] :white_check_mark: Add test for error handling --- spec/project-spec.coffee | 37 ++++++++++++++++++++++++++----------- src/project.coffee | 19 +++++++++++++++++-- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 61dd244e8..35cd0157f 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -539,7 +539,13 @@ describe "Project", -> expect(atom.project.contains(randomPath)).toBe false describe ".getEnv", -> + [originalTerm] = [] + + beforeEach -> + originalTerm = process.env.TERM + afterEach -> + process.env.TERM = originalTerm delete atom.project.env it "returns a copy of the environment", -> @@ -554,15 +560,17 @@ describe "Project", -> spyOn(process, "platform").andReturn("foo") describe "when TERM is not set", -> - it "returns the PATH unchanged", -> - spyOn(process.env, "TERM").andReturn(undefined) + beforeEach -> + delete process.env.TERM + it "returns the PATH unchanged", -> expect(atom.project.getEnv().PATH).toEqual process.env.PATH describe "when TERM is set", -> - it "returns the PATH unchanged", -> - spyOn(process.env, "TERM").andReturn("foo") + beforeEach -> + process.env.TERM = "foo" + it "returns the PATH unchanged", -> expect(atom.project.getEnv().PATH).toEqual process.env.PATH describe "on OS X", -> @@ -570,12 +578,10 @@ describe "Project", -> spyOn(process, "platform").andReturn("darwin") describe "when TERM is not set", -> + beforeEach -> + delete process.env.TERM + it "replaces the PATH with the one obtained from the shell", -> - env = _.clone(process.env) - delete env.TERM - - spyOn(process, "env").andReturn(env) - spyOn(atom.project, "getShellEnv").andReturn """ FOO=BAR TERM=xterm-something @@ -584,9 +590,18 @@ describe "Project", -> expect(atom.project.getShellPath()).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" expect(atom.project.getEnv().PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" + expect(atom.project.getEnv().FOO).not.toEqual "BAR" + + it "does the best it can when there is an error retrieving the shell environment", -> + spyOn(atom.project, "getShellEnv").andReturn(undefined) + + expect(atom.project.getShellPath()).toBeUndefined() + expect(atom.project.getEnv().PATH).not.toBeUndefined() + expect(atom.project.getEnv().PATH).toEqual process.env.PATH describe "when TERM is set", -> - it "returns the PATH unchanged", -> - spyOn(process.env, "TERM").andReturn("foo") + beforeEach -> + process.env.TERM = "foo" + it "returns the PATH unchanged", -> expect(atom.project.getEnv().PATH).toEqual process.env.PATH diff --git a/src/project.coffee b/src/project.coffee index 5d5448dc7..c8fd3ddbe 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -288,7 +288,8 @@ class Project extends Model unless @env? @env = _.clone(process.env) if process.platform is "darwin" and not process.env.TERM? - @env.PATH = @getShellPath() + shellPath = @getShellPath() + @env.PATH = shellPath if shellPath? _.clone(@env) @@ -296,8 +297,13 @@ class Project extends Model Section: Private ### + # Gets the user's configured shell `PATH`. + # + # Returns the value of `PATH` or `undefined` if there was an error. getShellPath: -> shellEnvText = @getShellEnv() + return unless shellEnvText? + env = {} for line in shellEnvText.split(os.EOL) @@ -312,9 +318,18 @@ class Project extends Model env.PATH + # Gets a dump of the user's configured shell environment. + # + # Returns the output of the `env` command or `undefined` if there was an error. getShellEnv: -> shell = process.env.SHELL ? "/bin/bash" - results = child_process.spawnSync shell, ["--login", "--interactive"], input: "env", encoding: "utf8" + + # The `-ilc` set of options was tested to work with the OS X v10.11 + # default-installed versions of bash, zsh, sh, and ksh. It *does not* + # work with csh or tcsh. Given that bash and zsh should cover the + # vast majority of users and it gracefully falls back to prior behavior, + # this should be safe. + results = child_process.spawnSync shell, ["-ilc"], input: "env", encoding: "utf8" return if results.error? return unless results.stdout and results.stdout.length > 0 From 8c53e25f802f7e5e6311a61087f78bbf4e246b20 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 7 Mar 2016 16:43:20 -0800 Subject: [PATCH 12/73] Patch process.env on startup --- spec/atom-environment-spec.coffee | 13 +++++++++++++ src/atom-environment.coffee | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index 3283b63d6..6271ea5d4 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -362,3 +362,16 @@ describe "AtomEnvironment", -> version = '1.7.0-dev-5340c91' expect(atom.getReleaseChannel()).toBe 'dev' + + describe "environment patching", -> + it "patches process.env on startup", -> + configDirPath = temp.mkdirSync() + fakeDocument = { + addEventListener: -> + removeEventListener: -> + head: document.createElement('head') + body: document.createElement('body') + } + atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, window, document: fakeDocument}) + + expect(process.env).toEqual atomEnvironment.project.getEnv() diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 8c79d66f6..d1e921d54 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -230,6 +230,10 @@ class AtomEnvironment extends Model checkPortableHomeWritable() + # Patch the `process.env` on startup to fix the problem first documented + # in #4126 + process.env = @project.getEnv() + attachSaveStateListeners: -> saveState = => @saveState({isUnloading: false}) unless @unloaded debouncedSaveState = _.debounce(saveState, @saveStateDebounceInterval) From c7465f5f7e747b5d0b182a3c66f0bd0f67bf052d Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Tue, 8 Mar 2016 15:29:48 -0800 Subject: [PATCH 13/73] Add environment module for getting environment info --- spec/environment-spec.coffee | 27 ++++++++++++++++++++++++ src/environment.coffee | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 spec/environment-spec.coffee create mode 100644 src/environment.coffee diff --git a/spec/environment-spec.coffee b/spec/environment-spec.coffee new file mode 100644 index 000000000..484bdcc1a --- /dev/null +++ b/spec/environment-spec.coffee @@ -0,0 +1,27 @@ +child_process = require('child_process') +{getShellEnv} = require("../src/environment") + +describe "Environment handling", -> + describe "when things are configured properly", -> + beforeEach -> + spyOn(child_process, "spawnSync").andReturn + stdout: """ + FOO=BAR + TERM=xterm-something + PATH=/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist + """ + + it "returns an object containing the information from the user's shell environment", -> + env = getShellEnv() + + expect(env.FOO).toEqual "BAR" + expect(env.TERM).toEqual "xterm-something" + expect(env.PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" + + describe "when an error occurs", -> + beforeEach -> + spyOn(child_process, "spawnSync").andReturn + error: new Error + + it "returns undefined", -> + expect(getShellEnv()).toBeUndefined() diff --git a/src/environment.coffee b/src/environment.coffee new file mode 100644 index 000000000..f2b9bbf47 --- /dev/null +++ b/src/environment.coffee @@ -0,0 +1,41 @@ +child_process = require('child_process') +os = require('os') + +# Gets a dump of the user's configured shell environment. +# +# Returns the output of the `env` command or `undefined` if there was an error. +getRawShellEnv = -> + shell = process.env.SHELL ? "/bin/bash" + + # The `-ilc` set of options was tested to work with the OS X v10.11 + # default-installed versions of bash, zsh, sh, and ksh. It *does not* + # work with csh or tcsh. Given that bash and zsh should cover the + # vast majority of users and it gracefully falls back to prior behavior, + # this should be safe. + results = child_process.spawnSync shell, ["-ilc"], input: "env", encoding: "utf8" + return if results.error? + return unless results.stdout and results.stdout.length > 0 + + results.stdout + +module.exports = + # Gets the user's configured shell environment. + # + # Returns a copy of the user's shell enviroment. + getShellEnv: -> + shellEnvText = getRawShellEnv() + return unless shellEnvText? + + env = {} + + for line in shellEnvText.split(os.EOL) + if line.includes("=") + components = line.split("=") + if components.length is 2 + env[components[0]] = components[1] + else + k = components.shift() + v = components.join("=") + env[k] = v + + env From a3ba15c8a13c5cc61155df9b33abdf6c5c58ddbf Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Tue, 8 Mar 2016 15:50:53 -0800 Subject: [PATCH 14/73] Update Project to use new environment module --- spec/project-spec.coffee | 20 +++++++++---------- src/project.coffee | 43 +++------------------------------------- 2 files changed, 13 insertions(+), 50 deletions(-) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index 35cd0157f..f5fcad8e3 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -8,6 +8,8 @@ BufferedProcess = require '../src/buffered-process' {Directory} = require 'pathwatcher' GitRepository = require '../src/git-repository' +environment = require '../src/environment' + describe "Project", -> beforeEach -> atom.project.setPaths([atom.project.getDirectories()[0]?.resolve('dir')]) @@ -581,21 +583,19 @@ describe "Project", -> beforeEach -> delete process.env.TERM - it "replaces the PATH with the one obtained from the shell", -> - spyOn(atom.project, "getShellEnv").andReturn """ - FOO=BAR - TERM=xterm-something - PATH=/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist - """ + it "replaces the environment with the one obtained from the shell", -> + spyOn(environment, "getShellEnv").andReturn + FOO: "BAR" + TERM: "xterm-something" + PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" - expect(atom.project.getShellPath()).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" + expect(atom.project.getEnv().TERM).toEqual "xterm-something" expect(atom.project.getEnv().PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" - expect(atom.project.getEnv().FOO).not.toEqual "BAR" + expect(atom.project.getEnv().FOO).toEqual "BAR" it "does the best it can when there is an error retrieving the shell environment", -> - spyOn(atom.project, "getShellEnv").andReturn(undefined) + spyOn(environment, "getShellEnv").andReturn(undefined) - expect(atom.project.getShellPath()).toBeUndefined() expect(atom.project.getEnv().PATH).not.toBeUndefined() expect(atom.project.getEnv().PATH).toEqual process.env.PATH diff --git a/src/project.coffee b/src/project.coffee index c8fd3ddbe..2a21aa2d8 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -288,8 +288,9 @@ class Project extends Model unless @env? @env = _.clone(process.env) if process.platform is "darwin" and not process.env.TERM? - shellPath = @getShellPath() - @env.PATH = shellPath if shellPath? + {getShellEnv} = require("../src/environment") + shellEnv = getShellEnv() + @env = shellEnv if shellEnv? _.clone(@env) @@ -297,44 +298,6 @@ class Project extends Model Section: Private ### - # Gets the user's configured shell `PATH`. - # - # Returns the value of `PATH` or `undefined` if there was an error. - getShellPath: -> - shellEnvText = @getShellEnv() - return unless shellEnvText? - - env = {} - - for line in shellEnvText.split(os.EOL) - if line.includes("=") - components = line.split("=") - if components.length is 2 - env[components[0]] = components[1] - else - k = components.shift() - v = components.join("=") - env[k] = v - - env.PATH - - # Gets a dump of the user's configured shell environment. - # - # Returns the output of the `env` command or `undefined` if there was an error. - getShellEnv: -> - shell = process.env.SHELL ? "/bin/bash" - - # The `-ilc` set of options was tested to work with the OS X v10.11 - # default-installed versions of bash, zsh, sh, and ksh. It *does not* - # work with csh or tcsh. Given that bash and zsh should cover the - # vast majority of users and it gracefully falls back to prior behavior, - # this should be safe. - results = child_process.spawnSync shell, ["-ilc"], input: "env", encoding: "utf8" - return if results.error? - return unless results.stdout and results.stdout.length > 0 - - results.stdout - consumeServices: ({serviceHub}) -> serviceHub.consume( 'atom.directory-provider', From b98388fa762e27c357613b9f8f8e2f2b0e74bd95 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Tue, 8 Mar 2016 16:23:48 -0800 Subject: [PATCH 15/73] Fix broken command parameter --- spec/environment-spec.coffee | 4 ++-- src/atom-environment.coffee | 3 ++- src/environment.coffee | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/environment-spec.coffee b/spec/environment-spec.coffee index 484bdcc1a..9eac5b071 100644 --- a/spec/environment-spec.coffee +++ b/spec/environment-spec.coffee @@ -1,7 +1,7 @@ child_process = require('child_process') {getShellEnv} = require("../src/environment") -describe "Environment handling", -> +fdescribe "Environment handling", -> describe "when things are configured properly", -> beforeEach -> spyOn(child_process, "spawnSync").andReturn @@ -21,7 +21,7 @@ describe "Environment handling", -> describe "when an error occurs", -> beforeEach -> spyOn(child_process, "spawnSync").andReturn - error: new Error + error: new Error("testing when an error occurs") it "returns undefined", -> expect(getShellEnv()).toBeUndefined() diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index d1e921d54..e43051571 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -231,7 +231,8 @@ class AtomEnvironment extends Model checkPortableHomeWritable() # Patch the `process.env` on startup to fix the problem first documented - # in #4126 + # in #4126. Retain the original in case someone needs it. + process._originalEnv = process.env process.env = @project.getEnv() attachSaveStateListeners: -> diff --git a/src/environment.coffee b/src/environment.coffee index f2b9bbf47..56de0c194 100644 --- a/src/environment.coffee +++ b/src/environment.coffee @@ -12,7 +12,7 @@ getRawShellEnv = -> # work with csh or tcsh. Given that bash and zsh should cover the # vast majority of users and it gracefully falls back to prior behavior, # this should be safe. - results = child_process.spawnSync shell, ["-ilc"], input: "env", encoding: "utf8" + results = child_process.spawnSync(shell, ["-ilc", "env"], encoding: "utf8") return if results.error? return unless results.stdout and results.stdout.length > 0 From 6b38049b8d10deb9abf66fbdb19d2280e04075f2 Mon Sep 17 00:00:00 2001 From: Joe Fitzgerald Date: Thu, 10 Mar 2016 15:16:41 -0700 Subject: [PATCH 16/73] Remove Project API, Work With process.env Directly - Convert environment.coffee and environment-spec.coffee to JavaScript - Pass the process's environment across the wire when launching atom multiple times from the command line --- spec/atom-environment-spec.coffee | 13 -- spec/environment-spec.coffee | 27 ---- spec/environment-spec.js | 161 +++++++++++++++++++++++ spec/project-spec.coffee | 68 ---------- src/atom-environment.coffee | 7 +- src/browser/atom-application.coffee | 29 ++-- src/browser/main.coffee | 1 + src/environment.coffee | 41 ------ src/environment.js | 94 +++++++++++++ src/initialize-application-window.coffee | 3 +- src/project.coffee | 20 --- 11 files changed, 275 insertions(+), 189 deletions(-) delete mode 100644 spec/environment-spec.coffee create mode 100644 spec/environment-spec.js delete mode 100644 src/environment.coffee create mode 100644 src/environment.js diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index 6271ea5d4..3283b63d6 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -362,16 +362,3 @@ describe "AtomEnvironment", -> version = '1.7.0-dev-5340c91' expect(atom.getReleaseChannel()).toBe 'dev' - - describe "environment patching", -> - it "patches process.env on startup", -> - configDirPath = temp.mkdirSync() - fakeDocument = { - addEventListener: -> - removeEventListener: -> - head: document.createElement('head') - body: document.createElement('body') - } - atomEnvironment = new AtomEnvironment({applicationDelegate: atom.applicationDelegate, window, document: fakeDocument}) - - expect(process.env).toEqual atomEnvironment.project.getEnv() diff --git a/spec/environment-spec.coffee b/spec/environment-spec.coffee deleted file mode 100644 index 9eac5b071..000000000 --- a/spec/environment-spec.coffee +++ /dev/null @@ -1,27 +0,0 @@ -child_process = require('child_process') -{getShellEnv} = require("../src/environment") - -fdescribe "Environment handling", -> - describe "when things are configured properly", -> - beforeEach -> - spyOn(child_process, "spawnSync").andReturn - stdout: """ - FOO=BAR - TERM=xterm-something - PATH=/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist - """ - - it "returns an object containing the information from the user's shell environment", -> - env = getShellEnv() - - expect(env.FOO).toEqual "BAR" - expect(env.TERM).toEqual "xterm-something" - expect(env.PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" - - describe "when an error occurs", -> - beforeEach -> - spyOn(child_process, "spawnSync").andReturn - error: new Error("testing when an error occurs") - - it "returns undefined", -> - expect(getShellEnv()).toBeUndefined() diff --git a/spec/environment-spec.js b/spec/environment-spec.js new file mode 100644 index 000000000..ae36d7d2c --- /dev/null +++ b/spec/environment-spec.js @@ -0,0 +1,161 @@ +'use babel' +/* eslint-env jasmine */ + +import child_process from 'child_process' +import environment from '../src/environment' +import os from 'os' +import _ from 'underscore-plus' + +fdescribe('Environment handling', () => { + let originalEnv + let options + + beforeEach(() => { + originalEnv = process.env + delete process._originalEnv + options = { + platform: process.platform, + env: _.clone(process.env) + } + }) + + afterEach(() => { + process.env = originalEnv + delete process._originalEnv + }) + + describe('on OSX, when PWD is not set', () => { + beforeEach(() => { + options.platform = 'darwin' + }) + + describe('needsPatching', () => { + it('returns true if PWD is unset', () => { + delete options.env.PWD + expect(environment.needsPatching(options)).toBe(true) + options.env.PWD = undefined + expect(environment.needsPatching(options)).toBe(true) + options.env.PWD = null + expect(environment.needsPatching(options)).toBe(true) + options.env.PWD = false + expect(environment.needsPatching(options)).toBe(true) + }) + + it('returns false if PWD is set', () => { + options.env.PWD = 'xterm' + expect(environment.needsPatching(options)).toBe(false) + }) + }) + + describe('normalize', () => { + it('changes process.env if PWD is unset', () => { + if (process.platform === 'win32') { + return + } + delete options.env.PWD + environment.normalize(options) + expect(process._originalEnv).toBeDefined() + expect(process._originalEnv).toBeTruthy() + expect(process.env).toBeDefined() + expect(process.env).toBeTruthy() + expect(process.env.PWD).toBeDefined() + expect(process.env.PWD).toBeTruthy() + expect(process.env.PATH).toBeDefined() + expect(process.env.PATH).toBeTruthy() + expect(process.env.ATOM_HOME).toBeDefined() + expect(process.env.ATOM_HOME).toBeTruthy() + }) + }) + }) + + describe('on a platform other than OSX', () => { + beforeEach(() => { + options.platform = 'penguin' + }) + + describe('needsPatching', () => { + it('returns false if PWD is set or unset', () => { + delete options.env.PWD + expect(environment.needsPatching(options)).toBe(false) + options.env.PWD = undefined + expect(environment.needsPatching(options)).toBe(false) + options.env.PWD = null + expect(environment.needsPatching(options)).toBe(false) + options.env.PWD = false + expect(environment.needsPatching(options)).toBe(false) + options.env.PWD = '/' + expect(environment.needsPatching(options)).toBe(false) + }) + + it('returns false for linux', () => { + options.platform = 'linux' + options.PWD = '/' + expect(environment.needsPatching(options)).toBe(false) + }) + + it('returns false for windows', () => { + options.platform = 'win32' + options.PWD = 'c:\\' + expect(environment.needsPatching(options)).toBe(false) + }) + }) + + describe('normalize', () => { + it('does not change the environment', () => { + if (process.platform === 'win32') { + return + } + delete options.env.PWD + environment.normalize(options) + expect(process._originalEnv).toBeUndefined() + expect(process.env).toBeDefined() + expect(process.env).toBeTruthy() + expect(process.env.PATH).toBeDefined() + expect(process.env.PATH).toBeTruthy() + expect(process.env.PWD).toBeUndefined() + expect(process.env.PATH).toBe(originalEnv.PATH) + expect(process.env.ATOM_HOME).toBeDefined() + expect(process.env.ATOM_HOME).toBeTruthy() + }) + }) + }) + + describe('getFromShell', () => { + describe('when things are configured properly', () => { + beforeEach(() => { + spyOn(child_process, 'spawnSync').andReturn({ + stdout: 'FOO=BAR' + os.EOL + 'TERM=xterm-something' + os.EOL + + 'PATH=/usr/bin:/bin:/usr/sbin:/sbin:/crazy/path' + }) + }) + + it('returns an object containing the information from the user\'s shell environment', () => { + let env = environment.getFromShell() + expect(env.FOO).toEqual('BAR') + expect(env.TERM).toEqual('xterm-something') + expect(env.PATH).toEqual('/usr/bin:/bin:/usr/sbin:/sbin:/crazy/path') + }) + }) + + describe('when an error occurs launching the shell', () => { + beforeEach(() => { + spyOn(child_process, 'spawnSync').andReturn({ + error: new Error('testing when an error occurs') + }) + }) + + it('returns undefined', () => { + expect(environment.getFromShell()).toBeUndefined() + }) + + it('leaves the environment as-is when normalize() is called', () => { + options.platform = 'darwin' + delete options.env.PWD + expect(environment.needsPatching(options)).toBe(true) + environment.normalize(options) + expect(process.env).toBeDefined() + expect(process._originalEnv).toBeUndefined() + }) + }) + }) +}) diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee index f5fcad8e3..499efd017 100644 --- a/spec/project-spec.coffee +++ b/spec/project-spec.coffee @@ -8,8 +8,6 @@ BufferedProcess = require '../src/buffered-process' {Directory} = require 'pathwatcher' GitRepository = require '../src/git-repository' -environment = require '../src/environment' - describe "Project", -> beforeEach -> atom.project.setPaths([atom.project.getDirectories()[0]?.resolve('dir')]) @@ -539,69 +537,3 @@ describe "Project", -> randomPath = path.join("some", "random", "path") expect(atom.project.contains(randomPath)).toBe false - - describe ".getEnv", -> - [originalTerm] = [] - - beforeEach -> - originalTerm = process.env.TERM - - afterEach -> - process.env.TERM = originalTerm - delete atom.project.env - - it "returns a copy of the environment", -> - env = atom.project.getEnv() - - env.PROJECT_GET_ENV_TESTING = "foo" - expect(process.env.PROJECT_GET_ENV_TESTING).not.toEqual "foo" - expect(atom.project.getEnv().PROJECT_GET_ENV_TESTING).not.toEqual "foo" - - describe "on platforms other than OS X", -> - beforeEach -> - spyOn(process, "platform").andReturn("foo") - - describe "when TERM is not set", -> - beforeEach -> - delete process.env.TERM - - it "returns the PATH unchanged", -> - expect(atom.project.getEnv().PATH).toEqual process.env.PATH - - describe "when TERM is set", -> - beforeEach -> - process.env.TERM = "foo" - - it "returns the PATH unchanged", -> - expect(atom.project.getEnv().PATH).toEqual process.env.PATH - - describe "on OS X", -> - beforeEach -> - spyOn(process, "platform").andReturn("darwin") - - describe "when TERM is not set", -> - beforeEach -> - delete process.env.TERM - - it "replaces the environment with the one obtained from the shell", -> - spyOn(environment, "getShellEnv").andReturn - FOO: "BAR" - TERM: "xterm-something" - PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" - - expect(atom.project.getEnv().TERM).toEqual "xterm-something" - expect(atom.project.getEnv().PATH).toEqual "/usr/bin:/bin:/usr/sbin:/sbin:/some/crazy/path/entry/that/should/not/exist" - expect(atom.project.getEnv().FOO).toEqual "BAR" - - it "does the best it can when there is an error retrieving the shell environment", -> - spyOn(environment, "getShellEnv").andReturn(undefined) - - expect(atom.project.getEnv().PATH).not.toBeUndefined() - expect(atom.project.getEnv().PATH).toEqual process.env.PATH - - describe "when TERM is set", -> - beforeEach -> - process.env.TERM = "foo" - - it "returns the PATH unchanged", -> - expect(atom.project.getEnv().PATH).toEqual process.env.PATH diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index e43051571..97ec3c5d4 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -4,6 +4,7 @@ path = require 'path' _ = require 'underscore-plus' {deprecate} = require 'grim' +environment = require('./environment') {CompositeDisposable, Disposable, Emitter} = require 'event-kit' fs = require 'fs-plus' {mapSourcePosition} = require 'source-map-support' @@ -127,6 +128,7 @@ class AtomEnvironment extends Model # Call .loadOrCreate instead constructor: (params={}) -> + environment.normalize(params) {@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params @unloaded = false @@ -230,11 +232,6 @@ class AtomEnvironment extends Model checkPortableHomeWritable() - # Patch the `process.env` on startup to fix the problem first documented - # in #4126. Retain the original in case someone needs it. - process._originalEnv = process.env - process.env = @project.getEnv() - attachSaveStateListeners: -> saveState = => @saveState({isUnloading: false}) unless @unloaded debouncedSaveState = _.debounce(saveState, @saveStateDebounceInterval) diff --git a/src/browser/atom-application.coffee b/src/browser/atom-application.coffee index 230e1bb9f..4767c9065 100644 --- a/src/browser/atom-application.coffee +++ b/src/browser/atom-application.coffee @@ -85,16 +85,16 @@ class AtomApplication else @loadState(options) or @openPath(options) - openWithOptions: ({initialPaths, pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, logFile, profileStartup, timeout, clearWindowState, addToLastWindow}) -> + openWithOptions: ({initialPaths, pathsToOpen, executedFrom, urlsToOpen, test, pidToKillWhenClosed, devMode, safeMode, newWindow, logFile, profileStartup, timeout, clearWindowState, addToLastWindow, env}) -> if test - @runTests({headless: true, devMode, @resourcePath, executedFrom, pathsToOpen, logFile, timeout}) + @runTests({headless: true, devMode, @resourcePath, executedFrom, pathsToOpen, logFile, timeout, env}) else if pathsToOpen.length > 0 - @openPaths({initialPaths, pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, clearWindowState, addToLastWindow}) + @openPaths({initialPaths, pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, clearWindowState, addToLastWindow, env}) else if urlsToOpen.length > 0 - @openUrl({urlToOpen, devMode, safeMode}) for urlToOpen in urlsToOpen + @openUrl({urlToOpen, devMode, safeMode, env}) for urlToOpen in urlsToOpen else # Always open a editor window if this is the first instance of Atom. - @openPath({initialPaths, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, clearWindowState, addToLastWindow}) + @openPath({initialPaths, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, clearWindowState, addToLastWindow, env}) # Public: Removes the {AtomWindow} from the global window list. removeWindow: (window) -> @@ -134,7 +134,8 @@ class AtomApplication @deleteSocketFile() server = net.createServer (connection) => connection.on 'data', (data) => - @openWithOptions(JSON.parse(data)) + options = JSON.parse(data) + @openWithOptions(options) server.listen @socketPath server.on 'error', (error) -> console.error 'Application server failed', error @@ -418,8 +419,8 @@ class AtomApplication # :profileStartup - Boolean to control creating a profile of the startup time. # :window - {AtomWindow} to open file paths in. # :addToLastWindow - Boolean of whether this should be opened in last focused window. - openPath: ({initialPaths, pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window, clearWindowState, addToLastWindow} = {}) -> - @openPaths({initialPaths, pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window, clearWindowState, addToLastWindow}) + openPath: ({initialPaths, pathToOpen, pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window, clearWindowState, addToLastWindow, env} = {}) -> + @openPaths({initialPaths, pathsToOpen: [pathToOpen], pidToKillWhenClosed, newWindow, devMode, safeMode, profileStartup, window, clearWindowState, addToLastWindow, env}) # Public: Opens multiple paths, in existing windows if possible. # @@ -432,7 +433,7 @@ class AtomApplication # :windowDimensions - Object with height and width keys. # :window - {AtomWindow} to open file paths in. # :addToLastWindow - Boolean of whether this should be opened in last focused window. - openPaths: ({initialPaths, pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, profileStartup, window, clearWindowState, addToLastWindow}={}) -> + openPaths: ({initialPaths, pathsToOpen, executedFrom, pidToKillWhenClosed, newWindow, devMode, safeMode, windowDimensions, profileStartup, window, clearWindowState, addToLastWindow, env}={}) -> devMode = Boolean(devMode) safeMode = Boolean(safeMode) clearWindowState = Boolean(clearWindowState) @@ -469,7 +470,7 @@ class AtomApplication windowInitializationScript ?= require.resolve('../initialize-application-window') resourcePath ?= @resourcePath windowDimensions ?= @getDimensionsForNewWindow() - openedWindow = new AtomWindow({initialPaths, locationsToOpen, windowInitializationScript, resourcePath, devMode, safeMode, windowDimensions, profileStartup, clearWindowState}) + openedWindow = new AtomWindow({initialPaths, locationsToOpen, windowInitializationScript, resourcePath, devMode, safeMode, windowDimensions, profileStartup, clearWindowState, env}) if pidToKillWhenClosed? @pidsToOpenWindows[pidToKillWhenClosed] = openedWindow @@ -532,7 +533,7 @@ class AtomApplication # :urlToOpen - The atom:// url to open. # :devMode - Boolean to control the opened window's dev mode. # :safeMode - Boolean to control the opened window's safe mode. - openUrl: ({urlToOpen, devMode, safeMode}) -> + openUrl: ({urlToOpen, devMode, safeMode, env}) -> unless @packages? PackageManager = require '../package-manager' @packages = new PackageManager @@ -547,7 +548,7 @@ class AtomApplication packagePath = @packages.resolvePackagePath(packageName) windowInitializationScript = path.resolve(packagePath, pack.urlMain) windowDimensions = @getDimensionsForNewWindow() - new AtomWindow({windowInitializationScript, @resourcePath, devMode, safeMode, urlToOpen, windowDimensions}) + new AtomWindow({windowInitializationScript, @resourcePath, devMode, safeMode, urlToOpen, windowDimensions, env}) else console.log "Package '#{pack.name}' does not have a url main: #{urlToOpen}" else @@ -562,7 +563,7 @@ class AtomApplication # :specPath - The directory to load specs from. # :safeMode - A Boolean that, if true, won't run specs from ~/.atom/packages # and ~/.atom/dev/packages, defaults to false. - runTests: ({headless, resourcePath, executedFrom, pathsToOpen, logFile, safeMode, timeout}) -> + runTests: ({headless, resourcePath, executedFrom, pathsToOpen, logFile, safeMode, timeout, env}) -> if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath) resourcePath = @resourcePath @@ -592,7 +593,7 @@ class AtomApplication devMode = true isSpec = true safeMode ?= false - new AtomWindow({windowInitializationScript, resourcePath, headless, isSpec, devMode, testRunnerPath, legacyTestRunnerPath, testPaths, logFile, safeMode}) + new AtomWindow({windowInitializationScript, resourcePath, headless, isSpec, devMode, testRunnerPath, legacyTestRunnerPath, testPaths, logFile, safeMode, env}) resolveTestRunnerPath: (testPath) -> FindParentDir ?= require 'find-parent-dir' diff --git a/src/browser/main.coffee b/src/browser/main.coffee index b4df62bd6..6bf8817f9 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -13,6 +13,7 @@ console.log = require 'nslog' start = -> args = parseCommandLine() + args.env = process.env setupAtomHome(args) setupCompileCache() return if handleStartupEventWithSquirrel() diff --git a/src/environment.coffee b/src/environment.coffee deleted file mode 100644 index 56de0c194..000000000 --- a/src/environment.coffee +++ /dev/null @@ -1,41 +0,0 @@ -child_process = require('child_process') -os = require('os') - -# Gets a dump of the user's configured shell environment. -# -# Returns the output of the `env` command or `undefined` if there was an error. -getRawShellEnv = -> - shell = process.env.SHELL ? "/bin/bash" - - # The `-ilc` set of options was tested to work with the OS X v10.11 - # default-installed versions of bash, zsh, sh, and ksh. It *does not* - # work with csh or tcsh. Given that bash and zsh should cover the - # vast majority of users and it gracefully falls back to prior behavior, - # this should be safe. - results = child_process.spawnSync(shell, ["-ilc", "env"], encoding: "utf8") - return if results.error? - return unless results.stdout and results.stdout.length > 0 - - results.stdout - -module.exports = - # Gets the user's configured shell environment. - # - # Returns a copy of the user's shell enviroment. - getShellEnv: -> - shellEnvText = getRawShellEnv() - return unless shellEnvText? - - env = {} - - for line in shellEnvText.split(os.EOL) - if line.includes("=") - components = line.split("=") - if components.length is 2 - env[components[0]] = components[1] - else - k = components.shift() - v = components.join("=") - env[k] = v - - env diff --git a/src/environment.js b/src/environment.js new file mode 100644 index 000000000..00c112bda --- /dev/null +++ b/src/environment.js @@ -0,0 +1,94 @@ +'use babel' + +import {spawnSync} from 'child_process' +import os from 'os' + +// Gets a dump of the user's configured shell environment. +// +// Returns the output of the `env` command or `undefined` if there was an error. +function getRawShellEnv () { + let shell = getUserShell() + + // The `-ilc` set of options was tested to work with the OS X v10.11 + // default-installed versions of bash, zsh, sh, and ksh. It *does not* + // work with csh or tcsh. + let results = spawnSync(shell, ['-ilc', 'env'], {encoding: 'utf8'}) + if (results.error || !results.stdout || results.stdout.length <= 0) { + return + } + + return results.stdout +} + +function getUserShell () { + if (process.env.SHELL) { + return process.env.SHELL + } + + return '/bin/bash' +} + +// Gets the user's configured shell environment. +// +// Returns a copy of the user's shell enviroment. +function getFromShell () { + let shellEnvText = getRawShellEnv() + if (!shellEnvText) { + return + } + + let env = {} + + for (let line of shellEnvText.split(os.EOL)) { + if (line.includes('=')) { + let components = line.split('=') + if (components.length === 2) { + env[components[0]] = components[1] + } else { + let k = components.shift() + let v = components.join('=') + env[k] = v + } + } + } + + return env +} + +function needsPatching (options = { platform: process.platform, env: process.env }) { + if (options.platform === 'darwin' && !options.env.PWD) { + let shell = getUserShell() + if (shell.endsWith('csh') || shell.endsWith('tcsh')) { + return false + } + return true + } + + return false +} + +function normalize (options = {}) { + if (options && options.env) { + process.env = options.env + } + + if (!options.env) { + options.env = process.env + } + + if (!options.platform) { + options.platform = process.platform + } + + if (needsPatching(options)) { + // Patch the `process.env` on startup to fix the problem first documented + // in #4126. Retain the original in case someone needs it. + let shellEnv = getFromShell() + if (shellEnv && shellEnv.PATH) { + process._originalEnv = process.env + process.env = shellEnv + } + } +} + +export default { getFromShell, needsPatching, normalize } diff --git a/src/initialize-application-window.coffee b/src/initialize-application-window.coffee index cea4e1c3c..10f321ded 100644 --- a/src/initialize-application-window.coffee +++ b/src/initialize-application-window.coffee @@ -4,7 +4,7 @@ module.exports = ({blobStore}) -> require './window' {getWindowLoadSettings} = require './window-load-settings-helpers' - {resourcePath, isSpec, devMode} = getWindowLoadSettings() + {resourcePath, isSpec, devMode, env} = getWindowLoadSettings() # Add application-specific exports to module search path. exportsPath = path.join(resourcePath, 'exports') @@ -21,6 +21,7 @@ module.exports = ({blobStore}) -> applicationDelegate: new ApplicationDelegate, configDirPath: process.env.ATOM_HOME enablePersistence: true + env: env }) atom.startEditorWindow().then -> diff --git a/src/project.coffee b/src/project.coffee index 2a21aa2d8..340075a1b 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -274,26 +274,6 @@ class Project extends Model contains: (pathToCheck) -> @rootDirectories.some (dir) -> dir.contains(pathToCheck) - ### - Section: Environment - ### - - # Public: Retrieves a normalized copy of the environment. - # - # On OS X, the `PATH` can be different depending on whether Atom is launched - # from the Dock, Finder, Spotlight or the terminal. This detects how Atom was - # started and corrects the `PATH` environment variable before returning a copy - # of the environment. - getEnv: -> - unless @env? - @env = _.clone(process.env) - if process.platform is "darwin" and not process.env.TERM? - {getShellEnv} = require("../src/environment") - shellEnv = getShellEnv() - @env = shellEnv if shellEnv? - - _.clone(@env) - ### Section: Private ### From 87c20bd0958f410ac0a7b05e4ad48a77043edd8b Mon Sep 17 00:00:00 2001 From: Joe Fitzgerald Date: Thu, 10 Mar 2016 15:46:25 -0700 Subject: [PATCH 17/73] Remove Cruft --- src/project.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/project.coffee b/src/project.coffee index 340075a1b..93a3ed496 100644 --- a/src/project.coffee +++ b/src/project.coffee @@ -12,9 +12,6 @@ TextEditor = require './text-editor' Task = require './task' GitRepositoryProvider = require './git-repository-provider' -child_process = require 'child_process' -os = require 'os' - # Extended: Represents a project that's opened in Atom. # # An instance of this class is always available as the `atom.project` global. From 4e2db07dd96c13c966f84a86c01ec3ca9d7048cd Mon Sep 17 00:00:00 2001 From: simurai Date: Fri, 11 Mar 2016 10:13:31 +0900 Subject: [PATCH 18/73] :arrow_up: markdown-preview@v0.158.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2cb82195..0194a5ad4 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "keybinding-resolver": "0.35.0", "line-ending-selector": "0.3.1", "link": "0.31.0", - "markdown-preview": "0.157.3", + "markdown-preview": "0.158.0", "metrics": "0.53.1", "notifications": "0.62.4", "open-on-github": "1.0.0", From 61fb12bf9aae6729c6eb2220b3f689382777a4e5 Mon Sep 17 00:00:00 2001 From: Joe Fitzgerald Date: Thu, 10 Mar 2016 19:59:26 -0700 Subject: [PATCH 19/73] Unfocus Spec --- spec/environment-spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/environment-spec.js b/spec/environment-spec.js index ae36d7d2c..8d845a3f8 100644 --- a/spec/environment-spec.js +++ b/spec/environment-spec.js @@ -6,7 +6,7 @@ import environment from '../src/environment' import os from 'os' import _ from 'underscore-plus' -fdescribe('Environment handling', () => { +describe('Environment handling', () => { let originalEnv let options From bd4ef0a44381a6445d17063ff944bc91fd54a1ce Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Thu, 10 Mar 2016 20:17:19 -0800 Subject: [PATCH 20/73] :arrow_up: tabs@0.92.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2cb82195..0b823926b 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "status-bar": "1.1.1", "styleguide": "0.45.2", "symbols-view": "0.112.0", - "tabs": "0.91.3", + "tabs": "0.92.0", "timecop": "0.33.1", "tree-view": "0.203.0", "update-package-dependencies": "0.10.0", From 383174d3803ef5e5ce658be1a94529516836b0b6 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Thu, 10 Mar 2016 21:27:10 -0800 Subject: [PATCH 21/73] Load apm path from config Signed-off-by: Katrina Uychaco --- spec/package-manager-spec.coffee | 14 ++++++++++++++ src/package-manager.coffee | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/spec/package-manager-spec.coffee b/spec/package-manager-spec.coffee index 3b54691b2..6a1610a8a 100644 --- a/spec/package-manager-spec.coffee +++ b/spec/package-manager-spec.coffee @@ -17,6 +17,20 @@ describe "PackageManager", -> beforeEach -> workspaceElement = atom.views.getView(atom.workspace) + describe "::getApmPath()", -> + it "returns the path to the apm command", -> + apmPath = path.join(process.resourcesPath, "app", "apm", "bin", "apm") + if process.platform is 'win32' + apmPath += ".cmd" + expect(atom.packages.getApmPath()).toBe apmPath + + describe "when the core.apmPath setting is set", -> + beforeEach -> + atom.config.set("core.apmPath", "/path/to/apm") + + it "returns the value of the core.apmPath config setting", -> + expect(atom.packages.getApmPath()).toBe "/path/to/apm" + describe "::loadPackage(name)", -> beforeEach -> atom.config.set("core.disabledPackages", []) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index 94b55a793..0e76a762f 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -128,8 +128,12 @@ class PackageManager # Public: Get the path to the apm command. # + # Uses the value of the `core.apmPath` config setting if it exists. + # # Return a {String} file path to apm. getApmPath: -> + configPath = atom.config.get('core.apmPath') + return configPath if configPath return @apmPath if @apmPath? commandName = 'apm' From 466e554ee19cb90e3b0eb5f23924721b6ac4bb9f Mon Sep 17 00:00:00 2001 From: Willem Van Lint Date: Wed, 2 Mar 2016 22:35:33 -0800 Subject: [PATCH 22/73] Add TextEditors to the registry on opt-in only --- src/text-editor.coffee | 6 ++++-- src/workspace.coffee | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 5e384fde1..8b503f16e 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -83,8 +83,9 @@ class TextEditor extends Model state.assert = atomEnvironment.assert.bind(atomEnvironment) state.applicationDelegate = atomEnvironment.applicationDelegate editor = new this(state) - disposable = atomEnvironment.textEditors.add(editor) - editor.onDidDestroy -> disposable.dispose() + if state.registered + disposable = atomEnvironment.textEditors.add(editor) + editor.onDidDestroy -> disposable.dispose() editor constructor: (params={}) -> @@ -155,6 +156,7 @@ class TextEditor extends Model firstVisibleScreenColumn: @getFirstVisibleScreenColumn() displayBuffer: @displayBuffer.serialize() selectionsMarkerLayerId: @selectionsMarkerLayer.id + registered: atom.textEditors.editors.has this subscribeToBuffer: -> @buffer.retain() diff --git a/src/workspace.coffee b/src/workspace.coffee index c925a495a..bdaf19eee 100644 --- a/src/workspace.coffee +++ b/src/workspace.coffee @@ -542,7 +542,10 @@ class Workspace extends Model throw error @project.bufferForPath(filePath, options).then (buffer) => - @buildTextEditor(_.extend({buffer, largeFileMode}, options)) + editor = @buildTextEditor(_.extend({buffer, largeFileMode}, options)) + disposable = atom.textEditors.add(editor) + editor.onDidDestroy -> disposable.dispose() + editor # Public: Returns a {Boolean} that is `true` if `object` is a `TextEditor`. # @@ -558,10 +561,7 @@ class Workspace extends Model @config, @notificationManager, @packageManager, @clipboard, @viewRegistry, @grammarRegistry, @project, @assert, @applicationDelegate }, params) - editor = new TextEditor(params) - disposable = atom.textEditors.add(editor) - editor.onDidDestroy -> disposable.dispose() - editor + new TextEditor(params) # Public: Asynchronously reopens the last-closed item's URI if it hasn't already been # reopened. From edd91839a86dd9498a32a1ad2991a8f925f19685 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 11 Mar 2016 13:34:03 -0800 Subject: [PATCH 23/73] :arrow_up: language-ruby@0.68.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 417a46c76..77f54798b 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "language-php": "0.37.0", "language-property-list": "0.8.0", "language-python": "0.43.0", - "language-ruby": "0.68.1", + "language-ruby": "0.68.2", "language-ruby-on-rails": "0.25.0", "language-sass": "0.45.0", "language-shellscript": "0.21.0", From f671d5c5cdc6921c24bd73aea9c6edd30a1ce253 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Fri, 11 Mar 2016 17:32:13 -0500 Subject: [PATCH 24/73] :arrow_up: language-ruby@0.68.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77f54798b..4612c9745 100644 --- a/package.json +++ b/package.json @@ -138,7 +138,7 @@ "language-php": "0.37.0", "language-property-list": "0.8.0", "language-python": "0.43.0", - "language-ruby": "0.68.2", + "language-ruby": "0.68.3", "language-ruby-on-rails": "0.25.0", "language-sass": "0.45.0", "language-shellscript": "0.21.0", From 63ec05416165bb75179b30562a900133c03bcf53 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 11 Mar 2016 16:51:50 -0800 Subject: [PATCH 25/73] Rename environment -> environmentHelpers --- ...nt-spec.js => environment-helpers-spec.js} | 38 +++++++++---------- src/atom-environment.coffee | 4 +- ...{environment.js => environment-helpers.js} | 0 3 files changed, 21 insertions(+), 21 deletions(-) rename spec/{environment-spec.js => environment-helpers-spec.js} (76%) rename src/{environment.js => environment-helpers.js} (100%) diff --git a/spec/environment-spec.js b/spec/environment-helpers-spec.js similarity index 76% rename from spec/environment-spec.js rename to spec/environment-helpers-spec.js index 8d845a3f8..4d0e7d4aa 100644 --- a/spec/environment-spec.js +++ b/spec/environment-helpers-spec.js @@ -2,7 +2,7 @@ /* eslint-env jasmine */ import child_process from 'child_process' -import environment from '../src/environment' +import environmentHelpers from '../src/environment-helpers' import os from 'os' import _ from 'underscore-plus' @@ -32,18 +32,18 @@ describe('Environment handling', () => { describe('needsPatching', () => { it('returns true if PWD is unset', () => { delete options.env.PWD - expect(environment.needsPatching(options)).toBe(true) + expect(environmentHelpers.needsPatching(options)).toBe(true) options.env.PWD = undefined - expect(environment.needsPatching(options)).toBe(true) + expect(environmentHelpers.needsPatching(options)).toBe(true) options.env.PWD = null - expect(environment.needsPatching(options)).toBe(true) + expect(environmentHelpers.needsPatching(options)).toBe(true) options.env.PWD = false - expect(environment.needsPatching(options)).toBe(true) + expect(environmentHelpers.needsPatching(options)).toBe(true) }) it('returns false if PWD is set', () => { options.env.PWD = 'xterm' - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) }) }) @@ -53,7 +53,7 @@ describe('Environment handling', () => { return } delete options.env.PWD - environment.normalize(options) + environmentHelpers.normalize(options) expect(process._originalEnv).toBeDefined() expect(process._originalEnv).toBeTruthy() expect(process.env).toBeDefined() @@ -76,27 +76,27 @@ describe('Environment handling', () => { describe('needsPatching', () => { it('returns false if PWD is set or unset', () => { delete options.env.PWD - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) options.env.PWD = undefined - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) options.env.PWD = null - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) options.env.PWD = false - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) options.env.PWD = '/' - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) }) it('returns false for linux', () => { options.platform = 'linux' options.PWD = '/' - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) }) it('returns false for windows', () => { options.platform = 'win32' options.PWD = 'c:\\' - expect(environment.needsPatching(options)).toBe(false) + expect(environmentHelpers.needsPatching(options)).toBe(false) }) }) @@ -106,7 +106,7 @@ describe('Environment handling', () => { return } delete options.env.PWD - environment.normalize(options) + environmentHelpers.normalize(options) expect(process._originalEnv).toBeUndefined() expect(process.env).toBeDefined() expect(process.env).toBeTruthy() @@ -130,7 +130,7 @@ describe('Environment handling', () => { }) it('returns an object containing the information from the user\'s shell environment', () => { - let env = environment.getFromShell() + let env = environmentHelpers.getFromShell() expect(env.FOO).toEqual('BAR') expect(env.TERM).toEqual('xterm-something') expect(env.PATH).toEqual('/usr/bin:/bin:/usr/sbin:/sbin:/crazy/path') @@ -145,14 +145,14 @@ describe('Environment handling', () => { }) it('returns undefined', () => { - expect(environment.getFromShell()).toBeUndefined() + expect(environmentHelpers.getFromShell()).toBeUndefined() }) it('leaves the environment as-is when normalize() is called', () => { options.platform = 'darwin' delete options.env.PWD - expect(environment.needsPatching(options)).toBe(true) - environment.normalize(options) + expect(environmentHelpers.needsPatching(options)).toBe(true) + environmentHelpers.normalize(options) expect(process.env).toBeDefined() expect(process._originalEnv).toBeUndefined() }) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 97ec3c5d4..a173443ce 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -4,7 +4,7 @@ path = require 'path' _ = require 'underscore-plus' {deprecate} = require 'grim' -environment = require('./environment') +environmentHelpers = require('./environment-helpers') {CompositeDisposable, Disposable, Emitter} = require 'event-kit' fs = require 'fs-plus' {mapSourcePosition} = require 'source-map-support' @@ -128,7 +128,7 @@ class AtomEnvironment extends Model # Call .loadOrCreate instead constructor: (params={}) -> - environment.normalize(params) + environmentHelpers.normalize(params) {@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params @unloaded = false diff --git a/src/environment.js b/src/environment-helpers.js similarity index 100% rename from src/environment.js rename to src/environment-helpers.js From 01a1a1d80c104300dc57842a54caddbb69433424 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Fri, 11 Mar 2016 16:57:02 -0800 Subject: [PATCH 26/73] Swap _.clone for Object.assign --- spec/environment-helpers-spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/environment-helpers-spec.js b/spec/environment-helpers-spec.js index 4d0e7d4aa..20ec15d9f 100644 --- a/spec/environment-helpers-spec.js +++ b/spec/environment-helpers-spec.js @@ -4,7 +4,6 @@ import child_process from 'child_process' import environmentHelpers from '../src/environment-helpers' import os from 'os' -import _ from 'underscore-plus' describe('Environment handling', () => { let originalEnv @@ -15,7 +14,7 @@ describe('Environment handling', () => { delete process._originalEnv options = { platform: process.platform, - env: _.clone(process.env) + env: Object.assign({}, process.env) } }) From c99a272f0166c5063ab281cc54c0921da96e911a Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sat, 12 Mar 2016 16:10:45 -0500 Subject: [PATCH 27/73] :arrow_up: language-json@0.17.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4612c9745..748cf9840 100644 --- a/package.json +++ b/package.json @@ -129,7 +129,7 @@ "language-hyperlink": "0.16.0", "language-java": "0.17.0", "language-javascript": "0.110.0", - "language-json": "0.17.5", + "language-json": "0.17.6", "language-less": "0.29.0", "language-make": "0.21.0", "language-mustache": "0.13.0", From 4798d6d7ce5e44ec16f0121e344bee94f7cdfc80 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sun, 13 Mar 2016 13:18:14 -0400 Subject: [PATCH 28/73] :arrow_up: tree-view@0.203.1 Refs #10983 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 748cf9840..efaca8685 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "symbols-view": "0.112.0", "tabs": "0.92.0", "timecop": "0.33.1", - "tree-view": "0.203.0", + "tree-view": "0.203.1", "update-package-dependencies": "0.10.0", "welcome": "0.34.0", "whitespace": "0.32.2", From ad91f0ffc20331962099793ac4f757122f5fffd5 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sun, 13 Mar 2016 15:55:39 -0400 Subject: [PATCH 29/73] :arrow_up: packages to fix Electron deprecations about@1.4.1 link@0.31.1 open-on-github@1.0.1 settings-view@0.232.5 Refs atom/atom#10983 --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index efaca8685..8d1c6371a 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "one-light-syntax": "1.2.0", "solarized-dark-syntax": "1.0.0", "solarized-light-syntax": "1.0.0", - "about": "1.4.0", + "about": "1.4.1", "archive-view": "0.61.1", "autocomplete-atom-api": "0.10.0", "autocomplete-css": "0.11.0", @@ -98,13 +98,13 @@ "incompatible-packages": "0.25.1", "keybinding-resolver": "0.35.0", "line-ending-selector": "0.3.1", - "link": "0.31.0", + "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", "notifications": "0.62.4", - "open-on-github": "1.0.0", + "open-on-github": "1.0.1", "package-generator": "0.41.1", - "settings-view": "0.232.4", + "settings-view": "0.232.5", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.1.1", From 579b6b7a04180d0476b849a808f6c0002f194682 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Sun, 13 Mar 2016 18:02:50 -0400 Subject: [PATCH 30/73] :arrow_up: settings-view@0.232.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d1c6371a..cbff93802 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "notifications": "0.62.4", "open-on-github": "1.0.1", "package-generator": "0.41.1", - "settings-view": "0.232.5", + "settings-view": "0.232.6", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.1.1", From ed744c12a9d9d0a7945504f07919216b5f5346a0 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Mon, 14 Mar 2016 08:43:16 -0700 Subject: [PATCH 31/73] Move location of call to environmentHelpers.normalize --- src/atom-environment.coffee | 2 -- src/initialize-application-window.coffee | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index a173443ce..8c79d66f6 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -4,7 +4,6 @@ path = require 'path' _ = require 'underscore-plus' {deprecate} = require 'grim' -environmentHelpers = require('./environment-helpers') {CompositeDisposable, Disposable, Emitter} = require 'event-kit' fs = require 'fs-plus' {mapSourcePosition} = require 'source-map-support' @@ -128,7 +127,6 @@ class AtomEnvironment extends Model # Call .loadOrCreate instead constructor: (params={}) -> - environmentHelpers.normalize(params) {@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params @unloaded = false diff --git a/src/initialize-application-window.coffee b/src/initialize-application-window.coffee index 10f321ded..ea811f515 100644 --- a/src/initialize-application-window.coffee +++ b/src/initialize-application-window.coffee @@ -1,11 +1,15 @@ # Like sands through the hourglass, so are the days of our lives. module.exports = ({blobStore}) -> + environmentHelpers = require('./environment-helpers') path = require 'path' require './window' {getWindowLoadSettings} = require './window-load-settings-helpers' {resourcePath, isSpec, devMode, env} = getWindowLoadSettings() + # Set baseline environment + environmentHelpers.normalize({env: env}) + # Add application-specific exports to module search path. exportsPath = path.join(resourcePath, 'exports') require('module').globalPaths.push(exportsPath) From d1c8fff86c89e326847385da623f13c64534c2b7 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 13:42:05 -0400 Subject: [PATCH 32/73] Pull line length out into its own variable. --- src/buffered-process.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/buffered-process.coffee b/src/buffered-process.coffee index 183a1d99a..53934c02d 100644 --- a/src/buffered-process.coffee +++ b/src/buffered-process.coffee @@ -115,8 +115,9 @@ class BufferedProcess buffered += data lastNewlineIndex = data.lastIndexOf('\n') if lastNewlineIndex isnt -1 - onLines(buffered.substring(0, lastNewlineIndex + bufferedLength + 1)) - buffered = buffered.substring(lastNewlineIndex + bufferedLength + 1) + lineLength = lastNewlineIndex + bufferedLength + 1 + onLines(buffered.substring(0, lineLength)) + buffered = buffered.substring(lineLength) stream.on 'close', => return if @killed From 66971abe25e9ec1aed48d7bcbfabe4d8f0ba7bee Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 14:12:31 -0400 Subject: [PATCH 33/73] Don't need that trailing space. --- spec/buffered-process-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/buffered-process-spec.coffee b/spec/buffered-process-spec.coffee index 04cff0b6d..dd166f0dc 100644 --- a/spec/buffered-process-spec.coffee +++ b/spec/buffered-process-spec.coffee @@ -97,7 +97,7 @@ describe "BufferedProcess", -> expect(ChildProcess.spawn.argsForCall[0][1][1]).toBe '/c' expect(ChildProcess.spawn.argsForCall[0][1][2]).toBe '"dir"' - it "calls the specified stdout, stderr, and exit callbacks ", -> + it "calls the specified stdout, stderr, and exit callbacks", -> stdout = '' stderr = '' exitCallback = jasmine.createSpy('exit callback') From d441da9c38a0629ce022f4e5e4013ad1b41daf9e Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 14:12:47 -0400 Subject: [PATCH 34/73] Test it with a lot of content. --- spec/buffered-process-spec.coffee | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/buffered-process-spec.coffee b/spec/buffered-process-spec.coffee index dd166f0dc..3d1a66bf8 100644 --- a/spec/buffered-process-spec.coffee +++ b/spec/buffered-process-spec.coffee @@ -114,3 +114,26 @@ describe "BufferedProcess", -> runs -> expect(stderr).toContain 'apm - Atom Package Manager' expect(stdout).toEqual '' + + it "calls the specified stdout callback only with whole lines", -> + exitCallback = jasmine.createSpy('exit callback') + baseContent = "There are dozens of us! Dozens! It's as Ann as the nose on Plain's face. Can you believe that the only reason the club is going under is because it's in a terrifying neighborhood? She calls it a Mayonegg. Waiting for the Emmys. BTW did you know won 6 Emmys and was still canceled early by Fox? COME ON. I'll buy you a hundred George Michaels that you can teach to drive! Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'" + content = (baseContent for _ in [1..200]).join('\n') + outputAlwaysEndsWithStew = true + process = new BufferedProcess + command: '/bin/echo' + args: [content] + options: {} + stdout: (lines) -> + endLength = 10 + end = baseContent.substr(baseContent.length - endLength, endLength) + lineEndsWithStew = lines.substr(lines.length - endLength, endLength) is end + expect(lineEndsWithStew).toBeTrue + + outputAlwaysEndsWithStew = outputAlwaysEndsWithStew && lineEndsWithStew + exit: exitCallback + + waitsFor -> exitCallback.callCount is 1 + + runs -> + expect(outputAlwaysEndsWithStew).toBeTrue From 3601c1c2a869ac1d1d5fc73e9873384c6dde0b86 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 14:18:06 -0400 Subject: [PATCH 35/73] Test the whole output too. --- spec/buffered-process-spec.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/buffered-process-spec.coffee b/spec/buffered-process-spec.coffee index 3d1a66bf8..fbaee801f 100644 --- a/spec/buffered-process-spec.coffee +++ b/spec/buffered-process-spec.coffee @@ -119,13 +119,16 @@ describe "BufferedProcess", -> exitCallback = jasmine.createSpy('exit callback') baseContent = "There are dozens of us! Dozens! It's as Ann as the nose on Plain's face. Can you believe that the only reason the club is going under is because it's in a terrifying neighborhood? She calls it a Mayonegg. Waiting for the Emmys. BTW did you know won 6 Emmys and was still canceled early by Fox? COME ON. I'll buy you a hundred George Michaels that you can teach to drive! Never once touched my per diem. I'd go to Craft Service, get some raw veggies, bacon, Cup-A-Soup…baby, I got a stew goin'" content = (baseContent for _ in [1..200]).join('\n') + stdout = '' + endLength = 10 outputAlwaysEndsWithStew = true process = new BufferedProcess command: '/bin/echo' args: [content] options: {} stdout: (lines) -> - endLength = 10 + stdout += lines + end = baseContent.substr(baseContent.length - endLength, endLength) lineEndsWithStew = lines.substr(lines.length - endLength, endLength) is end expect(lineEndsWithStew).toBeTrue @@ -137,3 +140,4 @@ describe "BufferedProcess", -> runs -> expect(outputAlwaysEndsWithStew).toBeTrue + expect(stdout).toBe content += '\n' From e69b3bb839e534bed55f2128a5e0eb4be99c12ae Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 14 Mar 2016 11:17:59 -0700 Subject: [PATCH 36/73] :arrow_up: tree-view Signed-off-by: Katrina Uychaco (cherry picked from commit 70728d8e94b06bb7fc98f5a67e54511fe2208363) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbff93802..6798d6d02 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "symbols-view": "0.112.0", "tabs": "0.92.0", "timecop": "0.33.1", - "tree-view": "0.203.1", + "tree-view": "0.203.2", "update-package-dependencies": "0.10.0", "welcome": "0.34.0", "whitespace": "0.32.2", From 0c67fd61ffb0250f556a317496c6a2588aeae1fe Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 14:57:58 -0400 Subject: [PATCH 37/73] Hi lint. --- spec/buffered-process-spec.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/buffered-process-spec.coffee b/spec/buffered-process-spec.coffee index fbaee801f..1f524d66a 100644 --- a/spec/buffered-process-spec.coffee +++ b/spec/buffered-process-spec.coffee @@ -133,7 +133,7 @@ describe "BufferedProcess", -> lineEndsWithStew = lines.substr(lines.length - endLength, endLength) is end expect(lineEndsWithStew).toBeTrue - outputAlwaysEndsWithStew = outputAlwaysEndsWithStew && lineEndsWithStew + outputAlwaysEndsWithStew = outputAlwaysEndsWithStew and lineEndsWithStew exit: exitCallback waitsFor -> exitCallback.callCount is 1 From 50f8f8e7e9770a857ec534a7cfb9d6837ffb56ff Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 16:28:36 -0400 Subject: [PATCH 38/73] Match GitRepository's responses to null paths. Fixes https://github.com/atom/git-diff/issues/93. --- src/git-repository-async.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index f80f46a13..3b33a5003 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -442,6 +442,9 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to a {Boolean} that's true if the `path` // is ignored. isPathIgnored (_path) { + // NB: We're matching the behavior of `GitRepository` here. + if (!_path) return Promise.resolve(false) + return this.getRepo() .then(repo => { const relativePath = this.relativize(_path, repo.workdir()) @@ -518,6 +521,10 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to a status {Number} or null if the // path is not in the cache. getCachedPathStatus (_path) { + // NB: I don't love this, but we're matching the behavior of + // `GitRepository` here for API compatibility. + if (!_path) return null + return this.relativizeToWorkingDirectory(_path) .then(relativePath => this.pathStatusCache[relativePath]) } From a2a6ed05c5dcafa37668884f4b00bba9873b644e Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 14 Mar 2016 16:40:55 -0400 Subject: [PATCH 39/73] And again. --- src/git-repository-async.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 3b33a5003..d0903acd8 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -660,6 +660,11 @@ export default class GitRepositoryAsync { } return this._diffBlobToBuffer(blob, text, options) }) + .catch(e => { + // NB: I don't love this, but we're matching the behavior of + // `GitRepository` here for API compatibility. + return {} + }) } // Checking Out From 164b363a32494b6adc14c43707546db692a78e05 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 14 Mar 2016 20:26:37 -0400 Subject: [PATCH 40/73] :arrow_up: language-csharp@0.12.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6798d6d02..e98962865 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "language-c": "0.51.1", "language-clojure": "0.19.1", "language-coffee-script": "0.46.1", - "language-csharp": "0.11.0", + "language-csharp": "0.12.0", "language-css": "0.36.0", "language-gfm": "0.85.0", "language-git": "0.12.1", From 9c8d947628ea186eb4c98ffe80c1e0bd1c824831 Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Mon, 14 Mar 2016 22:33:56 -0400 Subject: [PATCH 41/73] :arrow_up: language-clojure@0.20.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e98962865..e0332ffa6 100644 --- a/package.json +++ b/package.json @@ -118,7 +118,7 @@ "whitespace": "0.32.2", "wrap-guide": "0.38.1", "language-c": "0.51.1", - "language-clojure": "0.19.1", + "language-clojure": "0.20.0", "language-coffee-script": "0.46.1", "language-csharp": "0.12.0", "language-css": "0.36.0", From 1457e27249252668a81291a39cbd97e7d39c4f0c Mon Sep 17 00:00:00 2001 From: Wliu <50Wliu@users.noreply.github.com> Date: Tue, 15 Mar 2016 09:56:03 -0400 Subject: [PATCH 42/73] :arrow_up: language-sass@0.46.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0332ffa6..8d42f8d5a 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "language-python": "0.43.0", "language-ruby": "0.68.3", "language-ruby-on-rails": "0.25.0", - "language-sass": "0.45.0", + "language-sass": "0.46.0", "language-shellscript": "0.21.0", "language-source": "0.9.0", "language-sql": "0.20.0", From 0a6e51f665910c2d36e40dbda978b77e49c2e549 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 10:35:44 -0400 Subject: [PATCH 43/73] :arrow_up: package-generator@1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8d42f8d5a..398caecf9 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "metrics": "0.53.1", "notifications": "0.62.4", "open-on-github": "1.0.1", - "package-generator": "0.41.1", + "package-generator": "1.0.0", "settings-view": "0.232.6", "snippets": "1.0.1", "spell-check": "0.67.0", From 34698d57687a78ffe76136c3e69f95026c8fe400 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 10:43:57 -0400 Subject: [PATCH 44/73] Revert "And again." This reverts commit a2a6ed05c5dcafa37668884f4b00bba9873b644e. --- src/git-repository-async.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index d0903acd8..3b33a5003 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -660,11 +660,6 @@ export default class GitRepositoryAsync { } return this._diffBlobToBuffer(blob, text, options) }) - .catch(e => { - // NB: I don't love this, but we're matching the behavior of - // `GitRepository` here for API compatibility. - return {} - }) } // Checking Out From 8f9ab771a79d7b9f26604ed5333943de03e0b690 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 10:44:00 -0400 Subject: [PATCH 45/73] Revert "Match GitRepository's responses to null paths." This reverts commit 50f8f8e7e9770a857ec534a7cfb9d6837ffb56ff. --- src/git-repository-async.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 3b33a5003..f80f46a13 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -442,9 +442,6 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to a {Boolean} that's true if the `path` // is ignored. isPathIgnored (_path) { - // NB: We're matching the behavior of `GitRepository` here. - if (!_path) return Promise.resolve(false) - return this.getRepo() .then(repo => { const relativePath = this.relativize(_path, repo.workdir()) @@ -521,10 +518,6 @@ export default class GitRepositoryAsync { // Returns a {Promise} which resolves to a status {Number} or null if the // path is not in the cache. getCachedPathStatus (_path) { - // NB: I don't love this, but we're matching the behavior of - // `GitRepository` here for API compatibility. - if (!_path) return null - return this.relativizeToWorkingDirectory(_path) .then(relativePath => this.pathStatusCache[relativePath]) } From 15b13e3ddc15d608d5c839a9ee160a3d1a6b56a8 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 10:49:36 -0400 Subject: [PATCH 46/73] Note the changes to GitRepository. --- src/git-repository-async.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index f80f46a13..c5984eed4 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -15,6 +15,12 @@ const submoduleMode = 57344 // TODO: compose this from libgit2 constants // Just using this for _.isEqual and _.object, we should impl our own here import _ from 'underscore-plus' +// For the most part, this class behaves the same as `GitRepository`, with a few +// notable differences: +// * Errors are generally propagated out to the caller instead of being +// swallowed within `GitRepositoryAsync`. +// * Methods accepting a path shouldn't be given a null path, unless it is +// specifically allowed as noted in the method's documentation. export default class GitRepositoryAsync { static open (path, options = {}) { // QUESTION: Should this wrap Git.Repository and reject with a nicer message? From 047a62f9e15608e5d71b42966d96682530a25c6e Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 12:05:16 -0400 Subject: [PATCH 47/73] :arrow_up: git-diff@1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 398caecf9..b36a3614b 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "exception-reporting": "0.37.0", "find-and-replace": "0.197.4", "fuzzy-finder": "1.0.3", - "git-diff": "1.0.0", + "git-diff": "1.0.1", "go-to-line": "0.30.0", "grammar-selector": "0.48.1", "image-view": "0.57.0", From 147518d86dcf6a413eb31d8502465a433a1a3c3c Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 12:05:24 -0400 Subject: [PATCH 48/73] :arrow_up: status-bar@1.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b36a3614b..d9a22fd07 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "settings-view": "0.232.6", "snippets": "1.0.1", "spell-check": "0.67.0", - "status-bar": "1.1.1", + "status-bar": "1.1.2", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.92.0", From 7703240bdff0f0aad5640556ace0bd5e11eae700 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Mar 2016 13:59:07 -0400 Subject: [PATCH 49/73] :arrow_up: notifications@0.63.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d9a22fd07..351d91cd4 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", - "notifications": "0.62.4", + "notifications": "0.63.0", "open-on-github": "1.0.1", "package-generator": "1.0.0", "settings-view": "0.232.6", From 1d149c8f92f37934c7bdd9e1501b15f3eb6905e4 Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Tue, 15 Mar 2016 16:36:54 -0700 Subject: [PATCH 50/73] :arrow_up: apm Signed-off-by: Michelle Tilley --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 4b599bc39..2f0fcf519 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "1.7.1" + "atom-package-manager": "1.8.0" } } From 627adc673934254345dbe9d73a97acb9df6a72bf Mon Sep 17 00:00:00 2001 From: Katrina Uychaco Date: Tue, 15 Mar 2016 16:41:11 -0700 Subject: [PATCH 51/73] :arrow_up: settings-view Signed-off-by: Michelle Tilley --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 351d91cd4..0ec40757d 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "notifications": "0.63.0", "open-on-github": "1.0.1", "package-generator": "1.0.0", - "settings-view": "0.232.6", + "settings-view": "0.233.0", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.1.2", From 690397c91c3e3d485f2ef71de894871d02d2bd56 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 16 Mar 2016 11:57:49 -0400 Subject: [PATCH 52/73] :arrow_up: notifications@0.63.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ec40757d..b766d9b4f 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", - "notifications": "0.63.0", + "notifications": "0.63.1", "open-on-github": "1.0.1", "package-generator": "1.0.0", "settings-view": "0.233.0", From f48069c5f848b5ae624b110a1df7800e919eb142 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 16 Mar 2016 12:40:40 -0400 Subject: [PATCH 53/73] :arrow_up: settings@0.234.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b766d9b4f..a3246926f 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "notifications": "0.63.1", "open-on-github": "1.0.1", "package-generator": "1.0.0", - "settings-view": "0.233.0", + "settings-view": "0.234.0", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.1.2", From 215f1207897cb9faa4de7c187b155be1a20e869d Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 10:34:02 -0400 Subject: [PATCH 54/73] :arrow_up: status-bar@1.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3246926f..6a5c18986 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "settings-view": "0.234.0", "snippets": "1.0.1", "spell-check": "0.67.0", - "status-bar": "1.1.2", + "status-bar": "1.2.0", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.92.0", From e3a5a93b88e4ff9bbee47c26d72b8cd24fea87e1 Mon Sep 17 00:00:00 2001 From: Daniel Hengeveld Date: Thu, 17 Mar 2016 15:45:24 +0100 Subject: [PATCH 55/73] :arrow_up: settings@0.235.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3246926f..29df10850 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "notifications": "0.63.1", "open-on-github": "1.0.1", "package-generator": "1.0.0", - "settings-view": "0.234.0", + "settings-view": "0.235.0", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.1.2", From 292233f6cba59e1133cf41e297a9b1a5ce7e711a Mon Sep 17 00:00:00 2001 From: Hubot Date: Thu, 17 Mar 2016 12:11:31 -0500 Subject: [PATCH 56/73] 1.8.0-dev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c75ef505d..4a6f1504d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "atom", "productName": "Atom", - "version": "1.7.0-dev", + "version": "1.8.0-dev", "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { From acbd34931259f6d0364409c0520d4ae037fdcbe4 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 13:43:06 -0400 Subject: [PATCH 57/73] Revert ":arrow_up: status-bar@1.2.0" This reverts commit 215f1207897cb9faa4de7c187b155be1a20e869d. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4a6f1504d..4d1a1e7e8 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "settings-view": "0.235.0", "snippets": "1.0.1", "spell-check": "0.67.0", - "status-bar": "1.2.0", + "status-bar": "1.1.2", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.92.0", From ffe13db768c8d8df52005737ccc8fa44ada14d51 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 15:51:33 -0400 Subject: [PATCH 58/73] Revert "Revert ":arrow_up: status-bar@1.2.0"" This reverts commit acbd34931259f6d0364409c0520d4ae037fdcbe4. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d1a1e7e8..4a6f1504d 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "settings-view": "0.235.0", "snippets": "1.0.1", "spell-check": "0.67.0", - "status-bar": "1.1.2", + "status-bar": "1.2.0", "styleguide": "0.45.2", "symbols-view": "0.112.0", "tabs": "0.92.0", From 4e9fa72fd115294cbd3292ecbfe321c9928d51f8 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Thu, 17 Mar 2016 13:06:53 -0700 Subject: [PATCH 59/73] :arrow_up: about --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4d1a1e7e8..8160c0bae 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "one-light-syntax": "1.2.0", "solarized-dark-syntax": "1.0.0", "solarized-light-syntax": "1.0.0", - "about": "1.4.1", + "about": "1.4.2", "archive-view": "0.61.1", "autocomplete-atom-api": "0.10.0", "autocomplete-css": "0.11.0", From 7863ffbac7162f5f61ee011aa0a0a16d03e7dca1 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 22:03:16 -0400 Subject: [PATCH 60/73] :arrow_up: incompatible-packages@0.26 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4a6f1504d..30f0d8281 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "go-to-line": "0.30.0", "grammar-selector": "0.48.1", "image-view": "0.57.0", - "incompatible-packages": "0.25.1", + "incompatible-packages": "0.26", "keybinding-resolver": "0.35.0", "line-ending-selector": "0.3.1", "link": "0.31.1", From 85526198f7a31fa742ca087b428476b362f164ee Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 22:03:26 -0400 Subject: [PATCH 61/73] :arrow_up: line-ending-selector@0.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30f0d8281..6cc55f0f8 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "image-view": "0.57.0", "incompatible-packages": "0.26", "keybinding-resolver": "0.35.0", - "line-ending-selector": "0.3.1", + "line-ending-selector": "0.4", "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", From 145396a73f6068a2179f029d21fd082c2bd63732 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 22:05:15 -0400 Subject: [PATCH 62/73] Hwoops --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 6cc55f0f8..bf59741d0 100644 --- a/package.json +++ b/package.json @@ -95,9 +95,9 @@ "go-to-line": "0.30.0", "grammar-selector": "0.48.1", "image-view": "0.57.0", - "incompatible-packages": "0.26", + "incompatible-packages": "0.26.0", "keybinding-resolver": "0.35.0", - "line-ending-selector": "0.4", + "line-ending-selector": "0.4.0", "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", From 1c5ad8db0fa56bf689a66d6dafb7417866007859 Mon Sep 17 00:00:00 2001 From: Robert Fruchtman Date: Thu, 17 Mar 2016 19:11:07 -0700 Subject: [PATCH 63/73] destory -> destroy --- 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 38d4839b0..97139f6bb 100644 --- a/spec/workspace-spec.coffee +++ b/spec/workspace-spec.coffee @@ -624,7 +624,7 @@ describe "Workspace", -> expect(pane.getItems()).toEqual [editor1, editor2] describe "when replacing a pending item which is the last item in a second pane", -> - it "does not destory the pane even if core.destroyEmptyPanes is on", -> + it "does not destroy the pane even if core.destroyEmptyPanes is on", -> atom.config.set('core.destroyEmptyPanes', true) editor1 = null editor2 = null From 543015af9795a42790ebf6594ee82506474956a8 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 22:19:38 -0400 Subject: [PATCH 64/73] :arrow_up: incompatible-packages@0.26.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf59741d0..27ebb38a6 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "go-to-line": "0.30.0", "grammar-selector": "0.48.1", "image-view": "0.57.0", - "incompatible-packages": "0.26.0", + "incompatible-packages": "0.26.1", "keybinding-resolver": "0.35.0", "line-ending-selector": "0.4.0", "link": "0.31.1", From dd5886e135369689094946d35463483039b6afd9 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 17 Mar 2016 22:19:48 -0400 Subject: [PATCH 65/73] :arrow_up: line-ending-selector@0.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 27ebb38a6..16e84fc62 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "image-view": "0.57.0", "incompatible-packages": "0.26.1", "keybinding-resolver": "0.35.0", - "line-ending-selector": "0.4.0", + "line-ending-selector": "0.4.1", "link": "0.31.1", "markdown-preview": "0.158.0", "metrics": "0.53.1", From bb8f114dcb432f9424db1654e6cb4e6c37283c33 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Fri, 18 Mar 2016 09:56:33 -0700 Subject: [PATCH 66/73] Remove an unnecessary call to then(). I see that this file has a little use of async/await and many uses of `then()`. Things would be much less verbose and much more linear if async/await were used throughout. Would Atom be open to a PR that changes this? For bonus points, we could also replace `'use babel'` with `/* @flow */` at the top of the file :) --- src/git-repository-async.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/git-repository-async.js b/src/git-repository-async.js index c5984eed4..82546b525 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -158,8 +158,7 @@ export default class GitRepositoryAsync { if (!this.projectAtRoot) { this.projectAtRoot = this.getRepo() - .then(repo => this.project.relativize(repo.workdir())) - .then(relativePath => relativePath === '') + .then(repo => this.project.relativize(repo.workdir()) === '') } return this.projectAtRoot From 5c03894227dca96e6a630acb07da6c9596f910c9 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Sun, 20 Mar 2016 22:22:33 -0700 Subject: [PATCH 67/73] Revert "Allow pasting white space when `autoIndentOnPaste` is enabled" This reverts commit 0088053de47b5ec0566eedcd24fd7393e7ddc1a6. --- src/selection.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selection.coffee b/src/selection.coffee index e208ea55a..b89772f57 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -378,7 +378,7 @@ class Selection extends Model indentAdjustment = @editor.indentLevelForLine(precedingText) - options.indentBasis @adjustIndent(remainingLines, indentAdjustment) - if options.autoIndent and NonWhitespaceRegExp.test(text) and not NonWhitespaceRegExp.test(precedingText) and remainingLines.length > 0 + if options.autoIndent and not NonWhitespaceRegExp.test(precedingText) and remainingLines.length > 0 autoIndentFirstLine = true firstLine = precedingText + firstInsertedLine desiredIndentLevel = @editor.languageMode.suggestedIndentForLineAtBufferRow(oldBufferRange.start.row, firstLine) From 32a1d21a0debe14f159b3cbf945827d4fb7bdf30 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 21 Mar 2016 14:03:25 -0700 Subject: [PATCH 68/73] :arrow_up: apm --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 2f0fcf519..8ab76e484 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "1.8.0" + "atom-package-manager": "1.9.0" } } From 439825ea37b3e420328cd8d61c15014865a1ad5a Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 21 Mar 2016 14:32:45 -0700 Subject: [PATCH 69/73] :arrow_up: settings-view --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c0d8f7ba..b6752d56e 100644 --- a/package.json +++ b/package.json @@ -104,7 +104,7 @@ "notifications": "0.63.1", "open-on-github": "1.0.1", "package-generator": "1.0.0", - "settings-view": "0.235.0", + "settings-view": "0.235.1", "snippets": "1.0.1", "spell-check": "0.67.0", "status-bar": "1.2.0", From c5ed25a1315c4b66593415077ef84248ecf8a2a4 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 21 Mar 2016 15:32:42 -0700 Subject: [PATCH 70/73] :arrow_up: apm --- apm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apm/package.json b/apm/package.json index 8ab76e484..ba3415e1d 100644 --- a/apm/package.json +++ b/apm/package.json @@ -6,6 +6,6 @@ "url": "https://github.com/atom/atom.git" }, "dependencies": { - "atom-package-manager": "1.9.0" + "atom-package-manager": "1.9.1" } } From fd17457c172838c0a919ff74944ba68ab9770391 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 21 Mar 2016 17:15:27 -0600 Subject: [PATCH 71/73] Revert "Add spec for inserting white-space-only lines" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 746afb98ade993c5598ab8e80413825accbcaf82. @BinaryMuse Heads up this is the test associated with the other commit you reverted. Had to revert it as well to get the build green. Didn’t see a revert on beta so I’m assuming this is good enough? --- spec/selection-spec.coffee | 8 -------- 1 file changed, 8 deletions(-) diff --git a/spec/selection-spec.coffee b/spec/selection-spec.coffee index 319e2d438..ec40e32cc 100644 --- a/spec/selection-spec.coffee +++ b/spec/selection-spec.coffee @@ -83,11 +83,3 @@ describe "Selection", -> selection.setBufferRange([[2, 0], [2, 10]]) selection.destroy() expect(selection.marker.isDestroyed()).toBeTruthy() - - describe ".insertText(text, options)", -> - it "allows pasting white space only lines when autoIndent is enabled", -> - selection.setBufferRange [[0, 0], [0, 0]] - selection.insertText(" \n \n\n", autoIndent: true) - expect(buffer.lineForRow(0)).toBe " " - expect(buffer.lineForRow(1)).toBe " " - expect(buffer.lineForRow(2)).toBe "" From 449abd73646af35e7ef4830450963ca1c2b7fb38 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 21 Mar 2016 16:27:41 -0700 Subject: [PATCH 72/73] Revert "Revert "Add spec for inserting white-space-only lines"" This reverts commit fd17457c172838c0a919ff74944ba68ab9770391. --- spec/selection-spec.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/selection-spec.coffee b/spec/selection-spec.coffee index ec40e32cc..319e2d438 100644 --- a/spec/selection-spec.coffee +++ b/spec/selection-spec.coffee @@ -83,3 +83,11 @@ describe "Selection", -> selection.setBufferRange([[2, 0], [2, 10]]) selection.destroy() expect(selection.marker.isDestroyed()).toBeTruthy() + + describe ".insertText(text, options)", -> + it "allows pasting white space only lines when autoIndent is enabled", -> + selection.setBufferRange [[0, 0], [0, 0]] + selection.insertText(" \n \n\n", autoIndent: true) + expect(buffer.lineForRow(0)).toBe " " + expect(buffer.lineForRow(1)).toBe " " + expect(buffer.lineForRow(2)).toBe "" From 64308bbacb5f253562a059cfce6853859a859cd1 Mon Sep 17 00:00:00 2001 From: Michelle Tilley Date: Mon, 21 Mar 2016 16:27:48 -0700 Subject: [PATCH 73/73] Revert "Revert "Allow pasting white space when `autoIndentOnPaste` is enabled"" This reverts commit 5c03894227dca96e6a630acb07da6c9596f910c9. --- src/selection.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selection.coffee b/src/selection.coffee index b89772f57..e208ea55a 100644 --- a/src/selection.coffee +++ b/src/selection.coffee @@ -378,7 +378,7 @@ class Selection extends Model indentAdjustment = @editor.indentLevelForLine(precedingText) - options.indentBasis @adjustIndent(remainingLines, indentAdjustment) - if options.autoIndent and not NonWhitespaceRegExp.test(precedingText) and remainingLines.length > 0 + if options.autoIndent and NonWhitespaceRegExp.test(text) and not NonWhitespaceRegExp.test(precedingText) and remainingLines.length > 0 autoIndentFirstLine = true firstLine = precedingText + firstInsertedLine desiredIndentLevel = @editor.languageMode.suggestedIndentForLineAtBufferRow(oldBufferRange.start.row, firstLine)