You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2015/11/29 11:19:19 UTC

git commit: [flex-utilities] [refs/heads/feature-npm-install] - Make download steps easier to follow and modify.

Repository: flex-utilities
Updated Branches:
  refs/heads/feature-npm-install 5ea837a34 -> 7a8747d10


Make download steps easier to follow and modify.


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/7a8747d1
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/7a8747d1
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/7a8747d1

Branch: refs/heads/feature-npm-install
Commit: 7a8747d10436a1d3fc1aef7c6a63cb8c9aafd265
Parents: 5ea837a
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Sun Nov 29 02:19:02 2015 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Sun Nov 29 02:19:02 2015 -0800

----------------------------------------------------------------------
 npm-flexjs/download_dependencies.js | 63 ++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/7a8747d1/npm-flexjs/download_dependencies.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/download_dependencies.js b/npm-flexjs/download_dependencies.js
index d2cb82e..87a2469 100644
--- a/npm-flexjs/download_dependencies.js
+++ b/npm-flexjs/download_dependencies.js
@@ -27,6 +27,20 @@ var apacheFlexJS = require('./dependencies/ApacheFlexJS');
 var apacheFalcon = require('./dependencies/ApacheFalcon');
 var swfObject = require('./dependencies/SWFObject');
 
+var installSteps = [
+    createDownloadsDirectory,
+    installFlashPlayerGlobal,
+    installAdobeAIR,
+    installApacheFlexJS,
+    installApacheFalcon,
+    installSWFObject];
+var currentStep = 0;
+
+function start()
+{
+    installSteps[0].call();
+}
+
 function createDownloadsDirectory()
 {
     //Create downloads directory if it does not exist already
@@ -38,42 +52,59 @@ function createDownloadsDirectory()
     {
         if ( e.code != 'EEXIST' ) throw e;
     }
+    handleInstallStepComplete();
+}
+
+
+function handleInstallStepComplete(event)
+{
+    currentStep += 1;
+    if(currentStep >= installSteps.length)
+    {
+        allDownloadsComplete();
+    }
+    else
+    {
+        if(installSteps[currentStep] != undefined)
+        {
+            installSteps[currentStep].call();
+        }
+    }
 }
 
-function handleFlashPlayerGlobalComplete(event)
+function installFlashPlayerGlobal()
 {
-    adobeair.on('complete', handleAdobeAIRComplete);
+    flashplayerglobal.on('complete', handleInstallStepComplete);
+    flashplayerglobal.install();
+}
+
+function installAdobeAIR(event)
+{
+    adobeair.on('complete', handleInstallStepComplete);
     adobeair.install();
 }
 
-function handleAdobeAIRComplete(event)
+function installApacheFlexJS(event)
 {
-    apacheFlexJS.on('complete', handleApacheFlexJSComplete);
+    apacheFlexJS.on('complete', handleInstallStepComplete);
     apacheFlexJS.install();
 }
 
-function handleApacheFlexJSComplete(event)
+function installApacheFalcon(event)
 {
-    apacheFalcon.on('complete', handleApacheFalconComplete);
+    apacheFalcon.on('complete', handleInstallStepComplete);
     apacheFalcon.install();
 }
 
-function handleApacheFalconComplete(event)
+function installSWFObject(event)
 {
-    swfObject.on('complete', handleSwfObjectComplete);
+    swfObject.on('complete', handleInstallStepComplete);
     swfObject.install();
 }
 
-function handleSwfObjectComplete(event)
-{
-    allDownloadsComplete();
-}
-
 function allDownloadsComplete()
 {
     console.log('Completed all downloads');
 }
 
-createDownloadsDirectory();
-flashplayerglobal.on('complete', handleFlashPlayerGlobalComplete);
-flashplayerglobal.install();
\ No newline at end of file
+start();