Skip to content

Commit

Permalink
New Chart.js samples package
Browse files Browse the repository at this point in the history
Samples need to be packaged with built libraries (which one have been removed from the repository), so create a new Gulp `package` task to zip dist/** and samples/** together. The archive is located in dist/chartjs-complete.zip and will be deployed by Travis along the GH release.
  • Loading branch information
simonbrunel committed May 14, 2016
1 parent 661a1cf commit bb97d20
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ script:
- gulp build
- gulp test
- gulp coverage
- gulp package
- cat ./coverage/lcov.info | ./node_modules/.bin/coveralls

notifications:
Expand All @@ -39,6 +40,7 @@ deploy:
- "./dist/Chart.bundle.min.js"
- "./dist/Chart.js"
- "./dist/Chart.min.js"
- "./dist/chartjs-samples.zip"
skip_cleanup: true
on:
tags: true
12 changes: 10 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var gulp = require('gulp'),
replace = require('gulp-replace'),
htmlv = require('gulp-html-validator'),
insert = require('gulp-insert'),
zip = require('gulp-zip'),
inquirer = require('inquirer'),
semver = require('semver'),
exec = require('child_process').exec,
Expand Down Expand Up @@ -49,6 +50,7 @@ var testFiles = [
];

gulp.task('build', buildTask);
gulp.task('package', packageTask);
gulp.task('coverage', coverageTask);
gulp.task('watch', watchTask);
gulp.task('bump', bumpTask);
Expand Down Expand Up @@ -99,6 +101,12 @@ function buildTask() {

}

function packageTask() {
return gulp.src(['./dist/**', './samples/**'], { "base" : "." })
.pipe(zip('chartjs-samples.zip'))
.pipe(gulp.dest('./dist'));
}

/*
* Usage : gulp bump
* Prompts: Version increment to bump
Expand Down Expand Up @@ -126,10 +134,10 @@ function bumpTask(complete) {
// Write these to their own files, then build the output
fs.writeFileSync('package.json', JSON.stringify(package, null, 2));
fs.writeFileSync('bower.json', JSON.stringify(bower, null, 2));

var oldCDN = 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/'+oldVersion+'/Chart.min.js',
newCDN = 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/'+newVersion+'/Chart.min.js';

gulp.src(['./README.md'])
.pipe(replace(oldCDN, newCDN))
.pipe(gulp.dest('./'));
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"gulp-uglify": "~0.2.x",
"gulp-umd": "~0.2.0",
"gulp-util": "~2.2.x",
"gulp-zip": "~3.2.0",
"inquirer": "^0.5.1",
"jasmine": "^2.3.2",
"jasmine-core": "^2.3.4",
Expand Down

0 comments on commit bb97d20

Please sign in to comment.