| @@ -0,0 +1,325 @@ | ||
| <<<<<<< HEAD | ||
| var game; | ||
| var preload; | ||
| var playgame; | ||
|
|
||
| window.onload = function () { | ||
|
|
||
| // Create a new Phaser Game | ||
| game = new Phaser.Game(window.innerWidth,window.innerHeight); | ||
|
|
||
| // Add the game states | ||
| game.state.add("Preload", preload); | ||
| game.state.add("Playgame", playgame); | ||
|
|
||
| // Start the "Preload" state | ||
| game.state.start("Preload"); | ||
|
|
||
| } | ||
|
|
||
| preload = function(game) {}; | ||
| preload.prototype = { | ||
| preload: function () { | ||
|
|
||
| // Preload images | ||
| game.load.image("trump", "assets/trump.png"); | ||
| game.load.image("bodyguard", "assets/bodyguard.png"); | ||
| game.load.image("taco", "assets/taco.png"); | ||
| game.load.image("field", "assets/soccerfield.png"); | ||
| game.load.image("addGuard", "assets/addGuard.png"); | ||
| game.load.image("addingGuard", "assets/addingGuard.png"); | ||
|
|
||
| // preload physics | ||
| game.load.physics('tacoPhysics', 'assets/physics/taco.json'); | ||
| game.load.physics('personPhysics', 'assets/physics/person.json'); | ||
|
|
||
| game.adding = false; //////////////////////////////////////////////////////////// | ||
| game.money = 0; /////////////////////////////////////////////////////////////////// | ||
| game.numberguards = 0; /////////////////////////////////////////////////////////////////// | ||
|
|
||
| //VAR | ||
| game.PriceGuard = 10; | ||
|
|
||
| }, | ||
| create: function () { | ||
|
|
||
| // Everything is loaded, start the "Playgame" State | ||
| game.state.start("Playgame"); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| playgame = function(game) {}; | ||
| playgame.prototype = { | ||
| create: function () { | ||
| game.add.sprite(0, 0, 'field'); ////////////////////////////////////////////////// | ||
| game.physics.startSystem(Phaser.Physics.P2JS); | ||
| game.physics.p2.setImpactEvents(true); | ||
| game.physics.p2.restitution = 0.8; | ||
|
|
||
| projectiles = game.add.group(); | ||
| projectiles.enableBody = true; | ||
| projectiles.physicsBodyType = Phaser.Physics.P2JS; | ||
|
|
||
| guards = game.add.group(); //////////////////////////////////////////////////////////////////////////////////// | ||
| guards.enableBody = true; ///// | ||
| guards.physicsBodyType = Phaser.Physics.P2JS; ///////////////////////////////////////////////////////////// | ||
|
|
||
| game.trumpCollisionGroup = game.physics.p2.createCollisionGroup(); | ||
| game.projectileCollisionGroup = game.physics.p2.createCollisionGroup(); | ||
|
|
||
| game.guardCollisionGroup = game.physics.p2.createCollisionGroup(); //////////////////////////// | ||
| game.physics.p2.updateBoundsCollisionGroup(); | ||
|
|
||
|
|
||
| // when pressing W create a new projectile | ||
| keyW = game.input.keyboard.addKey(Phaser.Keyboard.W); | ||
| keyW.onDown.add(this.addProjectile, this); | ||
|
|
||
| // create trump | ||
| game.trump = game.add.sprite(game.world.centerX, game.world.centerY, 'trump'); | ||
| game.trump.anchor.setTo(0.5,0.5); | ||
| game.physics.p2.enable(game.trump); | ||
| game.trump.body.clearShapes(); | ||
| game.trump.body.loadPolygon('personPhysics', 'person'); | ||
| game.trump.body.static = true; | ||
| game.trump.body.setCollisionGroup(game.trumpCollisionGroup); | ||
| game.trump.body.collides([game.projectileCollisionGroup, game.guardCollisionGroup], this.onProjectileHitTrump, this); | ||
|
|
||
| //GUARD BUTTON ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| button = game.add.button(game.world.width - 100, 10, 'addGuard', this.addingGuardfunc, this); | ||
| var style = { font: "40px Arial", fill: "#ffffff" }; | ||
| game.labelGuards = this.game.add.text(game.world.width - 80, 28, game.numberguards, style); | ||
| game.labelMoney = this.game.add.text(20, 28, "money:" + game.money, style); | ||
| game.time.events.loop(Phaser.Timer.SECOND * 2, this.addMoney, this); | ||
| }, | ||
| update: function () { | ||
|
|
||
| game.trump.angle += 1; | ||
|
|
||
| game.labelGuards.setText(game.numberguards); //CHANGE TEXT IN GUARDBUTTON //////////////////////////////////////////// | ||
| game.labelMoney.setText(game.money); | ||
| if (game.input.activePointer.isDown && game.adding) //////////////////////////////////////////////////////// | ||
| { | ||
| this.addGuard(); | ||
| } | ||
|
|
||
| }, | ||
| addProjectile: function () { | ||
| var taco = game.add.sprite(game.world.randomX, game.world.randomY, 'taco'); | ||
| projectiles.add(taco); | ||
| taco.body.clearShapes(); | ||
| taco.body.loadPolygon('tacoPhysics', 'taco'); | ||
| taco.body.setCollisionGroup(game.projectileCollisionGroup); | ||
| taco.body.collides([game.trumpCollisionGroup, game.projectileCollisionGroup, game.guardCollisionGroup]); | ||
| this.throwProjectileToObj(taco,game.trump, 200); | ||
| // var sound = game.add.audio('drop'); | ||
| // sound.play(); | ||
| }, | ||
| onProjectileHitTrump: function(obj1, obj2) { | ||
| console.log('hit trump'); | ||
| obj2.damping = 0.8; | ||
| obj2.angularDamping = 0.7; | ||
| obj2.kill = true; | ||
| }, | ||
| throwProjectileToObj: function (obj1, obj2, speed) { | ||
| if (typeof speed === 'undefined') { speed = 60; } | ||
| var angle = Math.atan2(obj2.y - obj1.y, obj2.x - obj1.x); | ||
| obj1.body.rotation = angle + game.math.degToRad(-20); // correct angle of angry bullets (depends on the sprite used) | ||
| obj1.body.velocity.x = Math.cos(angle) * speed; // accelerateToObject | ||
| obj1.body.velocity.y = Math.sin(angle) * speed; | ||
| }, | ||
| addingGuardfunc: function () { ////////////////////////////////////////////////////////////////////////////////////// | ||
| if (game.numberguards > 0) | ||
| { | ||
| game.adding = true; | ||
| game.addingGuard = game.add.sprite(game.world.width - 100, 10, 'addingGuard'); | ||
| } | ||
|
|
||
| }, | ||
| addGuard: function () { /////////////////////////////////////////////////////////////////////////////////////////////// | ||
| var guard = game.add.sprite(game.input.x, game.input.y, 'bodyguard'); | ||
| game.addingGuard.destroy(); | ||
| game.money = game.money - game.PriceGuard; | ||
| game.numberguards = game.numberguards - 1; | ||
| game.adding = false; | ||
| guards.add(guard); | ||
| guard.body.clearShapes(); | ||
| guard.body.loadPolygon('personPhysics', 'person'); | ||
| guard.body.static = true; | ||
| guard.body.setCollisionGroup(game.guardCollisionGroup); | ||
| guard.body.collides([game.projectileCollisionGroup, game.trumpCollisionGroup]); | ||
| }, | ||
| addMoney: function () { /////////////////////////////////////////////////////////////////////////////////////////////// | ||
| game.money ++; | ||
| console.log("test"); | ||
| if (game.money % game.PriceGuard == 0) | ||
| { | ||
| game.numberguards ++; | ||
| console.log("GUARD"); | ||
| } | ||
| } | ||
| } | ||
| ======= | ||
| var game; | ||
| var preload; | ||
| var playgame; | ||
|
|
||
| window.onload = function () { | ||
|
|
||
| // Create a new Phaser Game | ||
| game = new Phaser.Game(360,640); | ||
|
|
||
| // Add the game states | ||
| game.state.add("Preload", preload); | ||
| game.state.add("Playgame", playgame); | ||
|
|
||
| // Start the "Preload" state | ||
| game.state.start("Preload"); | ||
|
|
||
| } | ||
|
|
||
| preload = function(game) {}; | ||
| preload.prototype = { | ||
| preload: function () { | ||
|
|
||
| // Preload images | ||
| game.load.image("trump", "assets/trump.png"); | ||
| game.load.image("bodyguard", "assets/bodyguard.png"); | ||
| game.load.image("taco", "assets/taco.png"); | ||
| game.load.image("field", "assets/soccerfield.png"); | ||
| game.load.image("addGuard", "assets/addGuard.png"); | ||
| game.load.image("addingGuard", "assets/addingGuard.png"); | ||
|
|
||
| // preload physics | ||
| game.load.physics('tacoPhysics', 'assets/physics/taco.json'); | ||
| game.load.physics('personPhysics', 'assets/physics/person.json'); | ||
|
|
||
| game.adding = false; //////////////////////////////////////////////////////////// | ||
| game.money = 0; /////////////////////////////////////////////////////////////////// | ||
| game.numberguards = 0; /////////////////////////////////////////////////////////////////// | ||
|
|
||
| //VAR | ||
| game.PriceGuard = 10; | ||
|
|
||
| }, | ||
| create: function () { | ||
|
|
||
| // Everything is loaded, start the "Playgame" State | ||
| game.state.start("Playgame"); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| playgame = function(game) {}; | ||
| playgame.prototype = { | ||
| create: function () { | ||
| game.add.sprite(0, 0, 'field'); ////////////////////////////////////////////////// | ||
| game.physics.startSystem(Phaser.Physics.P2JS); | ||
| game.physics.p2.setImpactEvents(true); | ||
| game.physics.p2.restitution = 0.8; | ||
|
|
||
| projectiles = game.add.group(); | ||
| projectiles.enableBody = true; | ||
| projectiles.physicsBodyType = Phaser.Physics.P2JS; | ||
|
|
||
| guards = game.add.group(); //////////////////////////////////////////////////////////////////////////////////// | ||
| guards.enableBody = true; ///// | ||
| guards.physicsBodyType = Phaser.Physics.P2JS; ///////////////////////////////////////////////////////////// | ||
|
|
||
| game.trumpCollisionGroup = game.physics.p2.createCollisionGroup(); | ||
| game.projectileCollisionGroup = game.physics.p2.createCollisionGroup(); | ||
|
|
||
| game.guardCollisionGroup = game.physics.p2.createCollisionGroup(); //////////////////////////// | ||
| game.physics.p2.updateBoundsCollisionGroup(); | ||
|
|
||
|
|
||
| // when pressing W create a new projectile | ||
| keyW = game.input.keyboard.addKey(Phaser.Keyboard.W); | ||
| keyW.onDown.add(this.addProjectile, this); | ||
|
|
||
| // create trump | ||
| game.trump = game.add.sprite(game.world.centerX, game.world.centerY, 'trump'); | ||
| game.trump.anchor.setTo(0.5,0.5); | ||
| game.physics.p2.enable(game.trump); | ||
| game.trump.body.clearShapes(); | ||
| game.trump.body.loadPolygon('personPhysics', 'person'); | ||
| game.trump.body.static = true; | ||
| game.trump.body.setCollisionGroup(game.trumpCollisionGroup); | ||
| game.trump.body.collides([game.projectileCollisionGroup, game.guardCollisionGroup], this.onProjectileHitTrump, this); | ||
|
|
||
| //GUARD BUTTON ////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| button = game.add.button(game.world.width - 100, 10, 'addGuard', this.addingGuardfunc, this); | ||
| var style = { font: "40px Arial", fill: "#ffffff" }; | ||
| game.labelGuards = this.game.add.text(game.world.width - 80, 28, game.numberguards, style); | ||
| game.labelMoney = this.game.add.text(20, 28, "money:" + game.money, style); | ||
| game.time.events.loop(Phaser.Timer.SECOND * 2, this.addMoney, this); | ||
| }, | ||
| update: function () { | ||
|
|
||
| game.trump.angle += 1; | ||
|
|
||
| game.labelGuards.setText(game.numberguards); //CHANGE TEXT IN GUARDBUTTON //////////////////////////////////////////// | ||
| game.labelMoney.setText(game.money); | ||
| if (game.input.activePointer.isDown && game.adding) //////////////////////////////////////////////////////// | ||
| { | ||
| this.addGuard(); | ||
| } | ||
|
|
||
| }, | ||
| addProjectile: function () { | ||
| var taco = game.add.sprite(game.world.randomX, game.world.randomY, 'taco'); | ||
| projectiles.add(taco); | ||
| taco.body.clearShapes(); | ||
| taco.body.loadPolygon('tacoPhysics', 'taco'); | ||
| taco.body.setCollisionGroup(game.projectileCollisionGroup); | ||
| taco.body.collides([game.trumpCollisionGroup, game.projectileCollisionGroup, game.guardCollisionGroup]); | ||
| this.throwProjectileToObj(taco,game.trump, 200); | ||
| // var sound = game.add.audio('drop'); | ||
| // sound.play(); | ||
| }, | ||
| onProjectileHitTrump: function(obj1, obj2) { | ||
| console.log('hit trump'); | ||
| obj2.damping = 0.8; | ||
| obj2.angularDamping = 0.7; | ||
| obj2.kill = true; | ||
| }, | ||
| throwProjectileToObj: function (obj1, obj2, speed) { | ||
| if (typeof speed === 'undefined') { speed = 60; } | ||
| var angle = Math.atan2(obj2.y - obj1.y, obj2.x - obj1.x); | ||
| obj1.body.rotation = angle + game.math.degToRad(-20); // correct angle of angry bullets (depends on the sprite used) | ||
| obj1.body.velocity.x = Math.cos(angle) * speed; // accelerateToObject | ||
| obj1.body.velocity.y = Math.sin(angle) * speed; | ||
| }, | ||
| addingGuardfunc: function () { ////////////////////////////////////////////////////////////////////////////////////// | ||
| if (game.numberguards > 0) | ||
| { | ||
| game.adding = true; | ||
| game.addingGuard = game.add.sprite(game.world.width - 100, 10, 'addingGuard'); | ||
| } | ||
|
|
||
| }, | ||
| addGuard: function () { /////////////////////////////////////////////////////////////////////////////////////////////// | ||
| var guard = game.add.sprite(game.input.x, game.input.y, 'bodyguard'); | ||
| game.addingGuard.destroy(); | ||
| game.money = game.money - game.PriceGuard; | ||
| game.numberguards = game.numberguards - 1; | ||
| game.adding = false; | ||
| guards.add(guard); | ||
| guard.body.clearShapes(); | ||
| guard.body.loadPolygon('personPhysics', 'person'); | ||
| guard.body.static = true; | ||
| guard.body.setCollisionGroup(game.guardCollisionGroup); | ||
| guard.body.collides([game.projectileCollisionGroup, game.trumpCollisionGroup]); | ||
| }, | ||
| addMoney: function () { /////////////////////////////////////////////////////////////////////////////////////////////// | ||
| game.money ++; | ||
| console.log("test"); | ||
| if (game.money % game.PriceGuard == 0) | ||
| { | ||
| game.numberguards ++; | ||
| console.log("GUARD"); | ||
| } | ||
| } | ||
| } | ||
| >>>>>>> 912d768ea5ad59305e8f48619a7275b8aba693e7 |
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "prepare_queue": { | ||
| "installed": [], | ||
| "uninstalled": [] | ||
| }, | ||
| "config_munge": { | ||
| "files": {} | ||
| }, | ||
| "installed_plugins": { | ||
| "cordova-plugin-whitelist": { | ||
| "PACKAGE_NAME": "com.phonegap.helloworld" | ||
| } | ||
| }, | ||
| "dependent_plugins": {}, | ||
| "modules": [], | ||
| "plugin_metadata": { | ||
| "cordova-plugin-whitelist": "1.2.1" | ||
| } | ||
| } |
| @@ -0,0 +1,72 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0"> | ||
| <name>TestProject</name> | ||
| <description>Hello World sample application that responds to the deviceready event.</description> | ||
| <author email="support@phonegap.com" href="http://phonegap.com">PhoneGap Team</author> | ||
| <content src="index.html" /> | ||
| <preference name="permissions" value="none" /> | ||
| <preference name="orientation" value="default" /> | ||
| <preference name="target-device" value="universal" /> | ||
| <preference name="fullscreen" value="true" /> | ||
| <preference name="webviewbounce" value="true" /> | ||
| <preference name="prerendered-icon" value="true" /> | ||
| <preference name="stay-in-webview" value="false" /> | ||
| <preference name="ios-statusbarstyle" value="black-opaque" /> | ||
| <preference name="detect-data-types" value="true" /> | ||
| <preference name="exit-on-suspend" value="false" /> | ||
| <preference name="show-splash-screen-spinner" value="true" /> | ||
| <preference name="auto-hide-splash-screen" value="true" /> | ||
| <preference name="disable-cursor" value="false" /> | ||
| <preference name="android-minSdkVersion" value="14" /> | ||
| <preference name="android-installLocation" value="auto" /> | ||
| <gap:plugin name="org.apache.cordova.battery-status" /> | ||
| <gap:plugin name="org.apache.cordova.camera" /> | ||
| <gap:plugin name="org.apache.cordova.media-capture" /> | ||
| <gap:plugin name="org.apache.cordova.console" /> | ||
| <gap:plugin name="org.apache.cordova.contacts" /> | ||
| <gap:plugin name="org.apache.cordova.device" /> | ||
| <gap:plugin name="org.apache.cordova.device-motion" /> | ||
| <gap:plugin name="org.apache.cordova.device-orientation" /> | ||
| <gap:plugin name="org.apache.cordova.dialogs" /> | ||
| <gap:plugin name="org.apache.cordova.file" /> | ||
| <gap:plugin name="org.apache.cordova.file-transfer" /> | ||
| <gap:plugin name="org.apache.cordova.geolocation" /> | ||
| <gap:plugin name="org.apache.cordova.globalization" /> | ||
| <gap:plugin name="org.apache.cordova.inappbrowser" /> | ||
| <gap:plugin name="org.apache.cordova.media" /> | ||
| <gap:plugin name="org.apache.cordova.network-information" /> | ||
| <gap:plugin name="org.apache.cordova.splashscreen" /> | ||
| <gap:plugin name="org.apache.cordova.vibration" /> | ||
| <icon src="icon.png" /> | ||
| <icon gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/icon-36-ldpi.png" /> | ||
| <icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/icon-48-mdpi.png" /> | ||
| <icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/icon-72-hdpi.png" /> | ||
| <icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/icon-96-xhdpi.png" /> | ||
| <icon gap:platform="blackberry" src="www/res/icon/blackberry/icon-80.png" /> | ||
| <icon gap:platform="blackberry" gap:state="hover" src="www/res/icon/blackberry/icon-80.png" /> | ||
| <icon gap:platform="ios" height="57" src="www/res/icon/ios/icon-57.png" width="57" /> | ||
| <icon gap:platform="ios" height="72" src="www/res/icon/ios/icon-72.png" width="72" /> | ||
| <icon gap:platform="ios" height="114" src="www/res/icon/ios/icon-57-2x.png" width="114" /> | ||
| <icon gap:platform="ios" height="144" src="www/res/icon/ios/icon-72-2x.png" width="144" /> | ||
| <icon gap:platform="webos" src="www/res/icon/webos/icon-64.png" /> | ||
| <icon gap:platform="winphone" src="www/res/icon/windows-phone/icon-48.png" /> | ||
| <icon gap:platform="winphone" gap:role="background" src="www/res/icon/windows-phone/icon-173-tile.png" /> | ||
| <gap:splash gap:platform="android" gap:qualifier="port-ldpi" src="www/res/screen/android/screen-ldpi-portrait.png" /> | ||
| <gap:splash gap:platform="android" gap:qualifier="port-mdpi" src="www/res/screen/android/screen-mdpi-portrait.png" /> | ||
| <gap:splash gap:platform="android" gap:qualifier="port-hdpi" src="www/res/screen/android/screen-hdpi-portrait.png" /> | ||
| <gap:splash gap:platform="android" gap:qualifier="port-xhdpi" src="www/res/screen/android/screen-xhdpi-portrait.png" /> | ||
| <gap:splash gap:platform="blackberry" src="www/res/screen/blackberry/screen-225.png" /> | ||
| <gap:splash gap:platform="ios" height="480" src="www/res/screen/ios/screen-iphone-portrait.png" width="320" /> | ||
| <gap:splash gap:platform="ios" height="960" src="www/res/screen/ios/screen-iphone-portrait-2x.png" width="640" /> | ||
| <gap:splash gap:platform="ios" height="1136" src="www/res/screen/ios/screen-iphone-portrait-568h-2x.png" width="640" /> | ||
| <gap:splash gap:platform="ios" height="1024" src="www/res/screen/ios/screen-ipad-portrait.png" width="768" /> | ||
| <gap:splash gap:platform="ios" height="768" src="www/res/screen/ios/screen-ipad-landscape.png" width="1024" /> | ||
| <gap:splash gap:platform="winphone" src="www/res/screen/windows-phone/screen-portrait.jpg" /> | ||
| <access origin="*" /> | ||
| <allow-intent href="http://*/*" /> | ||
| <allow-intent href="https://*/*" /> | ||
| <allow-intent href="tel:*" /> | ||
| <allow-intent href="sms:*" /> | ||
| <allow-intent href="mailto:*" /> | ||
| <allow-intent href="geo:*" /> | ||
| </widget> |
| @@ -0,0 +1,33 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| 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. | ||
| */ | ||
|
|
||
|
|
||
| var build = require('./lib/build'), | ||
| args = process.argv; | ||
|
|
||
| // provide help | ||
| if ( args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || args[2] == '/h' || | ||
| args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { | ||
| build.help(); | ||
| process.exit(0); | ||
| } else { | ||
| build.buildProject(); | ||
| } |
| @@ -0,0 +1,26 @@ | ||
| :: 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. | ||
|
|
||
| @ECHO OFF | ||
| SET script_path="%~dp0build" | ||
| IF EXIST %script_path% ( | ||
| node %script_path% %* | ||
| ) ELSE ( | ||
| ECHO. | ||
| ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2 | ||
| EXIT /B 1 | ||
| ) |
| @@ -0,0 +1,37 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| 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. | ||
| */ | ||
|
|
||
|
|
||
| var path = require('path'), | ||
| clean = require('./lib/clean'), | ||
| reqs = require('./lib/check_reqs'), | ||
| args = process.argv; | ||
|
|
||
| // Support basic help commands | ||
| if ( args.length > 2 | ||
| || args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || | ||
| args[2] == 'help' || args[2] == '-help' || args[2] == '/help') { | ||
| console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'clean')) ); | ||
| process.exit(0); | ||
| } else { | ||
| clean.cleanProject(); | ||
| } | ||
|
|
| @@ -0,0 +1,22 @@ | ||
| <?xml version='1.0' encoding='utf-8'?> | ||
| <!-- | ||
| 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. | ||
| --> | ||
| <widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
|
|
||
| </widget> |
| @@ -0,0 +1,63 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| var path = require('path'), | ||
| fs = require('fs'), | ||
| clean = require('./clean'), | ||
| shjs = require('shelljs'), | ||
| zip = require('adm-zip'), | ||
| check_reqs = require('./check_reqs'), | ||
| platformWwwDir = path.join('platforms', 'browser', 'www'), | ||
| platformBuildDir = path.join('platforms', 'browser', 'build'), | ||
| packageFile = path.join(platformBuildDir, 'package.zip'); | ||
|
|
||
| /** | ||
| * buildProject | ||
| * Creates a zip file int platform/build folder | ||
| */ | ||
| exports.buildProject = function(){ | ||
|
|
||
| // Check that requirements are (stil) met | ||
| if (!check_reqs.run()) { | ||
| console.error('Please make sure you meet the software requirements in order to build a browser cordova project'); | ||
| process.exit(2); | ||
| } | ||
|
|
||
| clean.cleanProject(); // remove old build result | ||
|
|
||
| if (!fs.existsSync(platformBuildDir)) { | ||
| fs.mkdirSync(platformBuildDir); | ||
| } | ||
|
|
||
| // add the project to a zipfile | ||
| var zipFile = zip(); | ||
| zipFile.addLocalFolder(platformWwwDir, '.'); | ||
| zipFile.writeZip(packageFile); | ||
|
|
||
| console.log('Browser packaged app built in '+ packageFile); | ||
|
|
||
| process.exit(0); | ||
| }; | ||
|
|
||
| module.exports.help = function() { | ||
| console.log('Usage: cordova build browser'); | ||
| console.log('Build will create the packaged app in \''+platformBuildDir+'\'.'); | ||
| }; |
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| 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. | ||
| */ | ||
|
|
||
| //add methods as we determine what are the requirements | ||
|
|
||
| module.exports.run = function() { | ||
| return true; | ||
| } |
| @@ -0,0 +1,48 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| /* | ||
| * 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. | ||
| */ | ||
|
|
||
| var fs = require('fs'), | ||
| shjs = require('shelljs'), | ||
| path = require('path'), | ||
| check_reqs = require('./check_reqs'), | ||
| platformBuildDir = path.join('platforms', 'browser', 'build'); | ||
|
|
||
| exports.cleanProject = function(){ | ||
|
|
||
| // Check that requirements are (stil) met | ||
| if (!check_reqs.run()) { | ||
| console.error('Please make sure you meet the software requirements in order to clean an browser cordova project'); | ||
| process.exit(2); | ||
| } | ||
|
|
||
| console.log('Cleaning Browser project'); | ||
| try { | ||
| if (fs.existsSync(platformBuildDir)) { | ||
| shjs.rm('-r', platformBuildDir); | ||
| } | ||
| } | ||
| catch(err) { | ||
| console.log('could not remove '+platformBuildDir+' : '+err.message); | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|