mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-28 17:13:45 +03:00
Add window:run-package-specs command
This will only run specs found in the current projects spec directory
This commit is contained in:
parent
ba632751a0
commit
78b9a99f86
@ -45,6 +45,7 @@
|
||||
'ctrl-meta-f': 'window:toggle-full-screen'
|
||||
'meta-r': 'window:reload'
|
||||
'alt-meta-i': 'window:toggle-dev-tools'
|
||||
'meta-alt-ctrl-p': 'window:run-package-specs'
|
||||
|
||||
'ctrl-|': 'pane:split-right'
|
||||
'ctrl-w v': 'pane:split-right'
|
||||
|
@ -15,24 +15,33 @@ measure 'spec suite require time', ->
|
||||
for spec in jasmine.getEnv().currentRunner().specs() when not spec.specType?
|
||||
spec.specType = specType
|
||||
|
||||
# Run core specs
|
||||
requireSpecs(window.resourcePath)
|
||||
setSpecType('core')
|
||||
runAllSpecs = ->
|
||||
requireSpecs(window.resourcePath)
|
||||
setSpecType('core')
|
||||
|
||||
fixturesPackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
|
||||
packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
|
||||
packagePaths = _.groupBy packagePaths, (packagePath) ->
|
||||
if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
|
||||
'fixtures'
|
||||
else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0
|
||||
'bundled'
|
||||
else
|
||||
'user'
|
||||
fixturesPackagesPath = fsUtils.resolveOnLoadPath('fixtures/packages')
|
||||
packagePaths = atom.getAvailablePackageNames().map (packageName) -> atom.resolvePackagePath(packageName)
|
||||
packagePaths = _.groupBy packagePaths, (packagePath) ->
|
||||
if packagePath.indexOf("#{fixturesPackagesPath}#{path.sep}") is 0
|
||||
'fixtures'
|
||||
else if packagePath.indexOf("#{window.resourcePath}#{path.sep}") is 0
|
||||
'bundled'
|
||||
else
|
||||
'user'
|
||||
|
||||
# Run bundled package specs
|
||||
requireSpecs(packagePath) for packagePath in packagePaths.bundled ? []
|
||||
setSpecType('bundled')
|
||||
# Run bundled package specs
|
||||
requireSpecs(packagePath) for packagePath in packagePaths.bundled ? []
|
||||
setSpecType('bundled')
|
||||
|
||||
# Run user package specs
|
||||
requireSpecs(packagePath) for packagePath in packagePaths.user ? []
|
||||
setSpecType('user')
|
||||
# Run user package specs
|
||||
requireSpecs(packagePath) for packagePath in packagePaths.user ? []
|
||||
setSpecType('user')
|
||||
|
||||
runSpecs = (specPath) ->
|
||||
requireSpecs(specPath)
|
||||
setSpecType("user")
|
||||
|
||||
if specPath = atom.getLoadSettings().specPath
|
||||
runSpecs(specPath)
|
||||
else
|
||||
runAllSpecs()
|
||||
|
@ -140,6 +140,9 @@ class AtomApplication
|
||||
ipc.once 'update-application-menu', (processId, routingId, keystrokesByCommand) =>
|
||||
@applicationMenu.update(keystrokesByCommand)
|
||||
|
||||
ipc.on 'run-package-specs', (processId, routingId, packagePath) =>
|
||||
@runSpecs({@resourcePath, specPath: packagePath, exitWhenDone: false})
|
||||
|
||||
ipc.on 'command', (processId, routingId, command) =>
|
||||
@emit(command)
|
||||
|
||||
@ -194,14 +197,14 @@ class AtomApplication
|
||||
else
|
||||
console.log "Opening unknown url #{urlToOpen}"
|
||||
|
||||
runSpecs: ({exitWhenDone, resourcePath}) ->
|
||||
runSpecs: ({exitWhenDone, resourcePath, specPath}) ->
|
||||
if resourcePath isnt @resourcePath and not fs.existsSync(resourcePath)
|
||||
resourcePath = @resourcePath
|
||||
|
||||
bootstrapScript = 'spec-bootstrap'
|
||||
isSpec = true
|
||||
devMode = true
|
||||
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode})
|
||||
new AtomWindow({bootstrapScript, resourcePath, exitWhenDone, isSpec, devMode, specPath})
|
||||
|
||||
promptForPath: ({devMode}={}) ->
|
||||
pathsToOpen = dialog.showOpenDialog title: 'Open', properties: ['openFile', 'openDirectory', 'multiSelections', 'createDirectory']
|
||||
|
@ -81,6 +81,7 @@ class RootView extends View
|
||||
@command 'application:zoom', -> ipc.sendChannel('command', 'application:zoom')
|
||||
@command 'application:bring-all-windows-to-front', -> ipc.sendChannel('command', 'application:bring-all-windows-to-front')
|
||||
|
||||
@command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', project.getPath())
|
||||
@command 'window:increase-font-size', =>
|
||||
config.set("editor.fontSize", config.get("editor.fontSize") + 1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user