MCPcopy Create free account
hub / github.com/danthareja/node-google-apps-script / build

Function build

lib/manifestor.js:18–48  ·  view source on GitHub ↗
(externalFiles)

Source from the content-addressed store, hash-verified

16 @return {Object} manifest
17 */
18var build = function(externalFiles) {
19 return getConfig().get('path')
20 .then(util.getFilesFromDisk)
21 .then(function(files) {
22
23 // for each manifest file, if it has an equivalent on disk, keep it
24 // otherwise trash it
25 var filesToUpload = _.filter(externalFiles, function(externalFile) {
26 return util.hasFileOnDisk(files, externalFile);
27 });
28
29 _.each(files, function(file) {
30 // Add new file or update existing record
31 var manifestFile = getFileInManifest(filesToUpload, file);
32 if (manifestFile === undefined) {
33 // add
34 filesToUpload.push({
35 name: file.name,
36 type: util.getFileType(file),
37 source: file.content
38 });
39
40 } else {
41 // update
42 util.updateFileSource(manifestFile, file);
43 }
44 });
45
46 return filesToUpload;
47 });
48};
49
50function getFileInManifest(files, file) {
51 return _.findWhere(files, {

Callers

nothing calls this directly

Calls 2

getConfigFunction · 0.85
getFileInManifestFunction · 0.85

Tested by

no test coverage detected