Skip to content

Commit

Permalink
Merge pull request #4 from nightscout/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
bogdangorescu committed Jul 23, 2015
2 parents 1055a59 + 71d19c6 commit d0dab4d
Show file tree
Hide file tree
Showing 157 changed files with 12,880 additions and 3,504 deletions.
10 changes: 9 additions & 1 deletion .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 @@ -11,4 +14,9 @@ static/bower_components/
.DS_Store

.vagrant
/iisnode
/iisnode

# istanbul output
coverage/

npm-debug.log
15 changes: 6 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
language: node_js
sudo: false
node_js:
- "0.10"
- "0.11"
services:
- mongodb
before_script:
- sleep 10
- echo mongo mongo_travis
script:
- make test
- "0.10"
- "0.12"
services: mongodb
script: make travis
after_script: make report
123 changes: 123 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!-- 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

[![Build Status][build-img]][build-url]
[![Dependency Status][dependency-img]][dependency-url]
[![Coverage Status][coverage-img]][coverage-url]
[![Gitter chat][gitter-img]][gitter-url]
[![Stories in Ready][ready-img]][waffle]
[![Stories in Progress][progress-img]][waffle]

[build-img]: https://img.shields.io/travis/nightscout/cgm-remote-monitor.svg
[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/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
design.

## Develop on `dev`

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.
You can create a branch using `git checkout -b wip/add-my-widget`.
This creates a new branch called `wip/add-my-widget`. The `wip`
stands for work in progress and is a common prefix so that when know
what to expect when reviewing many branches.

## Submit a pull request

When you are done working with your prototype, it can be tempting to
post on popular channels such as Facebook. We encourage contributors
to submit their code for review, debate, and release before announcing
features on social media.

This can be done by checking your code `git commit -avm 'my
improvements are here'`, the branch you created back to your own
fork. This will probably look something like
`git push -u origin wip/add-my-widget`.

Now that the commits are available on github, you can click on the
compare buttons on your fork to create a pull request. Make sure to
select [Nightscout's `dev` branch](https://github.com/nightscout/cgm-remote-monitor/tree/dev).
## Comments and issues
We encourage liberal use of the comments, including images where
appropriate.
## Co-ordination
There is a google groups nightscout-core developers list where lots of
people discuss Nightscout. Most cgm-remote-monitor hackers use
github's ticketing system, along with Facebook cgm-in-the-cloud, and
gitter system.

We use git-flow, with `master` as our production, stable branch, and
`dev` is used to queue up for upcoming releases. Everything else is
done on branches, hopefully with names that indicate what to expect.

Once `dev` has been reviewed and people feel it's time to release, we
follow the git-flow release process, which creates a new tag and bumps
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.

61 changes: 39 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +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

BLANKET=--require blanket
MONGO_SETTINGS=MONGO_CONNECTION=${MONGO_CONNECTION} \
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 node_modules/.bin/mocha ${BLANKET} -R 'travis-cov' ${TESTS}

coveralls:
NODE_ENV=test \
./node_modules/.bin/mocha ${BLANKET} -R mocha-lcov-reporter \
${TESTS} | ./coverall.sh

coverhtml:
./node_modules/.bin/mocha ${BLANKET} -R html-cov ${TESTS} > tests/coverage.html
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_CONNECTION=${MONGO_CONNECTION} \
CUSTOMCONNSTR_mongo_collection=${CUSTOMCONNSTR_mongo_collection} \
CUSTOMCONNSTR_mongo_settings_collection=${CUSTOMCONNSTR_mongo_settings_collection} \
mocha --verbose -vvv -R tap ${TESTS}

precover:
./node_modules/.bin/mocha ${BLANKET} ${SHOULD} -R html-cov ${TESTS} | w3m -T text/html

${MONGO_SETTINGS} ${MOCHA} -R tap ${TESTS}

travis: test travis-cov coveralls coverhtml
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 d0dab4d

Please sign in to comment.