Repository: flex-utilities Updated Branches: refs/heads/feature-npm-install a0466ed86 -> 99db831d2
Ensure that script dependencies are loaded before attempting to run FlexJS dependencies scripts. Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/99db831d Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/99db831d Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/99db831d Branch: refs/heads/feature-npm-install Commit: 99db831d2346f31927fd6334bfa455c7d0452f8f Parents: a0466ed Author: OmPrakash Muppirala <[email protected]> Authored: Sun Dec 27 02:36:20 2015 -0800 Committer: OmPrakash Muppirala <[email protected]> Committed: Sun Dec 27 02:36:20 2015 -0800 ---------------------------------------------------------------------- npm-flexjs/dependencies/Constants.js | 6 +- .../dependencies/download_dependencies.js | 111 +++++++++++++++++++ npm-flexjs/download_dependencies.js | 111 ------------------- npm-flexjs/package.json | 15 ++- 4 files changed, 123 insertions(+), 120 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/99db831d/npm-flexjs/dependencies/Constants.js ---------------------------------------------------------------------- diff --git a/npm-flexjs/dependencies/Constants.js b/npm-flexjs/dependencies/Constants.js index 98305a3..513b090 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 : 'node_modules/flexjs/downloads/', - FLEXJS_FOLDER: 'node_modules/flexjs/', - NODE_MODULES_FOLDER: 'node_modules/' + DOWNLOADS_FOLDER : './flexjs/downloads/', + FLEXJS_FOLDER: './flexjs/', + NODE_MODULES_FOLDER: './node_modules/' }; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/99db831d/npm-flexjs/dependencies/download_dependencies.js ---------------------------------------------------------------------- diff --git a/npm-flexjs/dependencies/download_dependencies.js b/npm-flexjs/dependencies/download_dependencies.js new file mode 100644 index 0000000..60f9f78 --- /dev/null +++ b/npm-flexjs/dependencies/download_dependencies.js @@ -0,0 +1,111 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +'use strict'; + +var fs = require('fs'); +var mkdirp = require('mkdirp'); +var constants = require('./Constants'); +var adobeair = require('./AdobeAIR'); +var flashplayerglobal = require('./FlashPlayerGlobal'); +var apacheFlexJS = require('./ApacheFlexJS'); +var apacheFalcon = require('./ApacheFalcon'); +var swfObject = require('./SWFObject'); + +var installSteps = [ + createDownloadsDirectory, + installFlashPlayerGlobal, + installAdobeAIR, + installSWFObject, + installApacheFlexJS, + installApacheFalcon + ]; +var currentStep = 0; + +function start() +{ + installSteps[0].call(); +} + +function createDownloadsDirectory() +{ + //Create downloads directory if it does not exist already + try + { + mkdirp(constants.DOWNLOADS_FOLDER); + } + catch(e) + { + 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 installFlashPlayerGlobal() +{ + flashplayerglobal.once('complete', handleInstallStepComplete); + flashplayerglobal.install(); +} + +function installAdobeAIR(event) +{ + adobeair.once('complete', handleInstallStepComplete); + adobeair.install(); +} + +function installApacheFlexJS(event) +{ + apacheFlexJS.once('complete', handleInstallStepComplete); + apacheFlexJS.install(); +} + +function installApacheFalcon(event) +{ + apacheFalcon.once('complete', handleInstallStepComplete); + apacheFalcon.install(); +} + +function installSWFObject(event) +{ + swfObject.once('complete', handleInstallStepComplete); + swfObject.install(); +} + +function allDownloadsComplete() +{ + console.log('Finished all downloads'); +} + +start(); http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/99db831d/npm-flexjs/download_dependencies.js ---------------------------------------------------------------------- diff --git a/npm-flexjs/download_dependencies.js b/npm-flexjs/download_dependencies.js deleted file mode 100644 index 8187566..0000000 --- a/npm-flexjs/download_dependencies.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -'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'); -var apacheFlexJS = require('./dependencies/ApacheFlexJS'); -var apacheFalcon = require('./dependencies/ApacheFalcon'); -var swfObject = require('./dependencies/SWFObject'); - -var installSteps = [ - createDownloadsDirectory, - installFlashPlayerGlobal, - installAdobeAIR, - installSWFObject, - installApacheFlexJS, - installApacheFalcon - ]; -var currentStep = 0; - -function start() -{ - installSteps[0].call(); -} - -function createDownloadsDirectory() -{ - //Create downloads directory if it does not exist already - try - { - mkdirp(constants.DOWNLOADS_FOLDER); - } - catch(e) - { - 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 installFlashPlayerGlobal() -{ - flashplayerglobal.once('complete', handleInstallStepComplete); - flashplayerglobal.install(); -} - -function installAdobeAIR(event) -{ - adobeair.once('complete', handleInstallStepComplete); - adobeair.install(); -} - -function installApacheFlexJS(event) -{ - apacheFlexJS.once('complete', handleInstallStepComplete); - apacheFlexJS.install(); -} - -function installApacheFalcon(event) -{ - apacheFalcon.once('complete', handleInstallStepComplete); - apacheFalcon.install(); -} - -function installSWFObject(event) -{ - swfObject.once('complete', handleInstallStepComplete); - swfObject.install(); -} - -function allDownloadsComplete() -{ - console.log('Finished all downloads'); -} - -start(); http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/99db831d/npm-flexjs/package.json ---------------------------------------------------------------------- diff --git a/npm-flexjs/package.json b/npm-flexjs/package.json index 149eb7e..3786a97 100644 --- a/npm-flexjs/package.json +++ b/npm-flexjs/package.json @@ -1,12 +1,7 @@ { - "name": "apache-flexjs", + "name": "flexjs", "version": "0.5.0", "description": "Apache FlexJS", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "preinstall": "node download_dependencies.js" - }, "keywords": [ "flex", "flexjs", @@ -27,5 +22,13 @@ "request": "^2.67.0", "unzip": "^0.1.11", "wrench": "^1.5.8" + }, + "scripts": { + "pre": "npm install", + "postinstall": "node dependencies/download_dependencies.js" + }, + "bin": { + "asjsc": "./js/bin/asjsc", + "asjscompc": "./js/bin/asjscompc" } }
