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
Caraway
committed
Oct 10, 2016
1 parent
8a5470c
commit fd5d283
Showing
11,677 changed files
with
698,857 additions
and
34 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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,19 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<widget id="edu.northwestern.cbits.livewell" version="3.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
<name>LiveWell</name> | ||
<description> | ||
An application for bipolar disorder | ||
</description> | ||
<author email="e-goulding@northwestern.edu" href="http://www.cbits.northwestern.edu"> | ||
Evan Goulding | ||
</author> | ||
<content src="index.html" /> | ||
<access origin="*" /> | ||
<allow-intent href="http://*/*" /> | ||
<allow-intent href="https://*/*" /> | ||
<allow-intent href="tel:*" /> | ||
<allow-navigation href="http://*/*" /> | ||
<allow-navigation href="https://*/*" /> | ||
<allow-navigation href="data:*" /> | ||
<icon src="icon.png" /> | ||
</widget> |
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,196 @@ | ||
<!-- | ||
# | ||
# 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. | ||
# | ||
--> | ||
# Cordova Hooks | ||
|
||
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order: | ||
* Application hooks from `/hooks`; | ||
* Application hooks from `config.xml`; | ||
* Plugin hooks from `plugins/.../plugin.xml`. | ||
|
||
__Remember__: Make your scripts executable. | ||
|
||
__Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated. | ||
|
||
## Supported hook types | ||
The following hook types are supported: | ||
|
||
after_build/ | ||
after_compile/ | ||
after_docs/ | ||
after_emulate/ | ||
after_platform_add/ | ||
after_platform_rm/ | ||
after_platform_ls/ | ||
after_plugin_add/ | ||
after_plugin_ls/ | ||
after_plugin_rm/ | ||
after_plugin_search/ | ||
after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed | ||
after_prepare/ | ||
after_run/ | ||
after_serve/ | ||
before_build/ | ||
before_compile/ | ||
before_docs/ | ||
before_emulate/ | ||
before_platform_add/ | ||
before_platform_rm/ | ||
before_platform_ls/ | ||
before_plugin_add/ | ||
before_plugin_ls/ | ||
before_plugin_rm/ | ||
before_plugin_search/ | ||
before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed | ||
before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled | ||
before_prepare/ | ||
before_run/ | ||
before_serve/ | ||
pre_package/ <-- Windows 8 and Windows Phone only. | ||
|
||
## Ways to define hooks | ||
### Via '/hooks' directory | ||
To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example: | ||
|
||
# script file will be automatically executed after each build | ||
hooks/after_build/after_build_custom_action.js | ||
|
||
|
||
### Config.xml | ||
|
||
Hooks can be defined in project's `config.xml` using `<hook>` elements, for example: | ||
|
||
<hook type="before_build" src="scripts/appBeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/appBeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" /> | ||
|
||
<platform name="wp8"> | ||
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/wp8/appWP8BeforePluginInstall.js" /> | ||
... | ||
</platform> | ||
|
||
<platform name="windows8"> | ||
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/windows8/appWin8BeforePluginInstall.js" /> | ||
... | ||
</platform> | ||
|
||
### Plugin hooks (plugin.xml) | ||
|
||
As a plugin developer you can define hook scripts using `<hook>` elements in a `plugin.xml` like that: | ||
|
||
<hook type="before_plugin_install" src="scripts/beforeInstall.js" /> | ||
<hook type="after_build" src="scripts/afterBuild.js" /> | ||
|
||
<platform name="wp8"> | ||
<hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" /> | ||
<hook type="before_build" src="scripts/wp8BeforeBuild.js" /> | ||
... | ||
</platform> | ||
|
||
`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled. | ||
|
||
## Script Interface | ||
|
||
### Javascript | ||
|
||
If you are writing hooks in Javascript you should use the following module definition: | ||
```javascript | ||
module.exports = function(context) { | ||
... | ||
} | ||
``` | ||
|
||
You can make your scipts async using Q: | ||
```javascript | ||
module.exports = function(context) { | ||
var Q = context.requireCordovaModule('q'); | ||
var deferral = new Q.defer(); | ||
|
||
setTimeout(function(){ | ||
console.log('hook.js>> end'); | ||
deferral.resolve(); | ||
}, 1000); | ||
|
||
return deferral.promise; | ||
} | ||
``` | ||
|
||
`context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object: | ||
```json | ||
{ | ||
"hook": "before_plugin_install", | ||
"scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js", | ||
"cmdLine": "The\\exact\\command\\cordova\\run\\with arguments", | ||
"opts": { | ||
"projectRoot":"C:\\path\\to\\the\\project", | ||
"cordova": { | ||
"platforms": ["wp8"], | ||
"plugins": ["com.plugin.withhooks"], | ||
"version": "0.21.7-dev" | ||
}, | ||
"plugin": { | ||
"id": "com.plugin.withhooks", | ||
"pluginInfo": { | ||
... | ||
}, | ||
"platform": "wp8", | ||
"dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks" | ||
} | ||
}, | ||
"cordova": {...} | ||
} | ||
|
||
``` | ||
`context.opts.plugin` object will only be passed to plugin hooks scripts. | ||
|
||
You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way: | ||
```javascript | ||
var Q = context.requireCordovaModule('q'); | ||
``` | ||
|
||
__Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only. | ||
For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below. | ||
|
||
### Non-javascript | ||
|
||
Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: | ||
|
||
* CORDOVA_VERSION - The version of the Cordova-CLI. | ||
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). | ||
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) | ||
* CORDOVA_HOOK - Path to the hook that is being executed. | ||
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) | ||
|
||
If a script returns a non-zero exit code, then the parent cordova command will be aborted. | ||
|
||
## Writing hooks | ||
|
||
We highly recommend writing your hooks using Node.js so that they are | ||
cross-platform. Some good examples are shown here: | ||
|
||
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) | ||
|
||
Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example: | ||
|
||
#!/usr/bin/env [name_of_interpreter_executable] |
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 |
---|---|---|
@@ -1,40 +1,51 @@ | ||
{ | ||
"name": "livewell", | ||
"version": "0.0.0", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"grunt": "^0.4.1", | ||
"grunt-autoprefixer": "^0.7.3", | ||
"grunt-concurrent": "^0.5.0", | ||
"grunt-contrib-clean": "^0.5.0", | ||
"grunt-contrib-concat": "^0.4.0", | ||
"grunt-contrib-connect": "^0.7.1", | ||
"grunt-contrib-copy": "^0.5.0", | ||
"grunt-contrib-cssmin": "^0.9.0", | ||
"grunt-contrib-htmlmin": "^0.3.0", | ||
"grunt-contrib-imagemin": "^0.7.0", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-uglify": "^0.4.0", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-filerev": "^0.2.1", | ||
"grunt-google-cdn": "^0.4.0", | ||
"grunt-newer": "^0.7.0", | ||
"grunt-ngmin": "^0.0.3", | ||
"grunt-svgmin": "^0.4.0", | ||
"grunt-usemin": "^2.1.1", | ||
"grunt-wiredep": "^1.7.0", | ||
"jshint-stylish": "^0.2.0", | ||
"load-grunt-tasks": "^0.4.0", | ||
"time-grunt": "^0.3.1", | ||
"grunt-karma": "~0.9.0", | ||
"karma-phantomjs-launcher": "~0.1.4", | ||
"karma": "~0.12.23", | ||
"karma-jasmine": "~0.1.5" | ||
"name": "LiveWell", | ||
"version": "0.0.1", | ||
"description": "LiveWell application, expert system and notifications for bipolar intervention", | ||
"author": "Mark Begale", | ||
"contributors": [ | ||
{ | ||
"name": "Mark Begale", | ||
"email": "m-begale@northwestern.edu" | ||
} | ||
], | ||
"dependencies": { | ||
"angular": "^1.4.0", | ||
"angular-resource": "^1.4.0", | ||
"angular-route": "^1.4.0", | ||
"cordova": "5.3.1", | ||
"font-awesome": "^4.3.0", | ||
"moment": "^2.10.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"devDependencies": { | ||
"angular-mocks": "^1.4.0", | ||
"chai": "^2.1.2", | ||
"chai-as-promised": "^5.0.0", | ||
"eslint": "^1.3.1", | ||
"mocha": "^2.2.1", | ||
"sinon": "^1.14.1", | ||
"testem": "^0.8.0-0", | ||
"wd": "^0.3.11" | ||
}, | ||
"keywords": [ | ||
"bipolar" | ||
], | ||
"scripts": { | ||
"test": "grunt test" | ||
"init": "npm install && npm_config_env=test npm_config_server=http://127.0.0.1:3000 npm run set_endpoint && npm run set_endpoint && npm run build:prepare && npm run browser:add_platform && npm run android:add_platform && npm run add_plugins", | ||
"set_endpoint": "echo \"{\\\"environment\\\":\\\"$npm_config_env\\\",\\\"server\\\":\\\"$npm_config_server\\\"}\" > src/config.json && sed s%ACCESS_ORIGIN%$npm_config_server%g config > config.xml", | ||
"android:add_platform": "./node_modules/.bin/cordova platform remove android && ./node_modules/.bin/cordova platform add android@4.0.0", | ||
"android:build": "npm run build:prepare && ./node_modules/.bin/cordova build android", | ||
"android:simulator": "npm run android:build && ./node_modules/.bin/cordova run android", | ||
"browser:add_platform": "./node_modules/.bin/cordova platform remove browser && ./node_modules/.bin/cordova platform add browser && npm run add_plugins", | ||
"add_plugins": "", | ||
"browser:build": "npm run build:prepare && ./node_modules/.bin/cordova build browser", | ||
"browser:simulator": "npm run browser:build && ./node_modules/.bin/cordova run browser", | ||
"build:all": "npm run browser:build && npm run android:build", | ||
"build:clean": "rm -rf www && mkdir -p www/js www/css", | ||
"build:prepare": "npm run build:clean && cp -r src/* www/", | ||
"eslint": "./node_modules/.bin/eslint src && ./node_modules/.bin/eslint test", | ||
"eslint:src": "./node_modules/.bin/eslint src", | ||
"eslint:test": "./node_modules/.bin/eslint test", | ||
"serve": "npm run build:prepare && ./node_modules/.bin/cordova run browser" | ||
} | ||
} |
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,14 @@ | ||
# Non-project-specific build files: | ||
build.xml | ||
local.properties | ||
/gradlew | ||
/gradlew.bat | ||
/gradle | ||
# Ant builds | ||
ant-build | ||
ant-gen | ||
# Eclipse builds | ||
gen | ||
out | ||
# Gradle builds | ||
/build |
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 @@ | ||
#Thu Apr 14 18:49:51 CDT 2016 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,39 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<manifest android:hardwareAccelerated="true" android:versionCode="30301" android:versionName="3.3.1" package="edu.northwestern.cbits.livewell" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true"> | ||
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"> | ||
<intent-filter android:label="@string/launcher_name"> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" /> | ||
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" /> | ||
<receiver android:exported="true" android:name="com.google.android.gms.gcm.GcmReceiver" android:permission="com.google.android.c2dm.permission.SEND"> | ||
<intent-filter> | ||
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | ||
<category android:name="edu.northwestern.cbits.livewell" /> | ||
</intent-filter> | ||
</receiver> | ||
<service android:exported="false" android:name="com.adobe.phonegap.push.GCMIntentService"> | ||
<intent-filter> | ||
<action android:name="com.google.android.c2dm.intent.RECEIVE" /> | ||
</intent-filter> | ||
</service> | ||
<service android:exported="false" android:name="com.adobe.phonegap.push.PushInstanceIDListenerService"> | ||
<intent-filter> | ||
<action android:name="com.google.android.gms.iid.InstanceID" /> | ||
</intent-filter> | ||
</service> | ||
<service android:exported="false" android:name="com.adobe.phonegap.push.RegistrationIntentService" /> | ||
</application> | ||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" /> | ||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> | ||
<permission android:name="edu.northwestern.cbits.livewell.permission.C2D_MESSAGE" android:protectionLevel="signature" /> | ||
<uses-permission android:name="edu.northwestern.cbits.livewell.permission.C2D_MESSAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
</manifest> |
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,23 @@ | ||
<?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. | ||
--> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="org.apache.cordova" android:versionName="1.0" android:versionCode="1"> | ||
<uses-sdk android:minSdkVersion="14" /> | ||
</manifest> |
Oops, something went wrong.