Merge branch 'master' into chrome31

Conflicts:
	build/package.json
	package.json
This commit is contained in:
Cheng Zhao
2014-01-13 23:28:48 +08:00
14 changed files with 88 additions and 37 deletions

View File

@@ -29,6 +29,7 @@ module.exports = (grunt) ->
grunt.loadNpmTasks('grunt-markdown')
grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks('grunt-download-atom-shell')
grunt.loadNpmTasks('grunt-peg')
grunt.loadTasks('tasks')
# This allows all subsequent paths to the relative to the root of the repo
@@ -106,6 +107,13 @@ module.exports = (grunt) ->
dest: appDir
ext: '.json'
pegConfig =
glob_to_multiple:
expand: true
src: ['src/**/*.pegjs']
dest: appDir
ext: '.js'
for child in fs.readdirSync('node_modules') when child isnt '.bin'
directory = path.join('node_modules', child)
{engines, theme} = grunt.file.readJSON(path.join(directory, 'package.json'))
@@ -114,6 +122,7 @@ module.exports = (grunt) ->
lessConfig.glob_to_multiple.src.push("#{directory}/**/*.less")
prebuildLessConfig.src.push("#{directory}/**/*.less") unless theme
csonConfig.glob_to_multiple.src.push("#{directory}/**/*.cson")
pegConfig.glob_to_multiple.src.push("#{directory}/**/*.pegjs")
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
@@ -128,6 +137,8 @@ module.exports = (grunt) ->
cson: csonConfig
peg: pegConfig
coffeelint:
options:
no_empty_param_list:
@@ -211,10 +222,10 @@ module.exports = (grunt) ->
stderr: false
failOnError: false
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson'])
grunt.registerTask('compile', ['coffee', 'prebuild-less', 'cson', 'peg'])
grunt.registerTask('lint', ['coffeelint', 'csslint', 'lesslint'])
grunt.registerTask('test', ['shell:kill-atom', 'run-specs'])
grunt.registerTask('ci', ['download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build'])
grunt.registerTask('ci', ['output-disk-space', 'download-atom-shell', 'build', 'set-development-version', 'lint', 'test', 'publish-build'])
grunt.registerTask('deploy', ['partial-clean', 'download-atom-shell', 'build', 'codesign'])
grunt.registerTask('docs', ['markdown:guides', 'build-docs'])
grunt.registerTask('default', ['download-atom-shell', 'build', 'set-development-version', 'install'])

View File

@@ -29,6 +29,7 @@
"rimraf": "~2.2.2",
"unzip": "~0.1.9",
"vm-compatibility-layer": "~0.1.0",
"walkdir": "0.0.7"
"walkdir": "0.0.7",
"grunt-peg": "~1.1.0"
}
}

View File

@@ -0,0 +1,25 @@
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'output-disk-space', 'Print diskspace available', ->
return unless process.platform is 'darwin'
done = @async()
cmd = 'df'
args = ['-Hl']
spawn {cmd, args}, (error, result, code) ->
return done(error) if error?
lines = result.stdout.split("\n")
for line in lines[1..]
[filesystem, size, used, avail, capacity, extra] = line.split(/\s+/)
capacity = parseInt(capacity)
if capacity > 90
grunt.log.error("#{filesystem} is at #{capacity}% capacity!")
else if capacity > 80
grunt.log.ok("#{filesystem} is at #{capacity}% capacity.")
done()

View File

@@ -39,7 +39,7 @@ module.exports = (grunt) ->
proc = childProcess.spawn(options.cmd, options.args, options.opts)
proc.stdout.on 'data', (data) -> stdout.push(data.toString())
proc.stderr.on 'data', (data) -> stderr.push(data.toString())
proc.on 'exit', (exitCode, signal) ->
proc.on 'close', (exitCode, signal) ->
error = new Error(signal) if exitCode != 0
results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode}
grunt.log.error results.stderr if exitCode != 0

View File

@@ -24,10 +24,10 @@
"coffee-script": "1.6.3",
"coffeestack": "0.6.0",
"emissary": "0.19.0",
"first-mate": "0.13.0",
"first-mate": "0.17.0",
"fs-plus": "0.14.0",
"fstream": "0.1.24",
"fuzzaldrin": "0.5.0",
"fuzzaldrin": "0.6.0",
"git-utils": "0.30.0",
"guid": "0.0.10",
"jasmine-focused": "~0.15.0",
@@ -41,7 +41,7 @@
"oniguruma": "0.26.0",
"optimist": "0.4.0",
"pathwatcher": "0.13.0",
"pegjs": "0.7.0",
"pegjs": "0.8.0",
"q": "0.9.7",
"scandal": "0.11.0",
"season": "0.14.0",
@@ -49,9 +49,9 @@
"space-pen": "3.0.3",
"temp": "0.5.0",
"text-buffer": "0.12.0",
"theorist": "~0.7.0",
"underscore-plus": "0.6.1",
"vm-compatibility-layer": "0.1.0",
"theorist": "~0.7.0"
"vm-compatibility-layer": "0.1.0"
},
"packageDependencies": {
"atom-dark-syntax": "0.10.0",
@@ -65,16 +65,16 @@
"autocomplete": "0.19.0",
"autoflow": "0.11.0",
"autosave": "0.10.0",
"background-tips": "0.3.0",
"background-tips": "0.4.0",
"bookmarks": "0.15.0",
"bracket-matcher": "0.16.0",
"command-logger": "0.9.0",
"command-palette": "0.14.0",
"dev-live-reload": "0.22.0",
"editor-stats": "0.12.0",
"exception-reporting": "0.9.0",
"exception-reporting": "0.11.0",
"feedback": "0.22.0",
"find-and-replace": "0.68.0",
"find-and-replace": "0.73.0",
"fuzzy-finder": "0.30.0",
"gists": "0.14.0",
"git-diff": "0.21.0",
@@ -83,21 +83,21 @@
"grammar-selector": "0.16.0",
"image-view": "0.14.0",
"keybinding-resolver": "0.8.0",
"markdown-preview": "0.22.0",
"metrics": "0.20.0",
"markdown-preview": "0.23.0",
"metrics": "0.21.0",
"package-generator": "0.23.0",
"release-notes": "0.15.0",
"settings-view": "0.55.0",
"snippets": "0.17.0",
"snippets": "0.18.0",
"spell-check": "0.19.0",
"status-bar": "0.30.0",
"status-bar": "0.31.0",
"styleguide": "0.19.0",
"symbols-view": "0.28.0",
"tabs": "0.16.0",
"terminal": "0.24.0",
"timecop": "0.12.0",
"to-the-hubs": "0.17.0",
"tree-view": "0.58.0",
"tree-view": "0.59.0",
"visual-bell": "0.6.0",
"welcome": "0.4.0",
"whitespace": "0.10.0",

View File

@@ -52,12 +52,6 @@ class AtomPackage extends Package
console.warn "Failed to load package named '#{@name}'", e.stack ? e
this
enable: ->
atom.config.removeAtKeyPath('core.disabledPackages', @metadata.name)
disable: ->
atom.config.pushAtKeyPath('core.disabledPackages', @metadata.name)
reset: ->
@stylesheets = []
@keymaps = []

View File

@@ -52,6 +52,8 @@ class AtomApplication
resourcePath: null
version: null
exit: (status) -> app.exit(status)
constructor: (options) ->
{@resourcePath, @version, @devMode} = options
global.atomApplication = this

View File

@@ -18,7 +18,7 @@ class AtomWindow
isSpec: null
constructor: (settings={}) ->
{@resourcePath, pathToOpen, initialLine, @isSpec} = settings
{@resourcePath, pathToOpen, initialLine, @isSpec, @exitWhenDone} = settings
global.atomApplication.addWindow(this)
@setupNodePath(@resourcePath)
@@ -82,7 +82,7 @@ class AtomWindow
@browserWindow.destroy() if chosen is 0
@browserWindow.on 'crashed', =>
atom.exit(100) if @isSpec
global.atomApplication.exit(100) if @exitWhenDone
chosen = dialog.showMessageBox @browserWindow,
type: 'warning'

View File

@@ -168,7 +168,7 @@ class DisplayBufferMarker
# Returns a {String} representation of the marker
inspect: ->
"DisplayBufferMarker(id: #{@id}, bufferRange: #{@getBufferRange().inspect()})"
"DisplayBufferMarker(id: #{@id}, bufferRange: #{@getBufferRange()})"
### Internal ###

View File

@@ -1,8 +1,6 @@
{$} = require './space-pen-extensions'
_ = require 'underscore-plus'
fs = require 'fs-plus'
{specificity} = require 'clear-cut'
PEG = require 'pegjs'
### Internal ###
@@ -10,28 +8,41 @@ module.exports =
class KeyBinding
@parser: null
@currentIndex: 1
@specificities: null
@calculateSpecificity: (selector) ->
@specificities ?= {}
value = @specificities[selector]
unless value?
value = specificity(selector)
@specificities[selector] = value
value
@normalizeKeystroke: (keystroke) ->
normalizedKeystroke = keystroke.split(/\s+/).map (keystroke) =>
keys = @getParser().parse(keystroke)
keys = @parseKeystroke(keystroke)
modifiers = keys[0...-1]
modifiers.sort()
[modifiers..., _.last(keys)].join('-')
normalizedKeystroke.join(' ')
@getParser: ->
if not KeyBinding.parser
keystrokePattern = fs.readFileSync(require.resolve('./keystroke-pattern.pegjs'), 'utf8')
KeyBinding.parser = PEG.buildParser(keystrokePattern)
@parseKeystroke: (keystroke) ->
unless @parser?
try
@parser = require './keystroke-pattern'
catch
keystrokePattern = fs.readFileSync(require.resolve('./keystroke-pattern.pegjs'), 'utf8')
PEG = require 'pegjs'
@parser = PEG.buildParser(keystrokePattern)
KeyBinding.parser
@parser.parse(keystroke)
constructor: (source, command, keystroke, selector) ->
@source = source
@command = command
@keystroke = KeyBinding.normalizeKeystroke(keystroke)
@selector = selector.replace(/!important/g, '')
@specificity = specificity(selector)
@specificity = KeyBinding.calculateSpecificity(selector)
@index = KeyBinding.currentIndex++
matches: (keystroke) ->

View File

@@ -47,6 +47,12 @@ class Package
isActive: ->
atom.packages.isPackageActive(@name)
enable: ->
atom.config.removeAtKeyPath('core.disabledPackages', @metadata.name)
disable: ->
atom.config.pushAtKeyPath('core.disabledPackages', @metadata.name)
isTheme: ->
!!@metadata?.theme

View File

@@ -66,7 +66,7 @@ class PaneContainer extends View
panes[nextIndex].makeActive()
itemDestroyed: (item) ->
@trigger 'item-destroyed', item
@trigger 'item-destroyed', [item]
getRoot: ->
@children().first().view()

View File

@@ -300,7 +300,7 @@ class Project extends Model
promise = deferred.promise
promise.cancel = ->
task.terminate()
deferred.reject('cancelled')
deferred.resolve('cancelled')
promise
# Public: Performs a replace across all the specified files in the project.

View File

@@ -91,6 +91,7 @@ class Task
# * message:
# The message to send
send: (message) ->
throw new Error("Cannot send message to terminated process") unless @childProcess?
@childProcess.send(message)
# Public: Forcefully stop the running task.