Skip to content

Commit

Permalink
Merge branch 'release/0.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Sep 3, 2015
2 parents c11d4c7 + 059fda0 commit dd53710
Show file tree
Hide file tree
Showing 146 changed files with 19,255 additions and 5,122 deletions.
44 changes: 44 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Contributing to cgm-remote-monitor](#contributing-to-cgm-remote-monitor)
- [Design](#design)
- [Develop on `dev`](#develop-on-dev)
- [Style Guide](#style-guide)
- [Create a prototype](#create-a-prototype)
- [Submit a pull request](#submit-a-pull-request)
- [Comments and issues](#comments-and-issues)
- [Co-ordination](#co-ordination)
- [Other Dev Tips](#other-dev-tips)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


# Contributing to cgm-remote-monitor

Expand Down Expand Up @@ -30,6 +46,24 @@ design.
We develop on the `dev` branch.
You can get the dev branch checked out using `git checkout dev`.

## Style Guide

Some simple rules, that will make it easier to maintain our codebase:

* All indenting should use 2 space where possible (js, css, html, etc)
* A space before function parameters, such as: `function boom (name, callback) { }`, this makes searching for calls easier
* Name your callback functions, such as `boom('the name', function afterBoom ( result ) { }`
* Don't include author names in the header of your files, if you need to give credit to someone else do it in the commit comment.
* Use the comma first style, for example:

```javascript
var data = {
value: 'the value'
, detail: 'the details...'
, time: Date.now()
};
```

## Create a prototype

Fork cgm-remote-monitor and create a branch.
Expand Down Expand Up @@ -77,3 +111,13 @@ the version correctly. See sem-ver for versioning strategy.
Every commit is tested by travis. We encourage adding tests to
validate your design. We encourage discussing your use cases to help
everyone get a better understanding of your design.
## Other Dev Tips
* Join the [Gitter chat][gitter-url]
* Get a local dev environment setup if you haven't already
* Try breaking up big features/improvements into small parts. It's much easier to accept small PR's
* Create tests for your new code, and for the old code too. We are aiming for a full test coverage.
* If your going to be working in old code that needs lots of reformatting consider doing the clean as a separate PR.
* If you can find others to help test your PR is will help get them merged in sooner.

10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ MONGO_CONNECTION?=mongodb://localhost/test_db
CUSTOMCONNSTR_mongo_settings_collection?=test_settings
CUSTOMCONNSTR_mongo_collection?=test_sgvs
MONGO_SETTINGS=MONGO_CONNECTION=${MONGO_CONNECTION} \
CUSTOMCONNSTR_mongo_collection=${CUSTOMCONNSTR_mongo_collection} \
CUSTOMCONNSTR_mongo_settings_collection=${CUSTOMCONNSTR_mongo_settings_collection}
CUSTOMCONNSTR_mongo_collection=${CUSTOMCONNSTR_mongo_collection}

# XXX.bewest: Mocha is an odd process, and since things are being
# wrapped and transformed, this odd path needs to be used, not the
Expand All @@ -23,6 +22,7 @@ MOCHA=./node_modules/mocha/bin/_mocha
# Pinned from dependency list.
ISTANBUL=./node_modules/.bin/istanbul
ANALYZED=./coverage/lcov.info
export CODACY_REPO_TOKEN=e29ae5cf671f4f918912d9864316207c

all: test

Expand All @@ -34,6 +34,12 @@ report:
test -f ${ANALYZED} && \
(npm install coveralls && cat ${ANALYZED} | \
./node_modules/.bin/coveralls) || echo "NO COVERAGE"
test -f ${ANALYZED} && \
(npm install codecov.io && cat ${ANALYZED} | \
./node_modules/codecov.io/bin/codecov.io.js) || echo "NO COVERAGE"
test -f ${ANALYZED} && \
(npm install codacy-coverage && cat ${ANALYZED} | \
YOURPACKAGE_COVERAGE=1 ./node_modules/codacy-coverage/bin/codacy-coverage.js) || echo "NO COVERAGE"

test:
${MONGO_SETTINGS} ${MOCHA} -R tap ${TESTS}
Expand Down
216 changes: 192 additions & 24 deletions README.md

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions Release.md

This file was deleted.

28 changes: 12 additions & 16 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,18 @@ function create (env, ctx) {
///////////////////////////////////////////////////
// api and json object variables
///////////////////////////////////////////////////
var api = require('./lib/api/')(env, ctx.entries, ctx.settings, ctx.treatments, ctx.profiles, ctx.devicestatus);
var pebble = ctx.pebble;
var api = require('./lib/api/')(env, ctx);

var app = express();
app.entries = ctx.entries;
app.treatments = ctx.treatments;
app.profiles = ctx.profiles;
app.devicestatus = ctx.devicestatus;
var appInfo = env.name + ' ' + env.version;
app.set('title', appInfo);
app.enable('trust proxy'); // Allows req.secure test on heroku https connections.

app.use(compression({filter: shouldCompress}));

function shouldCompress(req, res) {
//TODO: return false here if we find a condition where we don't want to compress
// fallback to standard filter function
return compression.filter(req, res);
}
app.use(compression({filter: function shouldCompress(req, res) {
//TODO: return false here if we find a condition where we don't want to compress
// fallback to standard filter function
return compression.filter(req, res);
}}));

//if (env.api_secret) {
// console.log("API_SECRET", env.api_secret);
Expand All @@ -32,7 +25,12 @@ function create (env, ctx) {


// pebble data
app.get('/pebble', pebble(ctx.entries, ctx.treatments, ctx.profiles, ctx.devicestatus, env));
app.get('/pebble', ctx.pebble);

// expose swagger.yaml
app.get('/swagger.yaml', function (req, res) {
res.sendFile(__dirname + '/swagger.yaml');
});

//app.get('/package.json', software);

Expand All @@ -46,8 +44,6 @@ function create (env, ctx) {
var bundle = require('./bundle')();
app.use(bundle);

// Handle errors with express's errorhandler, to display more readable error messages.

// Handle errors with express's errorhandler, to display more readable error messages.
var errorhandler = require('errorhandler');
//if (process.env.NODE_ENV === 'development') {
Expand Down
113 changes: 109 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,27 @@
"required": true
},
"API_SECRET": {
"description": "REQUIRED: User generated password used for REST API and optional features (12 character minimum).",
"description": "REQUIRED: A secret passphrase that must be at least 12 characters long, required to enable POST and PUT; also required for the Care Portal",
"value": "",
"required": true
},
"DISPLAY_UNITS": {
"description": "Server display units for BG values. Default null value implies 'mg/dl'. Set to 'mmol' to change the server to mmol mode.",
"description": "Choices: mg/dl and mmol. Setting to mmol puts the entire server into mmol mode by default, no further settings needed.",
"value": "",
"required": false
},
"ENABLE": {
"description": "Space delimited list of optional features to enable, such as 'careportal'.",
"description": "Used to enable optional features, expects a space delimited list, such as: careportal rawbg iob, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info",
"value": "",
"required": false
},
"DISABLE": {
"description": "Used to disable default features, expects a space delimited list, such as: direction upbat, see https://github.com/nightscout/cgm-remote-monitor/blob/master/README.md for more info",
"value": "",
"required": false
},
"ALARM_TYPES": {
"description": "Nightscout alarm behavior control. Default null value implies 'predict'. For adjustable alarm thresholds (set below), set to 'simple'.",
"description": "Alarm behavior currently 2 alarm types are supported simple and predict, and can be used independently or combined. The simple alarm type only compares the current BG to BG_ thresholds above, the predict alarm type uses highly tuned formula that forecasts where the BG is going based on it's trend. predict DOES NOT currently use any of the BG_* ENV's",
"value": "",
"required": false
},
Expand Down Expand Up @@ -56,6 +61,106 @@
"description": "Pushover user key, required for Pushover notifications. Leave blank if not using Pushover.",
"value": "",
"required": false
},
"PUSHOVER_ANNOUNCEMENT_KEY": {
"description": "An optional Pushover user/group key, will be used for system wide user generated announcements. If not defined this will fallback to `PUSHOVER_USER_KEY`. A possible use for this is sending important messages and alarms to a CWD that you don't want to send all notification too. This also support a space delimited list of keys. Leave blank if not using Pushover",
"value": "",
"required": false
},
"CUSTOM_TITLE": {
"description": "Customize the name of the website, usually the name of T1.",
"value": "",
"required": false
},
"THEME": {
"description": "Possible values default or colors",
"value": "",
"required": false
},
"SHOW_RAWBG": {
"description": "Possible values always, never or noise",
"value": "",
"required": false
},
"BRIDGE_USER_NAME": {
"description": "Share bridge - Your user name for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge",
"value": "",
"required": false
},
"BRIDGE_PASSWORD": {
"description": "Share bridge - Your password for the Share service. ENSURE bridge is in ENABLE if you want to use the share bridge",
"value": "",
"required": false
},
"TIME_FORMAT": {
"description": "Browser default time mode valid settings are 12 or 24",
"value": "12",
"required": false
},
"NIGHT_MODE": {
"description": "Browser defaults to night mode valid settings are on or off",
"value": "off",
"required": false
},
"SHOW_RAWBG": {
"description": "Browser default raw display mode vaild settings are always never or noise",
"value": "never",
"required": false
},
"THEME": {
"description": "Browser default theme setting vaild settings are default or colors",
"value": "default",
"required": false
},
"ALARM_URGENT_HIGH": {
"description": "Browser default urgent high alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_HIGH": {
"description": "Browser default high alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_LOW": {
"description": "Browser default low alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_URGENT_LOW": {
"description": "Browser default urgent low alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_WARN": {
"description": "Browser default warn after time of last data exceeds ALARM_TIMEAGO_WARN_MINS alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_WARN_MINS": {
"description": "Browser default minutes since the last reading to trigger a warning",
"value": "15",
"required": false
},
"ALARM_TIMEAGO_URGENT": {
"description": "Browser default urgent warning after time of last data exceeds ALARM_TIMEAGO_URGENT_MINS alarm enabled vaild settings are on or off",
"value": "on",
"required": false
},
"ALARM_TIMEAGO_URGENT_MINS": {
"description": "Browser default minutes since last reading to trigger an urgent alarm",
"value": "30",
"required": false
},
"MAKER_KEY": {
"description": "Maker Key - Set this to your secret key Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker, Leave blank if not using maker",
"value": "",
"required": false
},
"MAKER_ANNOUNCEMENT_KEY": {
"description": "Maker Announcement Key - Set this to your secret key for announcements Note for additional info see https://github.com/nightscout/cgm-remote-monitor/blob/dev/README.md#ifttt-maker , maker should be added to enable if you want to use maker Leave blank if not using maker",
"value": "",
"required": false
}
},
"addons": [
Expand Down
9 changes: 9 additions & 0 deletions bin/post-sgv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# "date": "1413782506964"

curl -H "Content-Type: application/json" -H "api-secret: $API_SECRET" -XPOST 'http://localhost:1337/api/v1/entries/' -d '{
"sgv": 100,
"type": "sgv",
"direction": "Flat",
"date": "1415950912800"
}'
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "nightscout",
"version": "0.7.0",
"version": "0.8.0",
"dependencies": {
"angularjs": "1.3.0-beta.19",
"bootstrap": "~3.2.0",
"d3": "3.4.3",
"jquery": "2.1.0",
"jQuery-Storage-API": "~1.7.2",
"tipsy-jmalonzo": "~1.0.1",
"jsSHA": "~1.5.0"
"jquery-ui": "~1.11.3",
"swagger-ui": "~2.1.2"
},
"resolutions": {
"jquery": "2.1.0"
Expand Down
15 changes: 9 additions & 6 deletions bundle/bundle.source.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
(function () {

window.Nightscout = window.Nightscout || {};
window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
window.moment = require('moment-timezone');
window.Nightscout = window.Nightscout || {};

window.Nightscout = {
iob: require('../lib/iob')()
, units: require('../lib/units')()
};
window.Nightscout = {
client: require('../lib/client')
, plugins: require('../lib/plugins/')().registerClientDefaults()
};

console.info("Nightscout bundle ready", window.Nightscout);
console.info('Nightscout bundle ready');

})();

Loading

0 comments on commit dd53710

Please sign in to comment.