Skip to content

Commit

Permalink
Merge branch 'master' into as-main-process-test-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Scandurra committed May 25, 2016
2 parents df0b3de + 64f25f9 commit 5e3f343
Show file tree
Hide file tree
Showing 21 changed files with 111 additions and 72 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ Unsure where to begin contributing to Atom? You can start by looking through the

Both issue lists are sorted by total number of comments. While not perfect, number of comments is a reasonable proxy for impact a given change will have.

If you want to read about using Atom or developing packages in Atom, the [Atom Flight Manual](http://flight-manual.atom.io) is free and available online. You can find the source to the manual in [atom/flight-manual.atom.io](https://github.com/atom/flight-manual.atom.io).

### Pull Requests

* Include screenshots and animated GIFs in your pull request whenever possible.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ By participating, you are expected to uphold this code. Please report unacceptab

## Documentation

If you want to read about using Atom or developing packages in Atom, the [Atom Flight Manual](https://atom.io/docs/latest/) is free and available online, along with ePub, PDF and mobi versions. You can find the source to the manual in [atom/docs](https://github.com/atom/docs).
If you want to read about using Atom or developing packages in Atom, the [Atom Flight Manual](http://flight-manual.atom.io) is free and available online. You can find the source to the manual in [atom/flight-manual.atom.io](https://github.com/atom/flight-manual.atom.io).

The [API reference](https://atom.io/docs/api) for developing packages is also documented on Atom.io.

Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ deploy: off
artifacts:
- path: out\**\AtomSetup.exe
name: AtomSetup.exe
- path: out\**\AtomSetup.msi
name: AtomSetup.msi

cache:
- '%USERPROFILE%\.atom\.apm'
Expand Down
12 changes: 9 additions & 3 deletions build/Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ module.exports = (grunt) ->
dest: path.join(appDir, jsFile)
})

windowsInstallerConfig =

grunt.initConfig
pkg: grunt.file.readJSON('package.json')

Expand Down Expand Up @@ -286,12 +288,16 @@ module.exports = (grunt) ->
ciTasks.push('set-version', 'check-licenses', 'lint', 'generate-asar')
ciTasks.push('mkdeb') if process.platform is 'linux'
ciTasks.push('mktar') if process.platform is 'linux'
ciTasks.push('codesign:exe') if process.platform is 'win32' and not process.env.CI
ciTasks.push('create-windows-installer:installer') if process.platform is 'win32'
ciTasks.push('test') if process.platform is 'darwin'
ciTasks.push('codesign:installer') if process.platform is 'win32' and not process.env.CI
ciTasks.push('codesign:app') if process.platform is 'darwin' and not process.env.CI
if process.platform is 'win32'
ciTasks.push('codesign:exe') if process.env.JANKY_SIGNTOOL
ciTasks.push('codesign:installer-deferred') if not process.env.JANKY_SIGNTOOL
ciTasks.push('create-windows-installer:installer')
ciTasks.push('codesign:installer') if process.env.JANKY_SIGNTOOL
ciTasks.push('codesign:cleanup')
ciTasks.push('publish-build') unless process.env.CI

grunt.registerTask('ci', ciTasks)

defaultTasks = ['download-electron', 'download-electron-chromedriver', 'build', 'set-version', 'generate-asar']
Expand Down
92 changes: 55 additions & 37 deletions build/tasks/codesign-task.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,58 +5,76 @@ request = require 'request'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)

signUsingWindowsSDK = (exeToSign, callback) ->
{WIN_P12KEY_PASSWORD, WIN_P12KEY_URL} = process.env
if WIN_P12KEY_URL?
grunt.log.ok("Obtaining signing key")
downloadedKeyFile = path.resolve(__dirname, 'DownloadedSignKey.p12')
downloadFile WIN_P12KEY_URL, downloadedKeyFile, (done) ->
signUsingWindowsSDKTool exeToSign, downloadedKeyFile, WIN_P12KEY_PASSWORD, (done) ->
fs.unlinkSync(downloadedKeyFile)
callback()
else
signUsingWindowsSDKTool exeToSign, path.resolve(__dirname, '..', 'certs', 'AtomDevTestSignKey.p12'), 'password', callback
# Mac OS X code signing

signUsingWindowsSDKTool = (exeToSign, keyFilePath, password, callback) ->
grunt.log.ok("Signing #{exeToSign}")
args = ['sign', '/v', '/p', password, '/f', keyFilePath, exeToSign]
spawn {cmd: 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\bin\\signtool.exe', args: args}, callback
grunt.registerTask 'codesign:app', 'CodeSign Atom.app', ->
done = @async()
unlockKeychain (error) ->
return done(error) if error?

signUsingJanky = (exeToSign, callback) ->
spawn {cmd: process.env.JANKY_SIGNTOOL, args: [exeToSign]}, callback
args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: GitHub', grunt.config.get('atom.shellAppDir')]
spawn {cmd: 'codesign', args: args}, (error) -> done(error)

signWindowsExecutable = if process.env.JANKY_SIGNTOOL then signUsingJanky else signUsingWindowsSDK
unlockKeychain = (callback) ->
return callback() unless process.env.XCODE_KEYCHAIN
{XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN} = process.env
args = ['unlock-keychain', '-p', XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN]
spawn {cmd: 'security', args: args}, (error) -> callback(error)

grunt.registerTask 'codesign:exe', 'CodeSign Atom.exe and Update.exe', ->
done = @async()
spawn {cmd: 'taskkill', args: ['/F', '/IM', 'atom.exe']}, ->
atomExePath = path.join(grunt.config.get('atom.shellAppDir'), 'atom.exe')
signWindowsExecutable atomExePath, (error) ->
return done(error) if error?
# Windows code signing

updateExePath = path.resolve(__dirname, '..', 'node_modules', 'grunt-electron-installer', 'vendor', 'Update.exe')
signWindowsExecutable updateExePath, (error) -> done(error)
grunt.registerTask 'codesign:exe', 'CodeSign Windows binaries', ->
done = @async()
atomExePath = path.join(grunt.config.get('atom.shellAppDir'), 'atom.exe')
signWindowsExecutable atomExePath, (error) ->
return done(error) if error?
updateExePath = path.resolve(__dirname, '..', 'node_modules', 'grunt-electron-installer', 'vendor', 'Update.exe')
signWindowsExecutable updateExePath, (error) -> done(error)

grunt.registerTask 'codesign:installer', 'CodeSign AtomSetup.exe', ->
grunt.registerTask 'codesign:installer', 'CodeSign Windows installer (AtomSetup.exe)', ->
done = @async()
atomSetupExePath = path.resolve(grunt.config.get('atom.buildDir'), 'installer', 'AtomSetup.exe')
signWindowsExecutable atomSetupExePath, (error) -> done(error)

grunt.registerTask 'codesign:app', 'CodeSign Atom.app', ->
grunt.registerTask 'codesign:installer-deferred', 'Obtain cert and configure installer to perform CodeSign', ->
done = @async()
getCertificate (file, password) ->
grunt.config('create-windows-installer.installer.certificateFile', file)
grunt.config('create-windows-installer.installer.certificatePassword', password)
grunt.log.ok('Certificate ready for create-windows-installer task')
done()

unlockKeychain (error) ->
return done(error) if error?
grunt.registerTask 'codesign:cleanup', 'Clean up any temporary or downloaded files used for CodeSign', ->
try fs.unlinkSync(downloadedCertificateFile) catch e then return

args = ['--deep', '--force', '--verbose', '--sign', 'Developer ID Application: GitHub', grunt.config.get('atom.shellAppDir')]
spawn {cmd: 'codesign', args: args}, (error) -> done(error)
downloadedCertificateFile = path.resolve(__dirname, 'DownloadedCertFile.p12')

unlockKeychain = (callback) ->
return callback() unless process.env.XCODE_KEYCHAIN
signWindowsExecutable = (exeToSign, callback) ->
if process.env.JANKY_SIGNTOOL
signUsingJanky exeToSign, callback
else
signUsingWindowsSDK exeToSign, callback

{XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN} = process.env
args = ['unlock-keychain', '-p', XCODE_KEYCHAIN_PASSWORD, XCODE_KEYCHAIN]
spawn {cmd: 'security', args: args}, (error) -> callback(error)
signUsingJanky = (exeToSign, callback) ->
grunt.log.ok("Signing #{exeToSign} using Janky SignTool")
spawn {cmd: process.env.JANKY_SIGNTOOL, args: [exeToSign]}, callback

signUsingWindowsSDK = (exeToSign, callback) ->
getCertificate (file, password) ->
signUsingWindowsSDKTool exeToSign, file, password, callback

signUsingWindowsSDKTool = (exeToSign, certificateFile, certificatePassword, callback) ->
grunt.log.ok("Signing '#{exeToSign}' using Windows SDK")
args = ['sign', '/v', '/p', certificatePassword, '/f', certificateFile, exeToSign]
spawn {cmd: 'C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.1A\\bin\\signtool.exe', args: args}, callback

getCertificate = (callback) ->
if process.env.WIN_P12KEY_URL?
grunt.log.ok("Obtaining certificate file")
downloadFile process.env.WIN_P12KEY_URL, downloadedCertificateFile, (done) ->
callback(downloadedCertificateFile, process.env.WIN_P12KEY_PASSWORD ? 'password')
else
callback(path.resolve(__dirname, '..', 'certs', 'AtomDevTestSignKey.p12'), process.env.WIN_P12KEY_PASSWORD ? 'password')

downloadFile = (sourceUrl, targetPath, callback) ->
options = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"mocha": "2.5.1",
"normalize-package-data": "^2.0.0",
"nslog": "^3",
"ohnogit": "0.0.11",
"ohnogit": "0.0.12",
"oniguruma": "^5",
"pathwatcher": "~6.5",
"property-accessors": "^1.1.3",
Expand Down
2 changes: 1 addition & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function bootstrap() {

var buildInstallCommand = initialNpmCommand + npmFlags + 'install';
var buildInstallOptions = {cwd: path.resolve(__dirname, '..', 'build')};
var apmInstallCommand = npmPath + npmFlags + '--target=0.10.35 ' + 'install';
var apmInstallCommand = npmPath + npmFlags + '--target=0.10.40 ' + 'install';
var apmInstallOptions = {cwd: apmInstallPath};
var moduleInstallCommand = apmPath + ' install' + apmFlags;
var dedupeApmCommand = apmPath + ' dedupe' + apmFlags;
Expand Down
21 changes: 18 additions & 3 deletions spec/text-editor-presenter-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,13 @@ describe "TextEditorPresenter", ->
expect(lineStateForScreenRow(presenter, 12).precedingBlockDecorations).toEqual([])
expect(lineStateForScreenRow(presenter, 12).followingBlockDecorations).toEqual([])

it "inserts block decorations before the line if not specified otherwise", ->
blockDecoration = editor.decorateMarker(editor.markScreenPosition([4, 0]), {type: "block"})
presenter = buildPresenter()

expect(lineStateForScreenRow(presenter, 4).precedingBlockDecorations).toEqual [blockDecoration]
expect(lineStateForScreenRow(presenter, 4).followingBlockDecorations).toEqual []

describe ".decorationClasses", ->
it "adds decoration classes to the relevant line state objects, both initially and when decorations change", ->
marker1 = editor.addMarkerLayer(maintainHistory: true).markBufferRange([[4, 0], [6, 2]], invalidate: 'touch')
Expand Down Expand Up @@ -1582,15 +1589,15 @@ describe "TextEditorPresenter", ->
expect(stateForCursor(presenter, 4)).toEqual {top: 8 * 10, left: 4 * 10, width: 10, height: 10}

blockDecoration1 = addBlockDecorationBeforeScreenRow(0)
blockDecoration2 = addBlockDecorationBeforeScreenRow(1)
blockDecoration2 = addBlockDecorationAfterScreenRow(1)

waitsForStateToUpdate presenter, ->
presenter.setBlockDecorationDimensions(blockDecoration1, 0, 30)
presenter.setBlockDecorationDimensions(blockDecoration2, 0, 10)

runs ->
expect(stateForCursor(presenter, 0)).toEqual {top: 50, left: 2 * 10, width: 10, height: 10}
expect(stateForCursor(presenter, 1)).toEqual {top: 60, left: 4 * 10, width: 10, height: 10}
expect(stateForCursor(presenter, 0)).toEqual {top: 1 * 10 + 30, left: 2 * 10, width: 10, height: 10}
expect(stateForCursor(presenter, 1)).toEqual {top: 2 * 10 + 30 + 10, left: 4 * 10, width: 10, height: 10}
expect(stateForCursor(presenter, 2)).toBeUndefined()
expect(stateForCursor(presenter, 3)).toBeUndefined()
expect(stateForCursor(presenter, 4)).toBeUndefined()
Expand All @@ -1604,6 +1611,14 @@ describe "TextEditorPresenter", ->
runs ->
expect(stateForCursor(presenter, 0)).toEqual {top: 0, left: 0, width: 10, height: 10}

it "considers block decorations to be before a line by default", ->
editor.setCursorScreenPosition([4, 0])
blockDecoration = editor.decorateMarker(editor.markScreenPosition([4, 0]), {type: "block"})
presenter = buildPresenter()
presenter.setBlockDecorationDimensions(blockDecoration, 0, 6)

expect(stateForCursor(presenter, 0)).toEqual {top: 4 * 10 + 6, left: 0, width: 10, height: 10}

it "updates when ::scrollTop changes", ->
editor.setSelectedBufferRanges([
[[1, 2], [1, 2]],
Expand Down
2 changes: 1 addition & 1 deletion src/config-schema.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ module.exports =
softWrapAtPreferredLineLength:
type: 'boolean'
default: false
description: 'Instead of wrapping lines to the window\'s width, wrap lines to the number of characters defined by the `Preferred Line Length` setting. This will only take effect when the soft wrap config setting is enabled globally or for the current language.'
description: 'Instead of wrapping lines to the window\'s width, wrap lines to the number of characters defined by the `Preferred Line Length` setting. This will only take effect when the soft wrap config setting is enabled globally or for the current language. **Note:** If you want to hide the wrap guide (the vertical line) you can disable the `wrap-guide` package.'
softWrapHangingIndent:
type: 'integer'
default: 0
Expand Down
4 changes: 2 additions & 2 deletions src/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ class Config
properties[key] ?= {}
rootSchema = properties[key]

_.extend rootSchema, schema
Object.assign rootSchema, schema
@setDefaults(keyPath, @extractDefaultsFromSchema(schema))
@setScopedDefaultsFromSchema(keyPath, schema)
@resetSettingsForSchemaChange()
Expand Down Expand Up @@ -870,7 +870,7 @@ class Config
return if @shouldNotAccessFileSystem()

allSettings = {'*': @settings}
allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource(@getUserConfigPath())
allSettings = Object.assign allSettings, @scopedSettingsStore.propertiesForSource(@getUserConfigPath())
allSettings = sortObject(allSettings)
try
CSON.writeFileSync(@configFilePath, allSettings)
Expand Down
4 changes: 2 additions & 2 deletions src/cursor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,8 @@ class Cursor extends Model
# * `wordRegex` A {RegExp} indicating what constitutes a "word"
# (default: {::wordRegExp}).
getCurrentWordBufferRange: (options={}) ->
startOptions = _.extend(_.clone(options), allowPrevious: false)
endOptions = _.extend(_.clone(options), allowNext: false)
startOptions = Object.assign(_.clone(options), allowPrevious: false)
endOptions = Object.assign(_.clone(options), allowNext: false)
new Range(@getBeginningOfCurrentWordBufferPosition(startOptions), @getEndOfCurrentWordBufferPosition(endOptions))

# Public: Returns the buffer Range for the current line.
Expand Down
2 changes: 1 addition & 1 deletion src/git-repository.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class GitRepository
getDirectoryStatus: (directoryPath) ->
directoryPath = "#{@relativize(directoryPath)}/"
directoryStatus = 0
for path, status of _.extend({}, @async.getCachedPathStatuses(), @statusesByPath)
for path, status of Object.assign({}, @async.getCachedPathStatuses(), @statusesByPath)
directoryStatus |= status if path.indexOf(directoryPath) is 0
directoryStatus

Expand Down
4 changes: 2 additions & 2 deletions src/main-process/atom-application.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ LocationSuffixRegExp = /(:\d+)(:\d+)?$/
#
module.exports =
class AtomApplication
_.extend @prototype, EventEmitter.prototype
Object.assign @prototype, EventEmitter.prototype

# Public: The entry point into the Atom application.
@open: (options) ->
Expand Down Expand Up @@ -525,7 +525,7 @@ class AtomApplication
restorePreviousState = @config.get('core.restorePreviousWindowsOnStart') ? true
if restorePreviousState and (states = @storageFolder.load('application.json'))?.length > 0
for state in states
@openWithOptions(_.extend(options, {
@openWithOptions(Object.assign(options, {
initialPaths: state.initialPaths
pathsToOpen: state.initialPaths.filter (directoryPath) -> fs.isDirectorySync(directoryPath)
urlsToOpen: []
Expand Down
5 changes: 2 additions & 3 deletions src/main-process/atom-window.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
path = require 'path'
fs = require 'fs'
url = require 'url'
_ = require 'underscore-plus'
{EventEmitter} = require 'events'

module.exports =
class AtomWindow
_.extend @prototype, EventEmitter.prototype
Object.assign @prototype, EventEmitter.prototype

@iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
@includeShellLoadTime: true
Expand Down Expand Up @@ -46,7 +45,7 @@ class AtomWindow

@handleEvents()

loadSettings = _.extend({}, settings)
loadSettings = Object.assign({}, settings)
loadSettings.appVersion = app.getVersion()
loadSettings.resourcePath = @resourcePath
loadSettings.devMode ?= false
Expand Down
3 changes: 1 addition & 2 deletions src/main-process/auto-update-manager.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
autoUpdater = null
_ = require 'underscore-plus'
{EventEmitter} = require 'events'
path = require 'path'

Expand All @@ -13,7 +12,7 @@ ErrorState = 'error'

module.exports =
class AutoUpdateManager
_.extend @prototype, EventEmitter.prototype
Object.assign @prototype, EventEmitter.prototype

constructor: (@version, @testMode, resourcePath, @config) ->
@state = IdleState
Expand Down
3 changes: 1 addition & 2 deletions src/main-process/auto-updater-win32.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{EventEmitter} = require 'events'
_ = require 'underscore-plus'
SquirrelUpdate = require './squirrel-update'

class AutoUpdater
_.extend @prototype, EventEmitter.prototype
Object.assign @prototype, EventEmitter.prototype

setFeedURL: (@updateUrl) ->

Expand Down
3 changes: 1 addition & 2 deletions src/scan-handler.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
_ = require "underscore-plus"
path = require "path"
async = require "async"
{PathSearcher, PathScanner, search} = require 'scandal'
Expand Down Expand Up @@ -26,7 +25,7 @@ module.exports = (rootPaths, regexSource, options) ->
async.each(
rootPaths,
(rootPath, next) ->
options2 = _.extend {}, options,
options2 = Object.assign {}, options,
inclusions: processPaths(rootPath, options.inclusions)
globalExclusions: processPaths(rootPath, options.globalExclusions)

Expand Down
4 changes: 2 additions & 2 deletions src/selection.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{Point, Range} = require 'text-buffer'
{pick} = _ = require 'underscore-plus'
{pick} = require 'underscore-plus'
{Emitter} = require 'event-kit'
Model = require './model'

Expand Down Expand Up @@ -738,7 +738,7 @@ class Selection extends Model
else
options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange

@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), _.extend(autoscroll: false, options))
@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), Object.assign(autoscroll: false, options))
otherSelection.destroy()

###
Expand Down
8 changes: 4 additions & 4 deletions src/text-editor-presenter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1083,12 +1083,12 @@ class TextEditorPresenter
return if @blockDecorationsToRenderById[decoration.getId()]

screenRow = decoration.getMarker().getHeadScreenPosition().row
if decoration.getProperties().position is "before"
@precedingBlockDecorationsByScreenRow[screenRow] ?= []
@precedingBlockDecorationsByScreenRow[screenRow].push(decoration)
else
if decoration.getProperties().position is "after"
@followingBlockDecorationsByScreenRow[screenRow] ?= []
@followingBlockDecorationsByScreenRow[screenRow].push(decoration)
else
@precedingBlockDecorationsByScreenRow[screenRow] ?= []
@precedingBlockDecorationsByScreenRow[screenRow].push(decoration)
@state.content.blockDecorations[decoration.getId()] = {decoration, screenRow, isVisible}
@blockDecorationsToRenderById[decoration.getId()] = true

Expand Down
Loading

0 comments on commit 5e3f343

Please sign in to comment.