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/12/20 11:23:36 UTC
git commit: [flex-utilities] [refs/heads/feature-npm-install] - More
Falcon related progress.
Repository: flex-utilities
Updated Branches:
refs/heads/feature-npm-install 12f46dea0 -> d689886ff
More Falcon related progress.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/d689886f
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/d689886f
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/d689886f
Branch: refs/heads/feature-npm-install
Commit: d689886ff11bb7627cc93b69769232cd88fe2081
Parents: 12f46de
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Sun Dec 20 02:23:19 2015 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Sun Dec 20 02:23:19 2015 -0800
----------------------------------------------------------------------
npm-flexjs/dependencies/AdobeAIR.js | 41 ++++++++++--
npm-flexjs/dependencies/ApacheFalcon.js | 69 +++++++++++++++++++-
npm-flexjs/dependencies/ApacheFlexJS.js | 2 +-
npm-flexjs/dependencies/Constants.js | 4 +-
.../dependencies/DownloadUncompressAndCopy.js | 43 +++++++++---
npm-flexjs/dependencies/FlashPlayerGlobal.js | 30 ++++++---
npm-flexjs/dependencies/SWFObject.js | 3 +-
npm-flexjs/download_dependencies.js | 20 +++---
npm-flexjs/package.json | 4 +-
9 files changed, 175 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/AdobeAIR.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/AdobeAIR.js b/npm-flexjs/dependencies/AdobeAIR.js
index 7317fa5..bcfad50 100644
--- a/npm-flexjs/dependencies/AdobeAIR.js
+++ b/npm-flexjs/dependencies/AdobeAIR.js
@@ -22,6 +22,7 @@ var request = require('request');
var fs = require('fs');
var events = require('events');
var prompt = require('prompt');
+var unzip = require('unzip');
var constants = require('../dependencies/Constants');
@@ -38,7 +39,7 @@ http://www.adobe.com/products/air/sdk-eula.html.\n\
This license is not compatible with the Apache v2 license.\n\
Do you want to download and install the Adobe AIR SDK? (y/n)";
-AdobeAIR.promptForAdobeAIR = function()
+function promptForAdobeAIR()
{
var schema = {
properties: {
@@ -54,25 +55,51 @@ AdobeAIR.promptForAdobeAIR = function()
prompt.get(schema, function (err, result) {
if(result.accept.toLowerCase() == 'y')
{
- AdobeAIR.downloadAdobeAIR();
+ downloadAdobeAIR();
+ }
+ else
+ {
+ console.log('Aborting installation');
}
});
-};
+}
-AdobeAIR.downloadAdobeAIR = function()
+function downloadAdobeAIR()
{
- console.log('Downloading Adobe AIR SDK');
+ /*var downloadDetails = {
+ url:AdobeAIRURL,
+ remoteFileName:fileNameAdobeAIR,
+ destinationPath:constants.DOWNLOADS_FOLDER,
+ destinationFileName:'adobeair',
+ unzip:true
+ };
+ duc.on('installComplete', handleInstallComplete);
+ duc.install(downloadDetails);*/
+
+ console.log('Downloading Adobe AIR from ' + AdobeAIRURL + fileNameAdobeAIR);
request
.get(AdobeAIRURL + fileNameAdobeAIR)
.pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
.on('finish', function(){
console.log('Adobe AIR download complete');
+ extract();
+ })
+ );
+}
+
+function extract()
+{
+ console.log('Extracting Adobe AIR');
+ fs.createReadStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
+ .pipe(unzip.Extract({ path: constants.FLEXJS_FOLDER })
+ .on('finish', function(){
+ console.log('Adobe AIR extraction complete');
AdobeAIR.emit('complete');
})
);
-};
+}
AdobeAIR.install = function()
{
- AdobeAIR.promptForAdobeAIR();
+ promptForAdobeAIR();
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/ApacheFalcon.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/ApacheFalcon.js b/npm-flexjs/dependencies/ApacheFalcon.js
index d9d1c5e..5a2996b 100644
--- a/npm-flexjs/dependencies/ApacheFalcon.js
+++ b/npm-flexjs/dependencies/ApacheFalcon.js
@@ -22,6 +22,8 @@ var request = require('request');
var fs = require('fs');
var events = require('events');
var unzip = require('unzip');
+var wrench = require('wrench');
+var mkdirp = require('mkdirp');
var constants = require('../dependencies/Constants');
var duc = require('../dependencies/DownloadUncompressAndCopy');
@@ -54,7 +56,7 @@ var falconDependencies = [
remoteFileName:'commons-cli-1.2-bin.zip',
destinationPath:constants.DOWNLOADS_FOLDER,
destinationFileName:'',
- pathOfFileToBeCopiedFrom:constants.DOWNLOADS_FOLDER + 'commons-cli-1.2/commons-cli-1.2.jar',
+ pathOfFileToBeCopiedFrom:'commons-cli-1.2/commons-cli-1.2.jar',
pathOfFileToBeCopiedTo:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder + 'commons-cli.jar',
unzip:true
},
@@ -63,9 +65,48 @@ var falconDependencies = [
remoteFileName:'commons-io-2.4-bin.zip',
destinationPath:constants.DOWNLOADS_FOLDER,
destinationFileName:'',
- pathOfFileToBeCopiedFrom:constants.DOWNLOADS_FOLDER + 'commons-io-2.4/commons-io-2.4.jar',
+ pathOfFileToBeCopiedFrom:'commons-io-2.4/commons-io-2.4.jar',
pathOfFileToBeCopiedTo:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder + 'commons-io.jar',
unzip:true
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/com/google/guava/guava/17.0/',
+ remoteFileName:'guava-17.0.jar',
+ destinationPath:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder,
+ destinationFileName:'guava.jar',
+ unzip:false
+ },
+ {
+ url:'http://apacheflexbuild.cloudapp.net:8080/job/flex-falcon/ws/compiler/lib/',
+ remoteFileName:'jburg.jar',
+ destinationPath:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder,
+ destinationFileName:'jburg.jar',
+ unzip:false
+ },
+ {
+ url:'http://jflex.de/',
+ remoteFileName:'jflex-1.6.0.zip',
+ destinationPath:constants.DOWNLOADS_FOLDER,
+ destinationFileName:'',
+ pathOfFileToBeCopiedFrom:'jflex-1.6.0/lib/jflex-1.6.0.jar',
+ pathOfFileToBeCopiedTo:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder + 'jflex.jar',
+ unzip:true
+ },
+ {
+ url:'http://www.java2s.com/Code/JarDownload/lzma/',
+ remoteFileName:'lzma-9.20.jar.zip',
+ destinationPath:constants.DOWNLOADS_FOLDER + 'lzma/',
+ destinationFileName:'lzma-9.20.jar.zip',
+ pathOfFileToBeCopiedFrom:'lzma-9.20.jar',
+ pathOfFileToBeCopiedTo:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder + 'lzma-sdk.jar',
+ unzip:true
+ },
+ {
+ url:'http://search.maven.org/remotecontent?filepath=/org/apache/flex/flex-tool-api/1.0.0/',
+ remoteFileName:'flex-tool-api-1.0.0.jar',
+ destinationPath:constants.DOWNLOADS_FOLDER + falconCompilerLibFolder,
+ destinationFileName:'flex-tool-api.jar',
+ unzip:false
}
];
@@ -130,7 +171,7 @@ ApacheFalcon.downloadNextDependency = function()
}
else
{
- duc.on("downloadComplete", handleDependencyInstallComplete);
+ duc.on("installComplete", handleDependencyInstallComplete);
duc.install(falconDependencies[currentStep]);
}
};
@@ -142,9 +183,31 @@ function handleDependencyInstallComplete(event)
ApacheFalcon.dependenciesComplete = function()
{
+ duc.removeListener("installComplete", handleDependencyInstallComplete);
+ copyFiles();
ApacheFalcon.falconInstallComplete();
};
+function copyFiles()
+{
+ //Ant TODO:FIXME
+
+ //Bin
+ //Create downloads directory if it does not exist already
+ try
+ {
+ mkdirp(constants.FLEXJS_FOLDER + 'bin');
+ }
+ catch(e)
+ {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+ wrench.copyDirSyncRecursive(constants.DOWNLOADS_FOLDER + 'falcon/compiler/generated/dist/sdk/bin',
+ constants.FLEXJS_FOLDER + 'bin', {
+ forceDelete: true
+ });
+}
+
ApacheFalcon.falconInstallComplete = function()
{
ApacheFalcon.emit('complete');
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/ApacheFlexJS.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/ApacheFlexJS.js b/npm-flexjs/dependencies/ApacheFlexJS.js
index d618e87..23e79f6 100644
--- a/npm-flexjs/dependencies/ApacheFlexJS.js
+++ b/npm-flexjs/dependencies/ApacheFlexJS.js
@@ -53,7 +53,7 @@ ApacheFlexJS.extract = function()
{
console.log('Extracting Apache FlexJS');
fs.createReadStream(constants.DOWNLOADS_FOLDER + fileNameFlexJSBinary)
- .pipe(unzip.Extract({ path: constants.NODE_MODULES_FOLDER + constants.FLEXJS_FOLDER })
+ .pipe(unzip.Extract({ path: constants.FLEXJS_FOLDER })
.on('finish', function(){
console.log('Apache FlexJS extraction complete');
ApacheFlexJS.emit('complete');
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/Constants.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/Constants.js b/npm-flexjs/dependencies/Constants.js
index 84539ae..98305a3 100644
--- a/npm-flexjs/dependencies/Constants.js
+++ b/npm-flexjs/dependencies/Constants.js
@@ -22,7 +22,7 @@ module.exports =
{
APACHE_MIRROR_RESOLVER_URL : 'http://www.apache.org/dyn/mirrors/mirrors.cgi/',
REQUEST_JSON_PARAM : 'asjson=true',
- DOWNLOADS_FOLDER : 'downloads/',
- FLEXJS_FOLDER: 'flexjs',
+ DOWNLOADS_FOLDER : 'node_modules/flexjs/downloads/',
+ FLEXJS_FOLDER: 'node_modules/flexjs/',
NODE_MODULES_FOLDER: 'node_modules/'
};
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/DownloadUncompressAndCopy.js b/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
index 1c6d1fe..d15e18f 100644
--- a/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
+++ b/npm-flexjs/dependencies/DownloadUncompressAndCopy.js
@@ -39,7 +39,7 @@ DownloadUncompressAndCopy.downloadFile = function(item)
{//Unzip
console.log('Uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName);
fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
- .pipe(unzip.Extract({ path: item.destinationPath + item.destinationFileName})
+ /*.pipe(unzip.Extract({ path: item.destinationPath + item.destinationFileName})
.on('finish', function(){
console.log('Finished uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName + ' to: ' + item.destinationPath + item.destinationFileName);
if(item.pathOfFileToBeCopiedTo != undefined)
@@ -47,19 +47,44 @@ DownloadUncompressAndCopy.downloadFile = function(item)
fs.createReadStream(item.pathOfFileToBeCopiedFrom)
.pipe(fs.createWriteStream(item.pathOfFileToBeCopiedTo)
.on('finish',function(){
- DownloadUncompressAndCopy.emit('downloadComplete');
+ DownloadUncompressAndCopy.emit('installComplete');
}));
}
- })
- );
+ else
+ {
+ DownloadUncompressAndCopy.emit('installComplete');
+ }
+ })*/
+ .pipe(unzip.Parse())
+ .on('entry', function (entry) {
+ var fileName = entry.path;
+ var type = entry.type; // 'Directory' or 'File'
+ var size = entry.size;
+ if (fileName === item.pathOfFileToBeCopiedFrom) {
+ entry.pipe(fs.createWriteStream(item.pathOfFileToBeCopiedTo));
+ } else {
+ entry.autodrain();
+ }
+ })
+ .on('finish', function(){
+ console.log('Finished uncompressing: ' + constants.DOWNLOADS_FOLDER + item.remoteFileName + ' to: ' + item.destinationPath + item.destinationFileName);
+ DownloadUncompressAndCopy.emit('installComplete');
+ })
+
}
else
{//Just copy
- fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
- .pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName)
- .on('finish',function() {
- DownloadUncompressAndCopy.emit('downloadComplete');
- }));
+ if((constants.DOWNLOADS_FOLDER + item.remoteFileName == item.destinationPath + item.destinationFileName))
+ {
+ DownloadUncompressAndCopy.emit('installComplete');
+ }
+ else {
+ fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+ .pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName)
+ .on('finish',function() {
+ DownloadUncompressAndCopy.emit('installComplete');
+ }));
+ }
}
})
);
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/FlashPlayerGlobal.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/FlashPlayerGlobal.js b/npm-flexjs/dependencies/FlashPlayerGlobal.js
index 1b820e8..ff15bdf 100644
--- a/npm-flexjs/dependencies/FlashPlayerGlobal.js
+++ b/npm-flexjs/dependencies/FlashPlayerGlobal.js
@@ -24,6 +24,7 @@ var events = require('events');
var prompt = require('prompt');
var constants = require('../dependencies/Constants');
+var duc = require('../dependencies/DownloadUncompressAndCopy');
var FlashPlayerGlobal = module.exports = Object.create(events.EventEmitter.prototype);
@@ -63,22 +64,35 @@ FlashPlayerGlobal.promptForFlashPlayerGlobal = function()
{
FlashPlayerGlobal.downloadFlashPlayerGlobal();
}
+ else
+ {
+ console.log('Aborting installation');
+ }
});
};
FlashPlayerGlobal.downloadFlashPlayerGlobal = function()
{
console.log('Downloading Adobe FlashPlayerGlobal.swc ');
- request
- .get(flashPlayerGlobalURL + fileNameFlashPlayerGlobal)
- .pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameFlashPlayerGlobal)
- .on('finish', function(){
- console.log('FlashPlayerGlobal download complete');
- FlashPlayerGlobal.emit('complete');
- })
- );
+
+ var downloadDetails = {
+ url:flashPlayerGlobalURL,
+ remoteFileName:fileNameFlashPlayerGlobal,
+ destinationPath:constants.DOWNLOADS_FOLDER,
+ destinationFileName:fileNameFlashPlayerGlobal,
+ unzip:false
+ };
+
+ duc.on('installComplete', handleInstallComplete);
+ duc.install(downloadDetails);
+
};
+function handleInstallComplete(event)
+{
+ FlashPlayerGlobal.emit('complete');
+}
+
FlashPlayerGlobal.install = function()
{
FlashPlayerGlobal.promptForFlashPlayerGlobal();
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/dependencies/SWFObject.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/dependencies/SWFObject.js b/npm-flexjs/dependencies/SWFObject.js
index 7af6052..5212c4f 100644
--- a/npm-flexjs/dependencies/SWFObject.js
+++ b/npm-flexjs/dependencies/SWFObject.js
@@ -27,7 +27,8 @@ var constants = require('../dependencies/Constants');
var SWFObject = module.exports = Object.create(events.EventEmitter.prototype);
//SWFObject
-var swfObjectURL = 'https://github.com/swfobject/swfobject/archive/2.2.zip';
+//var swfObjectURL = 'https://github.com/swfobject/swfobject/archive/2.2.zip';
+var swfObjectURL = 'https://swfobject.googlecode.com/files/';
var fileNameSwfObject = 'swfobject_2_2.zip';
SWFObject.downloadSwfObject = function()
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/download_dependencies.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/download_dependencies.js b/npm-flexjs/download_dependencies.js
index 122fe6d..8187566 100644
--- a/npm-flexjs/download_dependencies.js
+++ b/npm-flexjs/download_dependencies.js
@@ -20,6 +20,7 @@
'use strict';
var fs = require('fs');
+var mkdirp = require('mkdirp');
var constants = require('./dependencies/Constants');
var adobeair = require('./dependencies/AdobeAIR');
var flashplayerglobal = require('./dependencies/FlashPlayerGlobal');
@@ -31,9 +32,10 @@ var installSteps = [
createDownloadsDirectory,
installFlashPlayerGlobal,
installAdobeAIR,
+ installSWFObject,
installApacheFlexJS,
- installApacheFalcon,
- installSWFObject];
+ installApacheFalcon
+ ];
var currentStep = 0;
function start()
@@ -46,7 +48,7 @@ function createDownloadsDirectory()
//Create downloads directory if it does not exist already
try
{
- fs.mkdirSync(constants.DOWNLOADS_FOLDER);
+ mkdirp(constants.DOWNLOADS_FOLDER);
}
catch(e)
{
@@ -73,37 +75,37 @@ function handleInstallStepComplete(event)
function installFlashPlayerGlobal()
{
- flashplayerglobal.on('complete', handleInstallStepComplete);
+ flashplayerglobal.once('complete', handleInstallStepComplete);
flashplayerglobal.install();
}
function installAdobeAIR(event)
{
- adobeair.on('complete', handleInstallStepComplete);
+ adobeair.once('complete', handleInstallStepComplete);
adobeair.install();
}
function installApacheFlexJS(event)
{
- apacheFlexJS.on('complete', handleInstallStepComplete);
+ apacheFlexJS.once('complete', handleInstallStepComplete);
apacheFlexJS.install();
}
function installApacheFalcon(event)
{
- apacheFalcon.on('complete', handleInstallStepComplete);
+ apacheFalcon.once('complete', handleInstallStepComplete);
apacheFalcon.install();
}
function installSWFObject(event)
{
- swfObject.on('complete', handleInstallStepComplete);
+ swfObject.once('complete', handleInstallStepComplete);
swfObject.install();
}
function allDownloadsComplete()
{
- console.log('Completed all downloads');
+ console.log('Finished all downloads');
}
start();
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/d689886f/npm-flexjs/package.json
----------------------------------------------------------------------
diff --git a/npm-flexjs/package.json b/npm-flexjs/package.json
index b16e4ac..fa3a420 100644
--- a/npm-flexjs/package.json
+++ b/npm-flexjs/package.json
@@ -20,8 +20,10 @@
"author": "OmPrakash Muppirala <bi...@apache.org>",
"license": "Apache-2.0",
"dependencies": {
+ "mkdirp": "^0.5.1",
"prompt": "^0.2.14",
"request": "^2.67.0",
- "unzip": "^0.1.11"
+ "unzip": "^0.1.11",
+ "wrench": "^1.5.8"
}
}