Commit c2940c54d8fb03c867ecde69c720fd01bdc83a89
1 parent
2549988554
Exists in
master
concatenar archivos spec
Showing
3 changed files
with
22 additions
and
6 deletions
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
3 | const htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
5 | const uglify = require('gulp-uglify-es').default; | 5 | const uglify = require('gulp-uglify-es').default; |
6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
11 | const clean = require('gulp-clean'); | 11 | const clean = require('gulp-clean'); |
12 | const header = require('gulp-header'); | ||
13 | const footer =require('gulp-footer'); | ||
12 | 14 | ||
13 | var paths = { | 15 | var paths = { |
14 | srcJS: 'src/js/*.js', | 16 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 17 | srcViews: 'src/views/*.html', |
18 | specs: 'spec/*.js', | ||
16 | tmp: 'tmp', | 19 | tmp: 'tmp', |
17 | dist: 'dist/' | 20 | dist: 'dist/' |
18 | }; | 21 | }; |
19 | 22 | ||
20 | gulp.task('templates', function() { | 23 | gulp.task('templates', function() { |
21 | return pump( | 24 | return pump( |
22 | [ | 25 | [ |
23 | gulp.src(paths.srcViews), | 26 | gulp.src(paths.srcViews), |
24 | replace('views/', ''), | 27 | replace('views/', ''), |
25 | htmlmin(), | 28 | htmlmin(), |
26 | templateCache('views.js', { | 29 | templateCache('views.js', { |
27 | module: 'focaAbmChofer', | 30 | module: 'focaAbmChofer', |
28 | root: '' | 31 | root: '' |
29 | }), | 32 | }), |
30 | gulp.dest(paths.tmp) | 33 | gulp.dest(paths.tmp) |
31 | ] | 34 | ] |
32 | ); | 35 | ); |
33 | }); | 36 | }); |
34 | 37 | ||
35 | gulp.task('uglify', ['templates'], function() { | 38 | gulp.task('uglify', ['templates', 'uglify-spec'], function() { |
36 | return pump( | 39 | return pump( |
37 | [ | 40 | [ |
38 | gulp.src([ | 41 | gulp.src([ |
39 | paths.srcJS, | 42 | paths.srcJS, |
40 | 'tmp/views.js' | 43 | 'tmp/views.js' |
41 | ]), | 44 | ]), |
42 | concat('foca-abm-chofer.js'), | 45 | concat('foca-abm-chofer.js'), |
43 | replace("src/views/", ''), | 46 | replace("src/views/", ''), |
44 | gulp.dest(paths.tmp), | 47 | gulp.dest(paths.tmp), |
45 | rename('foca-abm-chofer.min.js'), | 48 | rename('foca-abm-chofer.min.js'), |
46 | uglify(), | 49 | uglify(), |
47 | gulp.dest(paths.dist) | 50 | gulp.dest(paths.dist) |
48 | ] | 51 | ] |
49 | ); | 52 | ); |
50 | }); | 53 | }); |
51 | 54 | ||
55 | gulp.task('uglify-spec', function() { | ||
56 | return pump([ | ||
57 | gulp.src(paths.specs), | ||
58 | concat('foca-abm-chofer.spec.js'), | ||
59 | replace("src/views/", ''), | ||
60 | header("describe('Módulo foca-abm-chofer', function() { \n"), | ||
61 | footer("});"), | ||
62 | gulp.dest(paths.dist) | ||
63 | ]); | ||
64 | }); | ||
65 | |||
52 | gulp.task('clean', function() { | 66 | gulp.task('clean', function() { |
53 | return gulp.src(['tmp', 'dist'], {read: false}) | 67 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | .pipe(clean()); | 68 | .pipe(clean()); |
55 | }); | 69 | }); |
56 | 70 | ||
57 | gulp.task('pre-commit', function() { | 71 | gulp.task('pre-commit', function() { |
58 | pump( | 72 | pump( |
59 | [ | 73 | [ |
60 | gulp.src(paths.srcJS), | 74 | gulp.src([paths.srcJS, paths.specs]), |
61 | jshint('.jshintrc'), | 75 | jshint('.jshintrc'), |
62 | jshint.reporter('default'), | 76 | jshint.reporter('default'), |
63 | jshint.reporter('fail') | 77 | jshint.reporter('fail') |
64 | ] | 78 | ] |
65 | ); | 79 | ); |
66 | 80 | ||
67 | gulp.start('uglify'); | 81 | gulp.start('uglify'); |
68 | }); | 82 | }); |
69 | 83 | ||
70 | gulp.task('clean-post-install', function() { | 84 | gulp.task('clean-post-install', function() { |
71 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 85 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
72 | 'index.html'], {read: false}) | 86 | 'index.html', 'spec'], {read: false}) |
73 | .pipe(clean()); | 87 | .pipe(clean()); |
74 | }); | 88 | }); |
75 | 89 | ||
76 | gulp.task('compile', ['templates', 'uglify']); | 90 | gulp.task('compile', ['templates', 'uglify']); |
77 | 91 | ||
78 | gulp.task('watch', function() { | 92 | gulp.task('watch', function() { |
79 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 93 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
80 | }); | 94 | }); |
81 | 95 | ||
82 | gulp.task('webserver', function() { | 96 | gulp.task('webserver', function() { |
83 | pump [ | 97 | pump [ |
84 | connect.server({port: 3000}) | 98 | connect.server({port: 3000}) |
85 | ] | 99 | ] |
86 | }); | 100 | }); |
87 | 101 | ||
88 | gulp.task('default', ['webserver']); | 102 | gulp.task('default', ['webserver']); |
89 | 103 |
package.json
1 | { | 1 | { |
2 | "name": "foca-abm-chofer", | 2 | "name": "foca-abm-chofer", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Abm de chofer", | 4 | "description": "Abm de chofer", |
5 | "main": "index.html", | 5 | "main": "index.html", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "test.html", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
11 | "install-dev": "npm install -D angular bootstrap ui-bootstrap4 font-awesome jquery gulp gulp-connect jasmine-core pre-commit gulp-angular-templatecache gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-uglify gulp-clean jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" | 11 | "install-dev": "npm install -D angular bootstrap ui-bootstrap4 font-awesome jquery gulp gulp-connect jasmine-core pre-commit gulp-angular-templatecache gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-uglify gulp-clean jshint pump git+http://git.focasoftware.com/npm/foca-modal.git" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "http://git.focasoftware.com/npm/foca-abm-chofer.git" | 18 | "url": "http://git.focasoftware.com/npm/foca-abm-chofer.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "angular": "^1.7.x", | 23 | "angular": "^1.7.x", |
24 | "angular-route": "^1.7.x", | 24 | "angular-route": "^1.7.x", |
25 | "bootstrap": "^4.1.x", | 25 | "bootstrap": "^4.1.x", |
26 | "jquery": "^3.3.x", | 26 | "jquery": "^3.3.x", |
27 | "font-awesome": "^4.7.x", | 27 | "font-awesome": "^4.7.x", |
28 | "gulp": "^3.9.x", | 28 | "gulp": "^3.9.x", |
29 | "gulp-concat": "2.6.x", | 29 | "gulp-concat": "2.6.x", |
30 | "gulp-jshint": "^2.1.x", | 30 | "gulp-jshint": "^2.1.x", |
31 | "gulp-rename": "^1.4.x", | 31 | "gulp-rename": "^1.4.x", |
32 | "gulp-replace": "^1.0.x", | 32 | "gulp-replace": "^1.0.x", |
33 | "gulp-uglify-es": "^1.0.x", | 33 | "gulp-uglify-es": "^1.0.x", |
34 | "jshint": "^2.9.x", | 34 | "jshint": "^2.9.x", |
35 | "pump": "^3.0.x" | 35 | "pump": "^3.0.x" |
36 | }, | 36 | }, |
37 | "devDependencies": { | 37 | "devDependencies": { |
38 | "angular": "^1.7.7", | 38 | "angular": "^1.7.7", |
39 | "angular-route": "^1.7.5", | 39 | "angular-mocks": "^1.7.7", |
40 | "angular-route": "^1.7.7", | ||
40 | "bootstrap": "^4.2.1", | 41 | "bootstrap": "^4.2.1", |
41 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | 42 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
42 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | 43 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", |
43 | "font-awesome": "^4.7.0", | 44 | "font-awesome": "^4.7.0", |
44 | "gulp": "^3.9.1", | 45 | "gulp": "^3.9.1", |
45 | "gulp-angular-templatecache": "^2.2.6", | 46 | "gulp-angular-templatecache": "^2.2.6", |
46 | "gulp-clean": "^0.4.0", | 47 | "gulp-clean": "^0.4.0", |
47 | "gulp-connect": "^5.7.0", | 48 | "gulp-connect": "^5.7.0", |
49 | "gulp-header": "^2.0.7", | ||
48 | "gulp-htmlmin": "^5.0.1", | 50 | "gulp-htmlmin": "^5.0.1", |
49 | "gulp-jshint": "^2.1.0", | 51 | "gulp-jshint": "^2.1.0", |
50 | "gulp-rename": "^1.4.0", | 52 | "gulp-rename": "^1.4.0", |
51 | "gulp-replace": "^1.0.0", | 53 | "gulp-replace": "^1.0.0", |
52 | "gulp-uglify": "^3.0.1", | 54 | "gulp-uglify": "^3.0.1", |
53 | "gulp-uglify-es": "^1.0.4", | 55 | "gulp-uglify-es": "^1.0.4", |
54 | "jasmine-core": "^3.3.0", | 56 | "jasmine-core": "^3.3.0", |
55 | "jquery": "^3.3.1", | 57 | "jquery": "^3.3.1", |
56 | "jshint": "^2.10.0", | 58 | "jshint": "^2.10.0", |
57 | "pre-commit": "^1.2.2", | 59 | "pre-commit": "^1.2.2", |
58 | "pump": "^3.0.0", | 60 | "pump": "^3.0.0", |
59 | "ui-bootstrap4": "^3.0.6" | 61 | "ui-bootstrap4": "^3.0.6" |
60 | } | 62 | } |
61 | } | 63 | } |
62 | 64 |
src/js/app.js
1 | angular.module('focaAbmChofer', []); | 1 | angular.module('focaAbmChofer', ['ngRoute']); |
2 | 2 |