Skip to content

Commit

Permalink
Merge branch 'master' into 0-1-stable
Browse files Browse the repository at this point in the history
Conflicts:
	README.md
  • Loading branch information
Philzen committed Apr 4, 2014
2 parents 2f7cc86 + 126e4b9 commit 94f0678
Show file tree
Hide file tree
Showing 18 changed files with 486 additions and 240 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/nbproject/private/
/nbproject/private/
/node_modules/
/coverage/
13 changes: 12 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
script: phantomjs test/phantomRunner.js test/index.html
language: node_js
node_js:
- '0.11'
- '0.10'
- '0.8'
deploy:
provider: npm
api_key:
secure: iHcy2J1AKnPb/LzaGCIr6ziELKqXL4jPTmGpgQfzng79bsfDIi7QhSXL6IANzlqswU/VKB2eUrFBlvEC/MJ5YmbdovzX+uELexhp5GCeOBv3lSJQWVgFU3NKFM6vje4iBcBjqUg+IG4gZs0NI17YWd9zfDAY9AKvl2UoCEo9R18=
on:
tags: true
node: 0.10
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# MeasurementJs

[![Code Climate](https://codeclimate.com/github/Philzen/measurement.js.png)]
(https://codeclimate.com/github/Philzen/measurement.js)
[![Build Status](https://travis-ci.org/Philzen/measurement.js.svg?branch=0-1-stable)]
(https://travis-ci.org/Philzen/measurement.js)
[![devDependency Status](https://david-dm.org/philzen/measurement.js/dev-status.svg?theme=shields.io)]
(https://david-dm.org/philzen/measurement.js#info=devDependencies)
[![Code Climate](https://codeclimate.com/github/Philzen/measurement.js.png)]
(https://codeclimate.com/github/Philzen/measurement.js)


Nice unit of measure conversion, featuring:
- __Simplicity__: an easy to-use, Behaviour driven API
- __Sophistication__: full test coverage from project day one
- __Sophistication__: [![Coverage Status](https://coveralls.io/repos/Philzen/measurement.js/badge.png?branch=master)](https://coveralls.io/r/Philzen/measurement.js?branch=master) full test coverage from project day one
- __Quality__: aiming at high performance whilst maintaining a fair trade-off between accuracy
- __Adaptability__: Easy to extend for new measurement types (incl. i18n tables)

Expand All @@ -34,14 +34,20 @@ measurement('Speed').convert(10)
The API definition and all conversion operations are covered by jasmine tests.
The test suite can be executed straightaway and easily, for example:

- In the Browser:
Simply open test/index.html in the browser environment you want to test
- Test directly in the browser
Simply open test/index.html in the browser

- CLI-based (using npm)
`npm test`
- PhantomJs via Karma test driver
`npm run-script karma`
That command is just a shorthand for `node_modules/.bin/karma start`. If you have
`karma-cli` already installed globally, you can also just do `karma start`.
Karma will startup and run all tests on phantomjs

- CLI-based (w/o npm, you will need to ensure phantomjs is available yourself)
`phantomjs test/phantomRunner.js test/index.html`
- Any Browser you like with Karma
1. Set `singleRun:false` in `./karma.conf.js`
2. Start the Karma with `npm run-script karma` or `npm test` or ... (see above)
3. navigate any browser you'd like to test to http://localhost:9876
2. observe the output on the test console

### Roadmap

Expand All @@ -51,10 +57,22 @@ For current and future state of affairs, have a peek at the [Roadmap](ROADMAP.md

Currently you only need to download and include [measurement.js](https://raw.githubusercontent.com/Philzen/measurement.js/0-1-stable/measurement.js) in your project.

latest release - install via NPM:

In case the node package manager is part of your development stack, this may be more comfortable for you:

[![NPM](https://nodei.co/npm/measurementjs.png?downloads=true&stars=true)](https://www.npmjs.org/package/measurementjs)


### Currently tested platforms

Please feel free to add your own test results.

PhantomJS 1.9.7 (Linux): Executed 46 of 46 SUCCESS (0.027 secs / 0.022 secs)
Chrome 18.0.1025 (Linux): Executed 46 of 46 SUCCESS (0.06 secs / 0.035 secs)
Firefox 28.0.0 (Ubuntu): Executed 46 of 46 SUCCESS (0.037 secs / 0.026 secs)


### Inspiring projects

- http://www.codeproject.com/Articles/23087/Measurement-Unit-Conversion-Library (a C# / XML based approach)
Expand Down
97 changes: 97 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Karma configuration
// Generated on Tue Apr 01 2014 17:31:44 GMT+0200 (CEST)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine', 'requirejs'],


// list of files / patterns to load in the browser
files: [
'test-main.js',
{pattern: '*.js', included: false},
{pattern: 'test/**/*Spec.js', included: false}
],


// list of files to exclude
exclude: [
'.git', 'node_modules'
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul via Ibrik)
'measurement.js': ['jshint','coverage']
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['coverage', 'progress'],

// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// options for karma-jshint
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
devel: true,
eqnull: true,
browser: true,
globals: {
cordova: true,
jQuery: true
}
},
summary: true
},

coverageReporter: {
dir : './coverage/',
reporters:[
{type: 'lcov'},
{type: 'text', file: 'coverage.txt'},
{type: 'text-summary', file: 'coverage-summary.txt'}
]
}
});
};
Loading

0 comments on commit 94f0678

Please sign in to comment.