From c2940c54d8fb03c867ecde69c720fd01bdc83a89 Mon Sep 17 00:00:00 2001 From: efernandez Date: Mon, 11 Feb 2019 10:33:26 -0300 Subject: [PATCH] concatenar archivos spec --- gulpfile.js | 20 +++++++++++++++++--- package.json | 6 ++++-- src/js/app.js | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 4e4d4f3..2b94e97 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,10 +9,13 @@ const jshint = require('gulp-jshint'); const replace = require('gulp-replace'); const connect = require('gulp-connect'); const clean = require('gulp-clean'); +const header = require('gulp-header'); +const footer =require('gulp-footer'); var paths = { srcJS: 'src/js/*.js', srcViews: 'src/views/*.html', + specs: 'spec/*.js', tmp: 'tmp', dist: 'dist/' }; @@ -32,7 +35,7 @@ gulp.task('templates', function() { ); }); -gulp.task('uglify', ['templates'], function() { +gulp.task('uglify', ['templates', 'uglify-spec'], function() { return pump( [ gulp.src([ @@ -49,6 +52,17 @@ gulp.task('uglify', ['templates'], function() { ); }); +gulp.task('uglify-spec', function() { + return pump([ + gulp.src(paths.specs), + concat('foca-abm-chofer.spec.js'), + replace("src/views/", ''), + header("describe('Módulo foca-abm-chofer', function() { \n"), + footer("});"), + gulp.dest(paths.dist) + ]); +}); + gulp.task('clean', function() { return gulp.src(['tmp', 'dist'], {read: false}) .pipe(clean()); @@ -57,7 +71,7 @@ gulp.task('clean', function() { gulp.task('pre-commit', function() { pump( [ - gulp.src(paths.srcJS), + gulp.src([paths.srcJS, paths.specs]), jshint('.jshintrc'), jshint.reporter('default'), jshint.reporter('fail') @@ -69,7 +83,7 @@ gulp.task('pre-commit', function() { gulp.task('clean-post-install', function() { return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', - 'index.html'], {read: false}) + 'index.html', 'spec'], {read: false}) .pipe(clean()); }); diff --git a/package.json b/package.json index 66df4a7..56b42e7 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Abm de chofer", "main": "index.html", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "test.html", "compile": "gulp uglify", "gulp-pre-commit": "gulp pre-commit", "postinstall": "npm run compile && gulp clean-post-install", @@ -36,7 +36,8 @@ }, "devDependencies": { "angular": "^1.7.7", - "angular-route": "^1.7.5", + "angular-mocks": "^1.7.7", + "angular-route": "^1.7.7", "bootstrap": "^4.2.1", "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", @@ -45,6 +46,7 @@ "gulp-angular-templatecache": "^2.2.6", "gulp-clean": "^0.4.0", "gulp-connect": "^5.7.0", + "gulp-header": "^2.0.7", "gulp-htmlmin": "^5.0.1", "gulp-jshint": "^2.1.0", "gulp-rename": "^1.4.0", diff --git a/src/js/app.js b/src/js/app.js index cc42d6e..82fa28e 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1 +1 @@ -angular.module('focaAbmChofer', []); +angular.module('focaAbmChofer', ['ngRoute']); -- 1.9.1