Skip to content

Instantly share code, notes, and snippets.

@fernandozamoraj
Created May 23, 2014 22:41
Show Gist options
  • Save fernandozamoraj/841bc7dd67fede0dac69 to your computer and use it in GitHub Desktop.
Save fernandozamoraj/841bc7dd67fede0dac69 to your computer and use it in GitHub Desktop.
/*
* grunt-backup
* https://github.com/igorzoriy/grunt-backup
*
* Copyright (c) 2013 Igor Zoriy
* Licensed under the MIT license.
*/
//copy does not work
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
backup: {
docs: {
src: '/Users/FernandoZ/Documents/fernando/pbuse_management',
dest: '/fernando/backups/pbuse/project/pbuse_docs_'+ getTimeStamp() +'.tgz',
compressionLevel: 2
}
},
copy: {
main: {
files: [
{ expand: true,
src: ['C:/dev/war archive/latestfile/*.*'],
dest: 'C:/fernando/backups/pbuse/war/'
}
]
}
}
});
grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-backup');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.registerTask('default', ['backup', 'copy']);
function getTimeStamp(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd='0'+dd
}
if(mm<10) {
mm='0'+mm
}
today = yyyy + '_' + mm + '_' + dd;
return today;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment