tasks/download.js
function (orchardDownload) {
            var content, dest, zip;

            grunt.log.writeln('extracting downloaded zip...');

            fs.mkdirSync(options.tempDir);

            fs.readFile(options.downloadDestination, function (err, data) {
                if (err) {
                    throw err;
                }

                zip = new JSZip(data);

                Object.keys(zip.files).forEach(function(filename) {
                    content = zip.files[filename].asNodeBuffer();
                    dest = path.join(options.tempDir, filename);

                    if (filename.substr(filename.length - 1, 1) === '/') {
                        if (!fs.existsSync(dest)) {
                            fs.mkdirSync(dest);
                        }
                    } else {
                        helpers.writeFile(dest, content);
                    }
                });

                grunt.log.writeln('extraction complete.');

                // introduce a slight delay to prevent a permission error when moving
                // the Orchard source code from a temp directory to a directory
                // tied to the version number.
                setTimeout(moveFiles, 200);
            });
        }
function (orchardDownload) {
            var content, dest, zip;

            grunt.log.writeln('extracting downloaded zip...');

            fs.mkdirSync(options.tempDir);

            fs.readFile(options.downloadDestination, function (err, data) {
                if (err) {
                    throw err;
                }

                zip = new JSZip(data);

                Object.keys(zip.files).forEach(function(filename) {
                    content = zip.files[filename].asNodeBuffer();
                    dest = path.join(options.tempDir, filename);

                    if (filename.substr(filename.length - 1, 1) === '/') {
                        if (!fs.existsSync(dest)) {
                            fs.mkdirSync(dest);
                        }
                    } else {
                        helpers.writeFile(dest, content);
                    }
                });

                grunt.log.writeln('extraction complete.');

                // introduce a slight delay to prevent a permission error when moving
                // the Orchard source code from a temp directory to a directory
                // tied to the version number.
                setTimeout(moveFiles, 200);
            });
        }
function ( orchardDownload ) { var content , dest , zip ; grunt . log . writeln ( 'extracting downloaded zip...' ) ; fs . mkdirSync ( options . tempDir ) ; fs . readFile ( options . downloadDestination , function ( err , data ) { if ( err ) { throw err ; } zip = new JSZip ( data ) ; Object . keys ( zip . files ) . forEach ( function ( filename ) { content = zip . files [ filename ] . asNodeBuffer ( ) ; dest = path . join ( options . tempDir , filename ) ; if ( filename . substr ( filename . length - 1 , 1 ) === '/' ) { if ( ! fs . existsSync ( dest ) ) { fs . mkdirSync ( dest ) ; } } else { helpers . writeFile ( dest , content ) ; } } ) ; grunt . log . writeln ( 'extraction complete.' ) ; // introduce a slight delay to prevent a permission error when moving // the Orchard source code from a temp directory to a directory // tied to the version number. setTimeout ( moveFiles , 200 ) ; } ) ; }
Unzips the download that contains Orchard and sets up the extracted files
in a directory reflecting the version number.
Unzips the download that contains Orchard and sets up the extracted files in a directory reflecting the version number .