-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gulp fixes and reverts #542
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,9 +14,11 @@ gulp = require 'gulp' | |
].forEach (dep) -> | ||
# console.log 'requiring', dep | ||
require dep | ||
#help = require('gulp-help')(gulp) | ||
|
||
gulp.task 'developNoSpec', gulp.series 'clean', 'otherAssets', gulp.parallel('express', 'watch') | ||
#this allows `gulp help` task to work which will display all taks via CLI so yes it is used | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. notes on gulp-help |
||
# help = require('gulp-help')(gulp) #BROKEN IN GULP 4 | ||
|
||
gulp.task 'developNoSpec', gulp.series 'clean', gulp.parallel('angular', 'angularAdmin', 'otherAssets', 'express', 'watch') | ||
|
||
#note specs must come after watch since browserifyWatch also builds scripts | ||
gulp.task 'develop', gulp.series 'developNoSpec', 'spec' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,11 @@ plumber = require 'gulp-plumber' | |
|
||
$ = require('gulp-load-plugins')() | ||
|
||
_testCb = null | ||
|
||
markup = (app) -> | ||
_testCb() if _testCb | ||
|
||
gulp.src paths[app].jade | ||
.pipe plumber() | ||
.pipe $.consolidate 'jade', | ||
|
@@ -29,16 +33,29 @@ markup = (app) -> | |
markupImpl = -> markup 'map' | ||
markupAdminImpl = -> markup 'admin' | ||
|
||
watchImpl = -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Watches follow gulp documentation. |
||
gulp.watch paths.map.jade, markupImpl | ||
|
||
watchAdminImpl = -> | ||
gulp.watch paths.admin.jade, markupAdminImpl | ||
|
||
gulp.task 'markup', markupImpl | ||
|
||
gulp.task 'markupWatch', (done) -> | ||
gulp.watch paths.map.jade | ||
markupImpl() | ||
watchImpl() | ||
done() | ||
|
||
gulp.task 'markupAdmin', markupAdminImpl | ||
|
||
gulp.task 'markupWatchAdmin', (done) -> | ||
gulp.watch paths.admin.jade | ||
markupAdminImpl() | ||
watchAdminImpl() | ||
done() | ||
|
||
module.exports = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exports are for testing only. |
||
### | ||
For intent and purposes these exports are for testing only | ||
### | ||
watchImpl: watchImpl | ||
watchAdminImpl:watchAdminImpl | ||
setTestCb: (cb) -> | ||
_testCb = cb |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,11 @@ require './otherAssets' | |
require './karma' | ||
require './mocha' | ||
|
||
gulp.task 'spec', gulp.parallel 'commonSpec', 'backendSpec', 'gulpSpec', 'frontendSpec' | ||
gulp.task 'spec', gulp.series gulp.parallel('commonSpec', 'backendSpec', 'frontendSpec'), 'gulpSpec' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gulpSpec must come last or first out of all specs or it will fail. |
||
|
||
gulp.task 'rebuildSpec', gulp.series gulp.parallel('commonSpec', 'backendSpec', 'gulpSpec'), gulp.parallel('otherAssets', 'angular', 'angularAdmin'), 'frontendSpec' | ||
gulp.task 'rebuildSpec', gulp.series( | ||
gulp.parallel('commonSpec', 'backendSpec'), 'gulpSpec' | ||
, gulp.parallel('otherAssets', 'angular', 'angularAdmin'), 'frontendSpec') | ||
|
||
gulp.task 'rspec', gulp.series 'rebuildSpec' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,11 @@ gulp = require 'gulp' | |
conf = require './conf' | ||
$ = require('gulp-load-plugins')() | ||
|
||
_testCb = null | ||
|
||
styles = (src) -> | ||
_testCb() if _testCb | ||
|
||
gulp.src [ | ||
src.less | ||
src.styles | ||
|
@@ -40,27 +44,41 @@ stylesImpl = -> | |
stylesAdminImpl = -> | ||
styles paths.admin | ||
|
||
gulp.task 'styles', stylesImpl | ||
|
||
gulp.task 'stylesWatch', (done) -> | ||
watchImpl = -> | ||
gulp.watch [ | ||
paths.map.less | ||
paths.map.styles | ||
paths.map.stylus | ||
] | ||
stylesImpl() | ||
done() | ||
|
||
gulp.task 'stylesAdmin', stylesAdminImpl | ||
], stylesImpl | ||
|
||
gulp.task 'stylesWatchAdmin', (done) -> | ||
watchAdminImpl = -> | ||
gulp.watch [ | ||
paths.map.less | ||
paths.map.styles | ||
paths.map.stylus | ||
paths.admin.less | ||
paths.admin.styles | ||
paths.admin.stylus | ||
] | ||
stylesAdminImpl() | ||
], stylesAdminImpl | ||
|
||
gulp.task 'styles', stylesImpl | ||
|
||
gulp.task 'stylesWatch', (done) -> | ||
watchImpl() | ||
done() | ||
|
||
gulp.task 'stylesAdmin', stylesAdminImpl | ||
|
||
gulp.task 'stylesWatchAdmin', (done) -> | ||
watchAdminImpl() | ||
done() | ||
|
||
|
||
module.exports = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. like markup Exports are for testing only. |
||
### | ||
For intent and purposes these exports are for testing only | ||
### | ||
watchImpl: watchImpl | ||
watchAdminImpl:watchAdminImpl | ||
setTestCb: (cb) -> | ||
_testCb = cb |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,13 +13,5 @@ gulp.task 'watch_all_front', gulp.parallel 'angularWatch', 'angularWatchAdmin' | |
gulp.task 'watch', gulp.series 'watch_all_front', (done) -> | ||
gulp.watch ['gulp/**/*.coffee','spec/gulp/**/*.coffee', specCommon], gulp.series 'gulpSpec' | ||
gulp.watch ['backend/**/*.coffee', 'spec/backend/**/*.coffee', specCommon], gulp.series 'backendSpec' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed
because this is an artifact and it should not be watched. This was causing extra build times and and re-kicking the build as files were being moved and shuffled by gulp. We don't need to watch the artifacts we need to watch the frontend stuff which we are already doing via Eliminating this also eliminates the need to have watch run at a specific time. Heck it could even be added to be prior to clean via parallel. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was my bad, I listed the artifacts so when they were rebuilt, Karma would run specs. But looking at the Karma docs it looks like it watches everything configured within There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The watch inside karma itself is off so all watching is done by gulp. This is done to avoid complications. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, will specs still run on a rebuild? |
||
gulp.watch [ | ||
paths.destFull.scripts + '/map.bundle.js', | ||
paths.destFull.scripts + '/map.templates.js', | ||
paths.destFull.scripts + '/admin.bundle.js', | ||
paths.destFull.scripts + '/admin.templates.js', | ||
'spec/app/**/*.coffee', | ||
'spec/admin/**/*.coffee', | ||
specCommon | ||
], gulp.series 'frontendSpec' | ||
gulp.watch ['spec/app/**/*.coffee','spec/admin/**/*.coffee', specCommon], gulp.series 'frontendSpec' | ||
done() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
subject = require '../../gulp/tasks/markup' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce via specs to find errors on gulp mods. |
||
_testCb = null | ||
|
||
describe 'gulp markup', -> | ||
beforeEach -> | ||
_testCb = null | ||
subject.setTestCb null | ||
|
||
afterEach -> | ||
_testCb = null | ||
subject.setTestCb null | ||
|
||
describe 'watch', -> | ||
|
||
['map', 'admin'].map (name) -> | ||
testName:name | ||
camelCaseName: if name is 'map' then '' else name.toInitCaps() | ||
. forEach (names) -> | ||
|
||
describe names.testName, -> | ||
it 'SHOULD ONLY WATCH', (done) -> | ||
called = false | ||
|
||
_testCb = -> | ||
called = true | ||
|
||
subject.setTestCb(_testCb) | ||
watcher = subject["watch#{names.camelCaseName}Impl"]() | ||
|
||
setTimeout -> | ||
called.should.equal(false) | ||
watcher.end() | ||
done() | ||
, 200 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
subject = require '../../gulp/tasks/styles' | ||
_testCb = null | ||
|
||
describe 'gulp styles', -> | ||
beforeEach -> | ||
_testCb = null | ||
subject.setTestCb null | ||
|
||
afterEach -> | ||
_testCb = null | ||
subject.setTestCb null | ||
|
||
describe 'watch', -> | ||
|
||
['map', 'admin'].map (name) -> | ||
testName:name | ||
camelCaseName: if name is 'map' then '' else name.toInitCaps() | ||
. forEach (names) -> | ||
|
||
describe names.testName, -> | ||
it 'SHOULD ONLY WATCH', (done) -> | ||
called = false | ||
|
||
stylesTestCb = -> | ||
called = true | ||
|
||
subject.setTestCb(_testCb) | ||
watcher = subject["watch#{names.camelCaseName}Impl"]() | ||
|
||
setTimeout -> | ||
called.should.equal(false) | ||
watcher.end() | ||
done() | ||
, 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Killed dep as @zacronos mentioned.. this was not needed