You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/09/12 02:01:10 UTC
[royale-asjs] 02/04: works better on Mac
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch release/0.9.6
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit cb472d355cc7f8b1628b434a7135c3152c9e0730
Author: Alex Harui <ah...@apache.org>
AuthorDate: Wed Sep 11 16:17:25 2019 -0700
works better on Mac
---
npm/js-only/package.json | 2 +-
npm/js-swf/dependencies/AdobeAIR.js | 76 +++++++++++++++++++++-
.../dependencies/DownloadUncompressAndCopy.js | 11 +++-
npm/js-swf/dependencies/FlashPlayerGlobal.js | 5 +-
npm/js-swf/package.json | 9 ++-
npm/release-scripts/package.json | 3 +-
package.json | 4 +-
7 files changed, 97 insertions(+), 13 deletions(-)
diff --git a/npm/js-only/package.json b/npm/js-only/package.json
index 75cf1a6..e0189aa 100644
--- a/npm/js-only/package.json
+++ b/npm/js-only/package.json
@@ -1,6 +1,6 @@
{
"name": "@apache-royale/royale-js",
- "version": "0.9.6-beta0",
+ "version": "0.9.6-beta1",
"description": "Apache Royale (formerly FlexJS)",
"keywords": [
"royale",
diff --git a/npm/js-swf/dependencies/AdobeAIR.js b/npm/js-swf/dependencies/AdobeAIR.js
index 7ed3598..fa221ee 100644
--- a/npm/js-swf/dependencies/AdobeAIR.js
+++ b/npm/js-swf/dependencies/AdobeAIR.js
@@ -25,13 +25,24 @@ var prompt = require('prompt');
var unzip = require('unzipper');
var pjson = require('../package');
+var isMac = false;
+var os = require('os');
+if (os.type() === 'Darwin')
+ isMac = true;
+
var constants = require('../dependencies/Constants');
+var inExpand = false;
+
var AdobeAIR = module.exports = Object.create(events.EventEmitter.prototype);
//Adobe AIR
var AdobeAIRURL = pjson.org_apache_royale.adobe_air_url;
var fileNameAdobeAIR = pjson.org_apache_royale.adobe_air_file_name;
+if (isMac) {
+ AdobeAIRURL = pjson.org_apache_royale.adobe_air_url_mac;
+ fileNameAdobeAIR = pjson.org_apache_royale.adobe_air_file_name_mac;
+}
var adobeAirPromptText = "\
Apache Royale SWF support uses the Adobe AIR SDK to build Adobe AIR applications.\n\
@@ -74,19 +85,24 @@ function downloadAdobeAIR()
console.log('Downloading Adobe AIR from ' + downloadURL);
request
.get(downloadURL)
- .pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
+ .pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR, {emitClose:true})
.on('close', function(){
console.log('Adobe AIR download complete');
- extract();
+ if (!isMac)
+ extract();
+ else
+ expand();
})
);
}
function extract()
{
+ var pathResolver = require('path');
+ var absPath = pathResolver.resolve(constants.ROYALE_FOLDER);
console.log('Extracting Adobe AIR');
fs.createReadStream(constants.DOWNLOADS_FOLDER + fileNameAdobeAIR)
- .pipe(unzip.Extract({ path: constants.ROYALE_FOLDER })
+ .pipe(unzip.Extract({ path: absPath })
.on('close', function(){
console.log('Adobe AIR extraction complete');
AdobeAIR.emit('complete');
@@ -94,6 +110,60 @@ function extract()
);
}
+ function expand()
+ {
+ if (inExpand) return;
+ inExpand = true;
+ console.log('Extracting Adobe AIR (DMG)');
+ var dmg = require('dmg');
+ var fse = require('fs-extra');
+
+ // path must be absolute and the extension must be .dmg
+ var myDmg = constants.DOWNLOADS_FOLDER + fileNameAdobeAIR;
+
+ // to open & mount the dmg
+ dmg.mount(myDmg, function(err, path) {
+ if (!err) {
+ var folders = fse.readdirSync(path);
+ for (var i = 0; i < folders.length; i++) {
+ var folderName = folders[i];
+ var destFolder = constants.ROYALE_FOLDER + "royale-asjs/" + folderName;
+ var srcFolder = path + "/" + folderName;
+ console.log(destFolder);
+ if (!fse.existsSync(destFolder)) {
+ console.log("copying " + srcFolder + " -> " + destFolder);
+ fse.copySync(srcFolder, destFolder);
+ }
+ else {
+ copyfolder(fse, srcFolder, destFolder);
+ }
+
+ }
+ dmg.unmount(path, function(err) {});
+ }});
+
+ function copyfolder(fse, sourcePath, destPath) {
+ console.log("copyfolder: " + sourcePath + " -> " + destPath);
+ var stat = fse.statSync(destPath);
+ if (stat.isDirectory()) {
+ var folders = fse.readdirSync(sourcePath);
+ for (var i = 0; i < folders.length; i++) {
+ var folderName = folders[i];
+ var destFolder = destPath + "/" + folderName;
+ var srcFolder = sourcePath + "/" + folderName;
+ console.log(destFolder);
+ if (!fse.existsSync(destFolder)) {
+ console.log("copying " + srcFolder + " -> " + destFolder);
+ fse.copySync(srcFolder, destFolder);
+ }
+ else {
+ copyfolder(fse, srcFolder, destFolder);
+ }
+ }
+ }
+ }
+ }
+
AdobeAIR.install = function()
{
if(process.env.ACCEPT_ALL_ROYALE_LICENSES === 'true')
diff --git a/npm/js-swf/dependencies/DownloadUncompressAndCopy.js b/npm/js-swf/dependencies/DownloadUncompressAndCopy.js
index 6b5e5a7..5a49fe0 100644
--- a/npm/js-swf/dependencies/DownloadUncompressAndCopy.js
+++ b/npm/js-swf/dependencies/DownloadUncompressAndCopy.js
@@ -28,6 +28,8 @@ var DownloadUncompressAndCopy = module.exports = Object.create(events.EventEmitt
DownloadUncompressAndCopy.downloadFile = function(item)
{
+ var inClose = false;
+
console.log('Downloading: ' + item.url + item.remoteFileName);
request
.get(item.url + item.remoteFileName)
@@ -39,8 +41,10 @@ DownloadUncompressAndCopy.downloadFile = function(item)
}
else
{
- response.pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+ response.pipe(fs.createWriteStream(constants.DOWNLOADS_FOLDER + item.remoteFileName, {emitClose:true})
.on('close', function(){
+ if (inClose) return;
+ inClose = true;
console.log('Finished downloading: ' + item.url + item.remoteFileName);
if(item.unzip)
{//Unzip
@@ -71,7 +75,10 @@ DownloadUncompressAndCopy.downloadFile = function(item)
}
else
{
- fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName)
+ if (!fs.existsSync(item.destinationPath)) {
+ fs.ensureDirSync(item.destinationPath);
+ }
+ fs.createReadStream(constants.DOWNLOADS_FOLDER + item.remoteFileName, {emitClose:true})
.pipe(fs.createWriteStream(item.destinationPath + item.destinationFileName))
.on('close', function(){
console.log("Copied " + constants.DOWNLOADS_FOLDER + item.remoteFileName + " to " +
diff --git a/npm/js-swf/dependencies/FlashPlayerGlobal.js b/npm/js-swf/dependencies/FlashPlayerGlobal.js
index bfb6edd..9bc9561 100644
--- a/npm/js-swf/dependencies/FlashPlayerGlobal.js
+++ b/npm/js-swf/dependencies/FlashPlayerGlobal.js
@@ -31,6 +31,7 @@ var FlashPlayerGlobal = module.exports = Object.create(events.EventEmitter.proto
var flashPlayerGlobalURL = pjson.org_apache_royale.flash_player_global_url;
var fileNameFlashPlayerGlobal = pjson.org_apache_royale.flash_player_global_file_name;
+var folderFlashPlayerGlobal = pjson.org_apache_royale.flash_player_global_folder;
var flashPlayerGlobalPromptText = "\
Apache Royale SWF support uses the Adobe Flash Player's playerglobal.swc to build Adobe Flash applications.\n\
The playerglobal.swc file is subject to and governed by the\n\
@@ -80,8 +81,8 @@ FlashPlayerGlobal.downloadFlashPlayerGlobal = function()
var downloadDetails = {
url:flashPlayerGlobalURL,
remoteFileName:fileNameFlashPlayerGlobal,
- destinationPath:constants.DOWNLOADS_FOLDER,
- destinationFileName:fileNameFlashPlayerGlobal,
+ destinationPath:constants.ROYALE_FOLDER + folderFlashPlayerGlobal,
+ destinationFileName:"playerglobal.swc",
unzip:false
};
diff --git a/npm/js-swf/package.json b/npm/js-swf/package.json
index dcc4e90..82260fc 100644
--- a/npm/js-swf/package.json
+++ b/npm/js-swf/package.json
@@ -1,6 +1,6 @@
{
"name": "@apache-royale/royale-js-swf",
- "version": "0.9.6-beta0",
+ "version": "0.9.6-beta8",
"description": "Apache Royale (formerly FlexJS)",
"keywords": [
"royale",
@@ -18,16 +18,18 @@
"author": "Apache Royale <de...@royale.apache.org>",
"license": "Apache-2.0",
"dependencies": {
+ "dmg": "0.1.0",
"eol": "^0.2.0",
"fs-extra": "^0.26.3",
"merge-dirs": "^0.2.1",
"mkdirp": "^0.5.1",
+ "os": "^0.1.1",
"prompt": "^0.2.14",
"request": "^2.67.0",
"unzipper": "0.10.4"
},
"scripts": {
- "postinstall": "node dependencies/download_dependencies.js"
+ "postinstall": "node royale-asjs/npm/js-swf/dependencies/download_dependencies.js"
},
"bin": {
"asjsc": "./royale-asjs/js/bin/asjscnpm",
@@ -40,8 +42,11 @@
"org_apache_royale": {
"flash_player_global_url": "http://fpdownload.macromedia.com/get/flashplayer/installers/archive/playerglobal/",
"flash_player_global_file_name": "playerglobal25_0.swc",
+ "flash_player_global_folder": "royale-asjs/frameworks/libs/player/25.0/",
"adobe_air_url": "http://airdownload.adobe.com/air/win/download/25.0/",
"adobe_air_file_name": "AdobeAIRSDK.zip",
+ "adobe_air_url_mac": "http://airdownload.adobe.com/air/mac/download/25.0/",
+ "adobe_air_file_name_mac": "AdobeAIRSDK.dmg",
"player_version": "25.0",
"swf_version": "36",
"swf_object_url": "http://github.com/swfobject/swfobject/archive/",
diff --git a/npm/release-scripts/package.json b/npm/release-scripts/package.json
index b51cf7a..50d3cea 100644
--- a/npm/release-scripts/package.json
+++ b/npm/release-scripts/package.json
@@ -10,6 +10,7 @@
"child_process": "1.0.2",
"fs": "0.0.1-security",
"npm": "5.6.0",
- "yargs": "11.0.0"
+ "npm-registry-client": "^8.6.0",
+ "yargs": "^11.0.0"
}
}
diff --git a/package.json b/package.json
index d2665f1..566f97e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "apache-royale-swf",
- "version": "0.9.6-beta0",
+ "version": "0.9.6-beta1",
"description": "Apache Royale (formerly FlexJS) with SWF support",
"keywords": [
"royale",
@@ -38,7 +38,7 @@
"externc": "./royale-asjs/js/bin/externcnpm"
},
"org_apache_royale": {
- "flash_player_global_url": "http://download.macromedia.com/get/flashplayer/updaters/25/",
+ "flash_player_global_url": "http://fpdownload.macromedia.com/get/flashplayer/installers/archive/playerglobal/",
"flash_player_global_file_name": "playerglobal25_0.swc",
"adobe_air_url": "http://airdownload.adobe.com/air/win/download/25.0/",
"adobe_air_file_name": "AdobeAIRSDK.zip",