December 31, 2013
Keeping Ghost up to date with Grunt and Git
I use Ghost for this blog. With Ghost still being in its infancy, I want to keep the core platform up to date. There's several ways to do this and none is necessarily the best, however I've been getting into Grunt recently so here's my approach with Grunt.
I have Ghost as a submodule in my project so I have a Grunt task that simply does a git pull
and then copies the core files into my project.
Gruntfile.js
module.exports = function(grunt) {
var exec = require('child_process').exec;
grunt.initConfig({
copy: {
update: {
files: [
{expand: true, src: ['ghost/core/**'], dest: 'core/'}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('update', function(){
var done = this.async();
//Do a git pull
exec("cd ghost && git pull", function(error, stdout, stderr){
//Copy core files
done();
grunt.task.run('copy:update');
});
});
}