Skip to content

Commit 0ce65e8

Browse files
committed
Next commit to convert to gulp
1 parent 4445864 commit 0ce65e8

File tree

4 files changed

+65
-30
lines changed

4 files changed

+65
-30
lines changed

gulpfile.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
1-
/*jslint node: true */
1+
/*globals require, __dirname */
2+
/* jshint node:true */
23
'use strict';
34

45
var gulp = require('gulp');
56
var jshint = require('gulp-jshint');
67
var karma = require('karma').server;
8+
var bump = require('gulp-bump');
9+
var plato = require('gulp-plato');
10+
var karmaConfig = __dirname + '/karma.conf.js';
11+
var paths = require('./paths');
712

813

9-
var paths = {
10-
scripts: ['gulpfile.js', 'src/**/*.js', 'test/**/*.js', 'demo/**/*.js'],
11-
karmaConfig: __dirname + '/karma.conf.js'
12-
};
14+
gulp.task('bump', function () {
15+
return gulp.src(paths.bump)
16+
.pipe(bump())
17+
.pipe(gulp.dest('./'));
18+
});
19+
20+
gulp.task('complexity', function () {
21+
return gulp.src('src/**/*.js')
22+
.pipe(plato('complexity'));
23+
});
1324

1425
gulp.task('test', function (done) {
15-
karma.start({
16-
configFile: paths.karmaConfig,
17-
singleRun: true
18-
}, done);
26+
karma.start({configFile: karmaConfig, singleRun: true}, done);
1927
});
2028

2129
gulp.task('tdd', function (done) {
22-
gulp.watch(paths.scripts, ['lint']);
30+
gulp.watch(paths.all, ['lint']);
2331

2432
karma.start({
2533
configFile: paths.karmaConfig
2634
}, done);
2735
});
2836

29-
gulp.task('jshint', function () {
37+
gulp.task('lint', function () {
3038
return gulp
31-
.src(paths.scripts)
39+
.src(paths.lint)
3240
.pipe(jshint())
3341
.pipe(jshint.reporter('jshint-stylish'))
3442
.pipe(jshint.reporter('fail'));
3543
});
3644

37-
gulp.task('default', ['jshint', 'test']);
45+
gulp.task('default', ['lint', 'complexity', 'test']);

karma.conf.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/*globals module */
1+
/*globals require */
2+
/* jshint node:true */
23

34
/**
45
* @license angular-bootstrap-datetimepicker
@@ -12,6 +13,9 @@
1213
* @since 7/21/13
1314
*/
1415

16+
17+
var paths = require('./paths');
18+
1519
module.exports = function (config) {
1620
'use strict';
1721
config.set({
@@ -24,26 +28,16 @@ module.exports = function (config) {
2428
'karma-firefox-launcher',
2529
'karma-phantomjs-launcher',
2630
'karma-coverage'
31+
// 'karma-threshold-reporter'
2732
],
2833

29-
files: [
30-
'bower_components/jquery/dist/jquery.js',
31-
'bower_components/moment/moment.js',
32-
'bower_components/moment/locale/*.js',
33-
'bower_components/bootstrap/dist/js/bootstrap.js',
34-
'bower_components/angular/angular.js',
35-
'bower_components/angular-mocks/angular-mocks.js',
36-
'src/js/datetimepicker.js',
37-
'test/**/*.spec.js'
38-
],
34+
files: paths.all,
3935

4036
// list of files to exclude
41-
exclude: [
42-
43-
],
37+
exclude: [],
4438

4539
preprocessors: {
46-
'**/src/js/*.js': ['coverage']
40+
'src/**/*.js': ['coverage']
4741
},
4842

4943
// optionally, configure the reporter
@@ -58,6 +52,15 @@ module.exports = function (config) {
5852
// possible values: 'dots', 'progress', 'junit'
5953
reporters: ['progress', 'coverage'],
6054

55+
56+
// the configure thresholds
57+
thresholdReporter: {
58+
statements: 100,
59+
branches: 100,
60+
functions: 100,
61+
lines: 100
62+
},
63+
6164
// web server port
6265
port: 9876,
6366

@@ -98,4 +101,4 @@ module.exports = function (config) {
98101
// if true, it capture browsers, run tests and exit
99102
singleRun: false
100103
});
101-
};
104+
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
"grunt-istanbul-coverage": "^0.1.0",
2020
"grunt-karma": "^0.9.0",
2121
"gulp": "^3.8.10",
22+
"gulp-bump": "^0.1.11",
2223
"gulp-jshint": "^1.9.0",
23-
"gulp-tap": "^0.1.3",
24+
"gulp-plato": "^1.0.1",
2425
"jshint-stylish": "^1.0.0",
2526
"karma": "^0.12.25",
2627
"karma-chrome-launcher": "^0.1.5",
2728
"karma-coverage": "^0.2.1",
2829
"karma-firefox-launcher": "^0.1.3",
2930
"karma-jasmine": "^0.2.3",
3031
"karma-phantomjs-launcher": "^0.1.2",
32+
"karma-threshold-reporter": "^0.1.9",
3133
"matchdep": "^0.3.0",
3234
"phantomjs": "^1.9.12"
3335
},

paths.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* jshint node:true */
2+
3+
var bower = [
4+
'bower_components/jquery/dist/jquery.js',
5+
'bower_components/moment/moment.js',
6+
'bower_components/moment/locale/*.js',
7+
'bower_components/bootstrap/dist/js/bootstrap.js',
8+
'bower_components/angular/angular.js',
9+
'bower_components/angular-mocks/angular-mocks.js'
10+
];
11+
var sourceFiles = ['src/**/*.js'];
12+
var testFiles = ['test/**/*.js'];
13+
var miscFiles = ['karma.conf.js', 'demo/**/*.js'];
14+
var bumpFiles = ['package.json', 'bower.json', 'README.md', 'src/js/*.js', 'src/css/*.css'];
15+
16+
module.exports = {
17+
all: bower.concat(sourceFiles).concat(testFiles).concat(miscFiles),
18+
app: sourceFiles,
19+
bump: bumpFiles,
20+
lint: ['gulpfile.js'].concat(sourceFiles).concat(testFiles).concat(miscFiles),
21+
test: testFiles
22+
};

0 commit comments

Comments
 (0)