mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-28 17:13:45 +03:00
Extract isAtomPackage task helper
This commit is contained in:
parent
64c5732e51
commit
1e6cca0969
@ -2,7 +2,7 @@ fs = require 'fs'
|
||||
path = require 'path'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
||||
{cp, isAtomPackage, mkdir, rm} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'build', 'Build the application', ->
|
||||
shellAppDir = grunt.config.get('atom.shellAppDir')
|
||||
@ -28,14 +28,10 @@ module.exports = (grunt) ->
|
||||
{devDependencies} = grunt.file.readJSON('package.json')
|
||||
for child in fs.readdirSync('node_modules')
|
||||
directory = path.join('node_modules', child)
|
||||
try
|
||||
{name, engines} = grunt.file.readJSON(path.join(directory, 'package.json'))
|
||||
if engines?.atom?
|
||||
if isAtomPackage(directory)
|
||||
packageDirectories.push(directory)
|
||||
else
|
||||
nonPackageDirectories.push(directory)
|
||||
catch e
|
||||
nonPackageDirectories.push(directory)
|
||||
|
||||
ignoredPaths = [
|
||||
path.join('git-utils', 'deps')
|
||||
|
@ -29,3 +29,10 @@ module.exports = (grunt) ->
|
||||
grunt.util.spawn options, (error, results, code) ->
|
||||
grunt.log.errorlns results.stderr if results.stderr
|
||||
callback(error, results, code)
|
||||
|
||||
isAtomPackage: (packagePath) ->
|
||||
try
|
||||
{engines} = grunt.file.readJSON(path.join(packagePath, 'package.json'))
|
||||
engines?.atom?
|
||||
catch error
|
||||
false
|
||||
|
@ -5,7 +5,7 @@ _ = require 'underscore'
|
||||
async = require 'async'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{spawn} = require('./task-helpers')(grunt)
|
||||
{isAtomPackage, spawn} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'run-specs', 'Run the specs', ->
|
||||
passed = true
|
||||
@ -31,9 +31,8 @@ module.exports = (grunt) ->
|
||||
for packageDirectory in fs.readdirSync(modulesDirectory)
|
||||
packagePath = path.join(modulesDirectory, packageDirectory)
|
||||
continue unless grunt.file.isDir(path.join(packagePath, 'spec'))
|
||||
try
|
||||
{engines} = grunt.file.readJSON(path.join(packagePath, 'package.json')) ? {}
|
||||
queue.push(packagePath) if engines.atom?
|
||||
continue unless isAtomPackage(packagePath)
|
||||
queue.push(packagePath)
|
||||
|
||||
queue.concurrency = 1
|
||||
queue.drain = -> done(passed)
|
||||
|
Loading…
Reference in New Issue
Block a user