Skip to content

Commit

Permalink
Merge pull request #2 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
divishinating committed Aug 4, 2015
2 parents 57c8e99 + 91d0129 commit 2d23444
Show file tree
Hide file tree
Showing 158 changed files with 14,122 additions and 3,682 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
bower_components/
node_modules/


bundle/bundle.out.js

.idea/
*.iml
my.env
Expand All @@ -15,3 +18,5 @@ static/bower_components/

# istanbul output
coverage/

npm-debug.log
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.11"
matrix:
allow_failures:
- node_js: "0.11"
services:
- mongodb
before_script:
- sleep 10
- echo mongo mongo_travis
script:
- make travis
- "0.10"
- "0.12"
services: mongodb
script: make travis
after_script: make report
49 changes: 46 additions & 3 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 All @@ -12,15 +28,14 @@
[build-url]: https://travis-ci.org/nightscout/cgm-remote-monitor
[dependency-img]: https://img.shields.io/david/nightscout/cgm-remote-monitor.svg
[dependency-url]: https://david-dm.org/nightscout/cgm-remote-monitor
[coverage-img]: https://img.shields.io/coveralls/nightscout/cgm-remote-monitor/coverage.svg
[coverage-url]: https://coveralls.io/r/nightscout/cgm-remote-monitor?branch=dev
[coverage-img]: https://img.shields.io/coveralls/nightscout/cgm-remote-monitor/master.svg
[coverage-url]: https://coveralls.io/r/nightscout/cgm-remote-monitor?branch=master
[gitter-img]: https://img.shields.io/badge/Gitter-Join%20Chat%20%E2%86%92-1dce73.svg
[gitter-url]: https://gitter.im/nightscout/public
[ready-img]: https://badge.waffle.io/nightscout/cgm-remote-monitor.svg?label=ready&title=Ready
[waffle]: https://waffle.io/nightscout/cgm-remote-monitor
[progress-img]: https://badge.waffle.io/nightscout/cgm-remote-monitor.svg?label=in+progress&title=In+Progress


## Design

Participate in the design process by creating an issue to discuss your
Expand All @@ -31,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 @@ -78,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.

50 changes: 38 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,51 @@

# Nightscout tests/builds/analysis
TESTS=tests/*.js
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
# normal wrapper. When ./node_modules/.bin/mocha is used, no coverage
# information is generated. This happens because typical shell
# wrapper performs process management that mucks with the test
# coverage reporter's ability to instrument the tests correctly.
# Hard coding it to the local with our pinned version is bigger for
# initial installs, but ensures a consistent environment everywhere.
# On Travis, ./node_modules/.bin and other `nvm` and `npm` bundles are
# inserted into the default `$PATH` enviroinment, making pointing to
# the unwrapped mocha executable necessary.
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

travis-cov:
NODE_ENV=test \
${MONGO_SETTINGS} \
istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -vvv -R tap ${TESTS} && \
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && \
rm -rf ./coverage
coverage:
NODE_ENV=test ${MONGO_SETTINGS} \
${ISTANBUL} cover ${MOCHA} -- -R tap ${TESTS}

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 --verbose -vvv -R tap ${TESTS}
${MONGO_SETTINGS} ${MOCHA} -R tap ${TESTS}

travis: test travis-cov
travis:
NODE_ENV=test ${MONGO_SETTINGS} \
${ISTANBUL} cover ${MOCHA} --report lcovonly -- -R tap ${TESTS}

.PHONY: test
.PHONY: all coverage report test travis
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: node server.js
web: ./node_modules/.bin/forever --minUptime 100 -c node server.js
Loading

0 comments on commit 2d23444

Please sign in to comment.