tasks/init.js
function(srcpath, destpath, options) {
        // Destpath is optional.
        if (typeof destpath !== 'string') {
          options = destpath;
          destpath = srcpath;
        }
        // Ensure srcpath is absolute.
        if (!grunt.file.isPathAbsolute(srcpath)) {
          srcpath = init.srcpath(srcpath);
        }
        // Use placeholder file if no src exists.
        if (!srcpath) {
          srcpath = helpers.getFile('misc/placeholder');
        }
        grunt.verbose.or.write('Writing ' + destpath + '...');
        try {
          grunt.file.copy(srcpath, init.destpath(destpath), options);
          grunt.verbose.or.ok();
        } catch(e) {
          grunt.verbose.or.error().error(e);
          throw e;
        }
      }
function(srcpath, destpath, options) {
        // Destpath is optional.
        if (typeof destpath !== 'string') {
          options = destpath;
          destpath = srcpath;
        }
        // Ensure srcpath is absolute.
        if (!grunt.file.isPathAbsolute(srcpath)) {
          srcpath = init.srcpath(srcpath);
        }
        // Use placeholder file if no src exists.
        if (!srcpath) {
          srcpath = helpers.getFile('misc/placeholder');
        }
        grunt.verbose.or.write('Writing ' + destpath + '...');
        try {
          grunt.file.copy(srcpath, init.destpath(destpath), options);
          grunt.verbose.or.ok();
        } catch(e) {
          grunt.verbose.or.error().error(e);
          throw e;
        }
      }
function ( srcpath , destpath , options ) { // Destpath is optional. if ( typeof destpath !== 'string' ) { options = destpath ; destpath = srcpath ; } // Ensure srcpath is absolute. if ( ! grunt . file . isPathAbsolute ( srcpath ) ) { srcpath = init . srcpath ( srcpath ) ; } // Use placeholder file if no src exists. if ( ! srcpath ) { srcpath = helpers . getFile ( 'misc/placeholder' ) ; } grunt . verbose . or . write ( 'Writing ' + destpath + '...' ) ; try { grunt . file . copy ( srcpath , init . destpath ( destpath ) , options ) ; grunt . verbose . or . ok ( ) ; } catch ( e ) { grunt . verbose . or . error ( ) . error ( e ) ; throw e ; } }
Given an absolute or relative source path, and an optional relative destination path, copy a file, optionally processing it through the passed callback.
Given an absolute or relative source path and an optional relative destination path copy a file optionally processing it through the passed callback .