-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5bbb5ac
Showing
87 changed files
with
18,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"node": true, | ||
"browser": true, | ||
"bitwise": true, | ||
"undef": true, | ||
"trailing": true, | ||
"quotmark": true, | ||
"indent": 4, | ||
"unused": "vars", | ||
"latedef": "nofunc", | ||
"-W030": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Tools for Apache Cordova CLI - Plugin Simulation | ||
|
||
Copyright (c) Microsoft Corporation | ||
|
||
All rights reserved. | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Tools for Apache Cordova CLI - Plugin Simulation - Third Party Notices | ||
|
||
'Tools for Apache Cordova CLI - Plugin Simulation' is based on or incorporates | ||
material and code from the projects listed below (collectively "Third Party | ||
Code"). Microsoft is not the original author of the Third Party Code. The | ||
original copyright notice and the license, under which Microsoft received such | ||
Third Party Code, are set forth below. Such license and notices are provided | ||
for informational purposes only. | ||
|
||
Microsoft licenses the Third Party Code to you under the terms of the MIT | ||
License. All Third Party Code licensed by Microsoft under the MIT License (the | ||
"License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
|
||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
|
||
See the MIT License for specific language governing permissions and limitations | ||
under the License. | ||
|
||
------------------------------------------------------------------------------- | ||
Third Party Code Components | ||
------------------------------------------------------------------------------- | ||
|
||
-- Apache Ripple -------------------------------------------------------------- | ||
|
||
Contains code based on code from Apache Ripple | ||
http://ripple.incubator.apache.org/ | ||
https://github.com/apache/incubator-ripple | ||
Released under Apache 2.0 License. | ||
|
||
-- Wii Opera SDK -------------------------------------------------------------- | ||
|
||
3D Math Class v2.7.22 2008-12-14 | ||
(c) 2007-2008 Daniel Gump. All Rights Reserved. | ||
(see src/plugins/cordova-plugin-device-motion/3d.js) | ||
|
||
Drawing Class v2.6.16 2008-12-14 * | ||
(c) 2007-2008 Daniel Gump. All Rights Reserved | ||
(see src/plugins/cordova-plugin-device-motion/draw.js) | ||
|
||
http://wiioperasdk.com, http://hullbreachonline.com | ||
[email protected] | ||
|
||
-- OpenLayers Map Viewer Library ---------------------------------------------- | ||
|
||
OpenLayers.js -- OpenLayers Map Viewer Library | ||
Copyright (c) 2006-2013 by OpenLayers Contributors | ||
Published under the 2-clause BSD license. | ||
See http://openlayers.org/dev/license.txt for the full text of the license, | ||
and http://openlayers.org/dev/authors.txt for full list of contributors. | ||
(see src/plugins/cordova-plugin-geolocation/OpenLayers.js) | ||
|
||
Includes compressed code under the following licenses: | ||
|
||
XMLHttpRequest.js <http://code.google.com/p/xmlhttprequest/> | ||
Copyright (C) 2010 Sergey Ilinsky (http://www.ilinsky.com) | ||
Released under Apache License, Version 2.0 with the permission of the author: | ||
https://github.com/openlayers/openlayers/blob/release-2.12/lib/OpenLayers/Request/XMLHttpRequest.js | ||
|
||
OpenLayers.Util.pagePosition is based on Yahoo's getXY method, which is | ||
Copyright (c) 2006, Yahoo! Inc. | ||
All rights reserved. | ||
|
||
Contains portions of Rico <http://openrico.org/> | ||
Copyright 2005 Sabre Airline Solutions | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
||
-- moment.js ------------------------------------------------------------------ | ||
|
||
moment.js | ||
version : 2.8.4 | ||
authors : Tim Wood, Iskren Chernev, Moment.js contributors | ||
license : MIT | ||
momentjs.com | ||
(see src/plugins/cordova-plugin-globalization/moment.js) | ||
|
||
-- jQuery JavaScript Library -------------------------------------------------- | ||
|
||
jQuery v2.1.4 | ||
Copyright 2005, 2015 jQuery Foundation, Inc. | ||
Licensed under MIT | ||
http://jquery.org/license | ||
(see src/third-party/jquery.min.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Server and app host support for taco-simulate. | ||
|
||
# Installation | ||
|
||
``` | ||
npm install taco-simulator-server | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# taco-simulate-server Release Notes | ||
|
||
### 0.1.0 (Oct 8, 2015) | ||
* Initial test release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
GPX is a platform-independent serialization schema that we use to simulate geolocation routes. | ||
There are several ways you can generate GPX files. Here are three examples: | ||
|
||
1. Record an actual route using the [*Endomondo* mobile app](http://endomondo.com). After you have | ||
recorded the route, log into the *Endomondo* site and download the route as a GPX file using the | ||
export feature in the RH navigation pane. | ||
2. Create a route by requesting driving directions at http://yournavigation.org. Select the `Export` | ||
feature and select GPX format | ||
3. If you prefer Google maps, follow these instructions: http://www.elsewhere.org/journal/gmaptogpx/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"name": "taco-simulate-server", | ||
"version": "0.1.0", | ||
"description": "Server and app host module for taco-simulate (Cordova plugin simulation).", | ||
"main": "src/server.js", | ||
"scripts": { | ||
"prepublish": "in-install || npm shrinkwrap", | ||
"postpublish": "rimraf npm-shrinkwrap.json" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/taco-simulator-server" | ||
}, | ||
"keywords": [ | ||
"taco", | ||
"cordova", | ||
"plugins", | ||
"simulation" | ||
], | ||
"author": { | ||
"name": "Microsoft Corp." | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/microsoft/taco-simulator-server/issues" | ||
}, | ||
"homepage": "https://github.com/microsoft/taco-simulator-server", | ||
"engines": { | ||
"node": ">= 0.12.0", | ||
"npm": ">= 2.5.1" | ||
}, | ||
"dependencies": { | ||
"browserify": "^11.2.0", | ||
"chalk": "^1.1.1", | ||
"cordova-serve": "^1.0.0", | ||
"q": "^1.4.1", | ||
"replacestream": "^4.0.0", | ||
"send": "timbarham/send#transform", | ||
"socket.io": "^1.3.7", | ||
"through2": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"in-publish": "^2.0.0", | ||
"rimraf": "^2.4.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
var Messages = require('messages'); | ||
|
||
var cordova; | ||
var oldExec; | ||
var socket = io(); | ||
var nextExecCacheIndex = 0; | ||
var execCache = {}; | ||
var pluginHandlers = {}; | ||
|
||
function setCordova(originalCordova) { | ||
if (cordova) { | ||
return; | ||
} | ||
|
||
cordova = originalCordova; | ||
|
||
oldExec = cordova.require('cordova/exec'); | ||
cordova.define.remove('cordova/exec'); | ||
cordova.define('cordova/exec', function (require, exports, module) { | ||
module.exports = exec; | ||
}); | ||
|
||
// android platform has its own specific initialization | ||
// so to emulate it, we need to fake init function | ||
if (cordova.platformId === 'android') { | ||
exec.init = function () { | ||
cordova.require('cordova/channel').onNativeReady.fire(); | ||
}; | ||
} | ||
|
||
// windows phone platform fires 'deviceready' event from native component | ||
// so to emulate it we fire it in the bootstrap function (similar to ios) | ||
if (cordova.platformId === 'windowsphone') { | ||
cordova.require('cordova/platform').bootstrap = function () { | ||
cordova.require('cordova/channel').onNativeReady.fire(); | ||
}; | ||
} | ||
|
||
// default Windows bootstrap function tries to load WinJS which is not | ||
// available and not required in simulation mode so we override bootstrap | ||
if (cordova.platformId === 'windows') { | ||
cordova.require('cordova/platform').bootstrap = function () { | ||
cordova.require('cordova/modulemapper') | ||
.clobbers('cordova/exec/proxy', 'cordova.commandProxy'); | ||
|
||
cordova.require('cordova/channel').onNativeReady.fire(); | ||
}; | ||
} | ||
} | ||
|
||
function getCordova() { | ||
return cordova; | ||
} | ||
|
||
socket.on('exec-success', function (data) { | ||
console.log('exec-success:'); | ||
console.log(data); | ||
var execCacheInfo = execCache[data.index]; | ||
if (execCacheInfo.success) { | ||
execCacheInfo.success(data.result); | ||
} | ||
}); | ||
|
||
socket.on('exec-failure', function (data) { | ||
console.log('exec-failure:'); | ||
console.log(data); | ||
var execCacheInfo = execCache[data.index]; | ||
if (execCacheInfo.fail) { | ||
execCacheInfo.fail(data.error); | ||
} | ||
}); | ||
|
||
socket.emit('register-app-host'); | ||
|
||
function exec(success, fail, service, action, args) { | ||
// If we have a local handler, call that. Otherwise pass it to the simulation host. | ||
var handler = pluginHandlers[service] && pluginHandlers[service][action]; | ||
if (handler) { | ||
// Ensure local handlers are executed asynchronously. | ||
setTimeout(function () { | ||
handler(success, fail, service, action, args); | ||
}, 0); | ||
} else { | ||
var execIndex = nextExecCacheIndex++; | ||
execCache[execIndex] = {index: execIndex, success: success, fail: fail}; | ||
socket.emit('exec', {index: execIndex, service: service, action: action, args: args}); | ||
} | ||
} | ||
|
||
// Setup for cordova.exec patching | ||
Object.defineProperty(window, 'cordova', { | ||
set: setCordova, | ||
get: getCordova | ||
}); | ||
|
||
function clobber(clobbers, scope) { | ||
Object.keys(clobbers).forEach(function (key) { | ||
if (clobbers[key] && typeof clobbers[key] === 'object') { | ||
scope[key] = scope[key] || {}; | ||
clobber(clobbers[key], scope[key]); | ||
} else { | ||
scope[key] = clobbers[key]; | ||
} | ||
}); | ||
} | ||
|
||
// Details of each plugin that has app-host code is injected when this file is served. | ||
var plugins = { | ||
/** PLUGINS **/ | ||
}; | ||
|
||
var pluginHandlersDefinitions = { | ||
/** PLUGIN-HANDLERS **/ | ||
}; | ||
|
||
var pluginClobberDefinitions = { | ||
/** PLUGIN-CLOBBERS **/ | ||
}; | ||
|
||
var pluginMessages = {}; | ||
applyPlugins(plugins); | ||
applyPlugins(pluginHandlersDefinitions, pluginHandlers); | ||
applyPlugins(pluginClobberDefinitions, window); | ||
|
||
function applyPlugins(plugins, clobberScope) { | ||
Object.keys(plugins).forEach(function (pluginId) { | ||
var plugin = plugins[pluginId]; | ||
if (plugin) { | ||
if (typeof plugin === 'function') { | ||
pluginMessages[pluginId] = pluginMessages[pluginId] || new Messages(pluginId, socket); | ||
plugin = plugin(pluginMessages[pluginId], exec); | ||
plugins[pluginId] = plugin; | ||
} | ||
if (clobberScope) { | ||
clobber(plugin, clobberScope); | ||
} | ||
} | ||
}); | ||
} |
Oops, something went wrong.