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/23 11:21:29 UTC
git commit: [flex-utilities] [refs/heads/feature-npm-install] -
Beginnings of npm install functionality for Apache FlexJS. WIP.
Repository: flex-utilities
Updated Branches:
refs/heads/feature-npm-install [created] c0a4b929b
Beginnings of npm install functionality for Apache FlexJS. WIP.
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/c0a4b929
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/c0a4b929
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/c0a4b929
Branch: refs/heads/feature-npm-install
Commit: c0a4b929b595179f4407d7aef1b6aadc3b0b9b4a
Parents: bbb98e9
Author: OmPrakash Muppirala <bi...@gmail.com>
Authored: Mon Nov 23 02:21:05 2015 -0800
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Mon Nov 23 02:21:05 2015 -0800
----------------------------------------------------------------------
.gitignore | 2 +
npm-flexjs/package.json | 27 +++++++++++++
npm-flexjs/prepublish.js | 93 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 122 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c0a4b929/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index a1386da..b5fed5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,3 +121,5 @@ Squiggly/main/generated/
flex-installer/deps
MD5Checker/MD5CheckerLog.txt
+node_modules
+npm-flexjs.iml
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c0a4b929/npm-flexjs/package.json
----------------------------------------------------------------------
diff --git a/npm-flexjs/package.json b/npm-flexjs/package.json
new file mode 100644
index 0000000..d19c3a0
--- /dev/null
+++ b/npm-flexjs/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "apache-flexjs",
+ "version": "0.5.0",
+ "description": "Apache FlexJS",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [
+ "flex",
+ "flexjs",
+ "apache",
+ "flexjs",
+ "actionscript",
+ "as3",
+ "mxml",
+ "angularjs",
+ "reactjs"
+ ],
+ "author": "OmPrakash Muppirala <bi...@apache.org>",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "prompt": "^0.2.14",
+ "request": "^2.67.0",
+ "unzip": "^0.1.11"
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/c0a4b929/npm-flexjs/prepublish.js
----------------------------------------------------------------------
diff --git a/npm-flexjs/prepublish.js b/npm-flexjs/prepublish.js
new file mode 100644
index 0000000..1ac5d20
--- /dev/null
+++ b/npm-flexjs/prepublish.js
@@ -0,0 +1,93 @@
+'use strict';
+
+var request = require('request');
+var fs = require('fs');
+var prompt = require('prompt');
+
+var apacheMirrorsCGI = 'http://www.apache.org/dyn/mirrors/mirrors.cgi/';
+
+//FlexJS
+var pathToFlexJSBinary = 'flex/flexjs/0.5.0/binaries/';
+var fileNameFlexJSBinary = 'apache-flex-flexjs-0.5.0-bin.zip';
+
+//Falcon
+var pathToFalconBinary = 'flex/falcon/0.5.0/binaries/';
+var fileNameFalconBinary = 'apache-flex-falconjx-0.5.0-bin.zip';
+
+//Adobe AIR
+var AdobeAIRURL = 'http://airdownload.adobe.com/air/win/download/20.0/';
+var fileNameAdobeAIR = 'AdobeAIRSDK.zip';
+
+//Flash Player Global
+
+var requestJSON = 'asjson=true';
+
+var createDownloadsDirectory = function()
+{
+ try {
+ fs.mkdirSync('downloads');
+ } catch(e) {
+ if ( e.code != 'EEXIST' ) throw e;
+ }
+}
+
+var handleFlexJSMirrorsResponse = function (error, response, body)
+{
+ if (!error && response.statusCode == 200)
+ {
+ var mirrors = JSON.parse(body);
+ var flexJSPreferredDownloadURL = mirrors.preferred + pathToFlexJSBinary + fileNameFlexJSBinary;
+ //Download FlexJS
+ //request(this.flexJSPreferredDownloadURL, handleFlexJSBinaryResponse);
+ request
+ .get(flexJSPreferredDownloadURL)
+ .on('response', function(response) {
+ })
+ .pipe(fs.createWriteStream('downloads//' + fileNameFlexJSBinary));
+ }
+
+};
+
+var handleFalconMirrorsResponse = function (error, response, body)
+{
+ if (!error && response.statusCode == 200)
+ {
+ var mirrors = JSON.parse(body);
+ var falconPreferredDownloadURL = mirrors.preferred + pathToFalconBinary + fileNameFalconBinary;
+ //Download Falcon
+ request
+ .get(falconPreferredDownloadURL)
+ .on('response', function(response) {
+ })
+ .pipe(fs.createWriteStream('downloads//' + fileNameFalconBinary));
+ }
+
+};
+
+var promptForAdobeAIR = function()
+{
+ var schema = {
+ properties: {
+ accept: {
+ description: "Do you accept Adobe's license?",
+ pattern: /^[YNyn\s]{1}$/,
+ message: 'Please respond with either y or n',
+ required: true
+ }
+ }
+ };
+ prompt.start();
+ prompt.get(schema, function (err, result) {
+ console.log(' accept?: ' + result.accept);
+ });
+};
+
+createDownloadsDirectory();
+request(apacheMirrorsCGI + pathToFlexJSBinary + fileNameFlexJSBinary + '?' + requestJSON, handleFlexJSMirrorsResponse);
+request(apacheMirrorsCGI + pathToFalconBinary + fileNameFalconBinary + '?' + requestJSON, handleFalconMirrorsResponse);
+promptForAdobeAIR();
+//promptForFlashPlayerGlobal();
+
+//Download Adobe AIR
+
+//Download Flash Player Global
\ No newline at end of file