Batch update repo copyrights with gulpjs
Ever had to update all your github repo license, readme, and package copyrights when the new year came around?
Why not update them all with a build system:
gulpjs (http://gulpjs.com) The streaming build system
gulpfile.js:
var gulp = require('gulp');
var git = require('gulp-git');
var replace = require('gulp-replace');
gulp.task('year', function() {
gulp.src('./folder/LICENSE') // the location of the file to be updated
.pipe(replace('2013', '2014')) // replace the year
.pipe(gulp.dest('./folder')) // the file's folder
.pipe(git.add()) // add to the file's git repo
.pipe(git.commit('bump')) // commit message is bump
.on('end', function(){
git.push('origin','master'); // push it up!
});
});
gulp.task('default', function() {
gulp.run('year');
});
To update all your git repos:
var gulp = require('gulp');
var git = require('gulp-git');
var replace = require('gulp-replace');
gulp.task('year', function() {
gulp.src('./*/LICENSE')
.pipe(replace('2013', '2014'))
.pipe(gulp.dest('./*'))
.pipe(git.add())
.pipe(git.commit('bump'))
.on('end', function(){
git.push('origin','master'); // push it up!
});
});
gulp.task('default', function() {
gulp.run('year');
});
You can use ./* ./*/ or other folder sequences.
More information regarding gulp: http://gulpjs.com
Written by S.Lacy
Related protips
2 Responses
Hello, I'm Rodolfo Dias and I'm from Brazil.
Recently I created a Gulp Web App Workflow project in my github, and I want share with you. Is a Open Source project, so feel good to contribute or use.
Have a some question? Speak with me.
over 1 year ago
·
I just noticed the gulp-git plugin today. I was trying to think of some cool uses of it and ran into this tip. +1, Really good idea!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#