Skip to content

Commit

Permalink
Merge pull request #1 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jweismann committed Aug 19, 2015
2 parents 7c57eba + e628a76 commit a717c68
Show file tree
Hide file tree
Showing 139 changed files with 15,948 additions and 4,552 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
240 changes: 222 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
15 changes: 15 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@
"description": "Pushover user key, required for Pushover notifications. 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
}
},
"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"
}'
5 changes: 2 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "nightscout",
"version": "0.7.0",
"version": "0.8.0-beta1",
"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"
},
"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', window.Nightscout);

})();

Loading

0 comments on commit a717c68

Please sign in to comment.