lib/auto-generate.js
function makeBackup(filePath) {
    var dateString = new Date().toISOString().replace(/:/g, '.').replace('Z', '').replace('T', ' ');
    try         { fs.mkdirSync(path.join(path.dirname(filePath), 'BACKUP')); }
    catch(err)  { if (err.code != 'EEXIST') { throw err } }
    fs.writeFileSync(path.join(path.dirname(filePath), 'BACKUP', dateString + ' ' + path.basename(filePath) ), fs.readFileSync(path.normalize(filePath)));
}
function makeBackup(filePath) {
    var dateString = new Date().toISOString().replace(/:/g, '.').replace('Z', '').replace('T', ' ');
    try         { fs.mkdirSync(path.join(path.dirname(filePath), 'BACKUP')); }
    catch(err)  { if (err.code != 'EEXIST') { throw err } }
    fs.writeFileSync(path.join(path.dirname(filePath), 'BACKUP', dateString + ' ' + path.basename(filePath) ), fs.readFileSync(path.normalize(filePath)));
}
function makeBackup ( filePath ) { var dateString = new Date ( ) . toISOString ( ) . replace ( / : / g , '.' ) . replace ( 'Z' , '' ) . replace ( 'T' , ' ' ) ; try { fs . mkdirSync ( path . join ( path . dirname ( filePath ) , 'BACKUP' ) ) ; } catch ( err ) { if ( err . code != 'EEXIST' ) { throw err } } fs . writeFileSync ( path . join ( path . dirname ( filePath ) , 'BACKUP' , dateString + ' ' + path . basename ( filePath ) ) , fs . readFileSync ( path . normalize ( filePath ) ) ) ; }
Creates backup of a file. To do this, it creates a directory called BACKUP in the same directory where
original file is located in. Backup file name has a suffix of ISO style date and time.
ie. 'model.js' becomes '2014-01-12 22.02.23.345 model.js'
@private
@param {string} filePath - Absolute path of file
Creates backup of a file . To do this it creates a directory called BACKUP in the same directory where original file is located in . Backup file name has a suffix of ISO style date and time . ie . model . js becomes 2014 - 01 - 12 22 . 02 . 23 . 345 model . js