Skip to content

Commit

Permalink
Merge pull request #1 from nightscout/dev
Browse files Browse the repository at this point in the history
Update Dev
  • Loading branch information
dougtakeuti committed Jul 22, 2015
2 parents 09e0d45 + 60fcb98 commit 1897b9a
Show file tree
Hide file tree
Showing 117 changed files with 10,814 additions and 4,690 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
230 changes: 212 additions & 18 deletions README.md

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions Release.md

This file was deleted.

23 changes: 7 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,7 @@ function create (env, ctx) {


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

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

Expand All @@ -46,8 +39,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
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
Expand Up @@ -4,11 +4,11 @@
"dependencies": {
"angularjs": "1.3.0-beta.19",
"bootstrap": "~3.2.0",
"d3": "3.4.3",
"d3": "~3.5.5",
"jquery": "2.1.0",
"jQuery-Storage-API": "~1.7.2",
"tipsy-jmalonzo": "~1.0.1",
"jsSHA": "~1.5.0"
"jsSHA": "~1.5.0",
"tipsy-jmalonzo": "~1.0.1"
},
"resolutions": {
"jquery": "2.1.0"
Expand Down
51 changes: 15 additions & 36 deletions bundle/bundle.source.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
(function () {

window.Nightscout = window.Nightscout || {};

// Default features

window.Nightscout = {
units: require('../lib/units')(),
profile: require('../lib/profilefunctions')()
};

// Plugins

var inherits = require("inherits");
var PluginBase = require('../lib/pluginbase'); // Define any shared functionality in this class

window.NightscoutPlugins = window.NightscoutPlugins || {};

window.NightscoutPlugins = {
iob: require('../lib/iob')(PluginBase),
cob: require('../lib/cob')(PluginBase),
bwp: require('../lib/boluswizardpreview')(PluginBase),
cage: require('../lib/cannulaage')(PluginBase)
};
// class inheritance to the plugins from the base + map functions over

for (var p in window.NightscoutPlugins) {
var plugin = window.NightscoutPlugins[p];
inherits(plugin, PluginBase);
plugin.name = p;

for (var n in PluginBase.prototype) {
var item = PluginBase.prototype[n];
plugin[n] = item;
}
}

console.info("Nightscout bundle ready", window.Nightscout);
window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
window.moment = require('moment-timezone');
window.Nightscout = window.Nightscout || {};

window.Nightscout = {
units: require('../lib/units')(),
utils: require('../lib/utils')(),
profile: require('../lib/profilefunctions')(),
language: require('../lib/language')(),
plugins: require('../lib/plugins/')().registerClientDefaults(),
sandbox: require('../lib/sandbox')()
};

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

})();

Loading

0 comments on commit 1897b9a

Please sign in to comment.