Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
feat(gulp): Add gulp task mkdir:upload to ensure upload directory exi…
Browse files Browse the repository at this point in the history
…sts.

Related #1175
  • Loading branch information
rhutchison committed Feb 12, 2016
1 parent 7852144 commit 6cacc15
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@ gulp.task('copyLocalEnvConfig', function () {
.pipe(gulp.dest('config/env'));
});

// Make sure upload directory exists
gulp.task('makeUploadsDir', function () {
return fs.mkdir('modules/users/client/img/profile/uploads', function (err) {
if (err && err.code !== 'EEXIST') {
console.log(err);
}
});
});

// Angular template cache task
gulp.task('templatecache', function () {
return gulp.src(defaultAssets.client.views)
Expand Down Expand Up @@ -323,11 +332,11 @@ gulp.task('build', function (done) {

// Run the project tests
gulp.task('test', function (done) {
runSequence('env:test', ['copyLocalEnvConfig'], 'lint', 'mocha', 'karma', 'nodemon', 'protractor', done);
runSequence('env:test', 'test:server', 'karma', 'nodemon', 'protractor', done);
});

gulp.task('test:server', function (done) {
runSequence('env:test', 'lint', 'mocha', done);
runSequence('env:test', ['copyLocalEnvConfig', 'makeUploadsDir'], 'lint', 'mocha', done);
});

// Watch all server files for changes & run server tests (test:server) task on changes
Expand All @@ -348,15 +357,15 @@ gulp.task('test:e2e', function (done) {

// Run the project in development mode
gulp.task('default', function (done) {
runSequence('env:dev', ['copyLocalEnvConfig'], 'lint', ['nodemon', 'watch'], done);
runSequence('env:dev', ['copyLocalEnvConfig', 'makeUploadsDir'], 'lint', ['nodemon', 'watch'], done);
});

// Run the project in debug mode
gulp.task('debug', function (done) {
runSequence('env:dev', ['copyLocalEnvConfig'], 'lint', ['nodemon', 'watch'], done);
runSequence('env:dev', ['copyLocalEnvConfig', 'makeUploadsDir'], 'lint', ['nodemon', 'watch'], done);
});

// Run the project in production mode
gulp.task('prod', function (done) {
runSequence('templatecache', ['copyLocalEnvConfig'], 'build', 'env:prod', 'lint', ['nodemon', 'watch'], done);
runSequence(['copyLocalEnvConfig', 'makeUploadsDir', 'templatecache'], 'build', 'env:prod', 'lint', ['nodemon', 'watch'], done);
});

0 comments on commit 6cacc15

Please sign in to comment.