Skip to content

Instantly share code, notes, and snippets.

@jacopen
Created December 15, 2015 12:10
Show Gist options
  • Save jacopen/1f7e2ad10636d088755b to your computer and use it in GitHub Desktop.
Save jacopen/1f7e2ad10636d088755b to your computer and use it in GitHub Desktop.
Gruntfile.js
module.exports = function(grunt) {
var moment = require('moment');
var repo_dir = "/home/jacopen/Project/node_modules/node-red/config"
var files = ["king_cred.json", "king.json"]
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
flow: {
files: 'config/*.json',
tasks: ['gitcommit:task']
},
master: {
files: 'version',
tasks: ['gitcheckout:master', 'gitmerge:task', 'gittag:task', 'gitcheckout:develop']
}
},
gitcommit: {
task:{
options: {
cwd: repo_dir,
message: moment().format(),
},
files: {
src: files,
cwd: repo_dir
}
}
},
gitcheckout: {
master: {
options: {
cwd: repo_dir,
branch: "master"
}
},
develop: {
options: {
cwd: repo_dir,
branch: "develop"
}
}
},
gitmerge: {
task: {
options: {
cwd: repo_dir,
branch: "develop"
}
}
},
gittag: {
task: {
options: {
cwd: repo_dir,
tag: grunt.file.read('version').replace(/\n/, '')
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-git');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment