Skip to content

Commit

Permalink
GPII-4171: Added copying of optional artifacts mechanism
Browse files Browse the repository at this point in the history
Also, added the outputPath in data/artifacts.json5 for this new
mechanism to copy the files to the right place.
  • Loading branch information
javihernandez committed Apr 7, 2020
1 parent 775f0e2 commit f1807f8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
16 changes: 12 additions & 4 deletions data/artifacts.json5
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
// No outputPath, the output location is always c:/installer/gpii-app
"gpii-app": {
"type": "gpii.installer.artifact.githubRepoDownloader",
"options": {
Expand All @@ -7,6 +8,7 @@
"output": "gpii-app"
}
},
// No outputPath, the output location is always c:/installer/
"gpii-wix-installer": {
"type": "gpii.installer.artifact.githubRepoDownloader",
"options": {
Expand All @@ -15,32 +17,38 @@
"output": "gpii-wix-installer"
}
},
// For the rest of the artifacts, we need to provide the outputPath, always
// relative to the buildFolder, by default, c:/installer
"morphic-sharex-installer": {
"type": "gpii.installer.artifact.downloader",
"options": {
"downloadUrl": "https://github.com/javihernandez/morphic-sharex-installer/releases/download/0.1/sharex.msm",
"output": "sharex.msm"
"output": "sharex.msm",
"outputPath": "sharex.msm"
}
},
"morphic-documorph-installer": {
"type": "gpii.installer.artifact.downloader",
"options": {
"downloadUrl": "https://github.com/javihernandez/morphic-documorph-installer/releases/download/0.1/documorph.msm",
"output": "documorph.msm"
"output": "documorph.msm",
"outputPath": "documorph.msm"
}
},
"gpii-filebeat-installer": {
"type": "gpii.installer.artifact.downloader",
"options": {
"downloadUrl": "https://github.com/stegru/gpii-filebeat-installer/releases/download/1.0.0/filebeat.msm",
"output": "filebeat.msm"
"output": "filebeat.msm",
"outputPath": "filebeat.msm"
}
},
"resetToStandardFile": {
"type": "gpii.installer.artifact.downloader",
"options": {
"downloadUrl": "https://raw.githubusercontent.com/GPII/universal/master/testData/defaultSettings/defaultSettings.win32.json5",
"output": "defaultSettings.json5"
"output": "defaultSettings.json5",
"outputPath": "staging/windows/resources/app/node_modules/gpii-universal/testData/defaultSettings/defaultSettings.json5"
}
}
}
25 changes: 23 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ fluid.defaults("gpii.installer", {
funcName: "gpii.installer.shrinkSize",
args: ["{that}"]
},
copyOptionalArtifacts: {
funcName: "gpii.installer.copyOptionalArtifacts",
args: ["{that}"]
},
runMsbuild: {
funcName: "gpii.installer.runMsbuild",
args: ["{that}"]
Expand All @@ -87,6 +91,7 @@ fluid.defaults("gpii.installer", {
onPackaged: null,
onWindowsServiceReady: null,
onShrunk: null,
onCopiedOptionalArtifacts: null,
onError: null
},
listeners: {
Expand Down Expand Up @@ -118,8 +123,12 @@ fluid.defaults("gpii.installer", {
funcName: "fluid.log",
args: ["Shrunk size of node_modules folder"]
},
"onShrunk.runMsbuild": "{that}.runMsbuild",
//"onWindowsServiceReady.runMsbuild": "{that}.runMsbuild",
"onShrunk.copyOptionalArtifacts": "{that}.copyOptionalArtifacts",
"onCopiedOptionalArtifacts.logResult": {
funcName: "fluid.log",
args: ["Copied optional artifacts"]
},
"onCopiedOptionalArtifacts.runMsbuild": "{that}.runMsbuild",
"onError.logError": {
funcName: "fluid.fail",
args: "{arguments}.0"
Expand Down Expand Up @@ -263,6 +272,18 @@ gpii.installer.shrinkSize = function (that) {
});
};

gpii.installer.copyOptionalArtifacts = function (that) {
fluid.each(that.options.artifactsData, function (artifactData) {
if (artifactData.options.outputPath) {
var source = path.join(that.options.artifactsFolder, artifactData.options.output);
var target = path.join(that.options.buildFolder, artifactData.options.outputPath);
fs.copyFileSync(source, target);
fluid.log("Copied ", source, " to ", target);
}
});
that.events.onCopiedOptionalArtifacts.fire();
}

gpii.installer.runMsbuild = function (that) {
// create output and temp folders in c:/installer
var outputFolder = path.join(that.options.buildFolder, "output");
Expand Down

0 comments on commit f1807f8

Please sign in to comment.