Skip to content

Commit

Permalink
add grunt, phantomjs, jshint, npm, bower
Browse files Browse the repository at this point in the history
adapt to whiteout code style
  • Loading branch information
Felix Hammerl committed Mar 19, 2014
1 parent 3133a82 commit 2a5b6b5
Show file tree
Hide file tree
Showing 27 changed files with 979 additions and 8,152 deletions.
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
node_modules
.DS_Store
deps

mimetypes
mimefuncs.js
punycode.js
addressparser.js
node_modules/
npm-debug.log
.DS_Store
51 changes: 40 additions & 11 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
{
"browser": true,
"strict": true,
"unused": true,
"undef": true,
"newcap": true,
"camelcase": true,
"curly": true,
"forin": true,
"indent": 4
}
{
"indent": 4,
"strict": true,
"globalstrict": true,
"node": true,
"browser": true,
"nonew": true,
"curly": true,
"eqeqeq": true,
"indent": false,
"immed": true,
"newcap": true,
"regexp": true,
"evil": true,
"eqnull": true,
"expr": true,
"trailing": true,
"undef": true,
"unused": true,

"globals": {
"define": true,
"mimefuncs" : true,
"mimetypes" : true,
"punycode" : true,
"addressparser" : true,
"console": true,
"describe": true,
"it": true,
"beforeEach": true,
"afterEach": true,
"window": true,
"mocha": true,
"mochaPhantomJS": true,
"importScripts": true,
"postMessage": true,
"before": true,
"self": true
}
}
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.11"
before_install:
- npm install -g grunt-cli
notifications:
email:
- [email protected]
42 changes: 42 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = function(grunt) {
'use strict';

// Project configuration.
grunt.initConfig({
jshint: {
all: ['*.js', 'src/*.js', 'test/*.js'],
options: {
jshintrc: '.jshintrc'
}
},

connect: {
dev: {
options: {
port: 12345,
base: '.',
keepalive: true
}
}
},

mocha_phantomjs: {
all: {
options: {
reporter: 'spec'
},
src: ['test/index.html']
}
}
});

// Load the plugin(s)
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-mocha-test');

// Tasks
grunt.registerTask('dev', ['connect:dev']);
grunt.registerTask('default', ['jshint', 'mocha_phantomjs']);
};
16 changes: 16 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright (c) 2013 Andris Reinman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 55 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,39 @@

*mailbuild* is a low level rfc2822 message composer. Define your own mime tree, no magic included.

## Usage
## StringEncoding API

### Volo
This module requires `TextEncoder` and `TextDecoder` to exist as part of the StringEncoding API (see: [MDN](https://developer.mozilla.org/en-US/docs/WebAPI/Encoding_API) [whatwg.org](http://encoding.spec.whatwg.org/#api)). Firefox 19+ is basically the only browser that supports this at the time of writing, while [Chromium in canary, not stable](https://code.google.com/p/chromium/issues/detail?id=243354). Luckily, [there is a polyfill](https://github.com/whiteout-io/stringencoding)!

Also, if you use phantomjs, you might need [this polyfill for ArrayBuffer #slice](https://github.com/ttaubert/node-arraybuffer-slice)

## Installation

### [volo](http://volojs.org/):

Install with [volo](http://volojs.org/):

```shell
volo add Kreata/mailbuild/master
```
volo add whiteout-io/mailbuild/0.1.0

### [Bower](http://bower.io/):

bower install [email protected]:whiteout-io/mailbuild.git#0.1.0

### [npm](https://www.npmjs.org/):

npm install https://github.com/whiteout-io/mailbuild/tarball/0.1.0

**NB!** Requires [encoding.js](http://code.google.com/p/stringencoding/source/browse/encoding.js) and [encoding-indexes.js](http://code.google.com/p/stringencoding/source/browse/encoding-indexes.js) from [stringencoding](http://code.google.com/p/stringencoding/) project to be present on the page. This is a polyfill for TextEncoder/TextDecoder, not needed in latest Firefox and hopefully soon in Chrome either.
### Dependencies

This module has dependencies that will not automatically be fetched.

* [mimefuncs](https://github.com/whiteout-io/mimefuncs/)
* [mimetypes](https://github.com/whiteout-io/mimetypes/)
* [addressparser](https://github.com/whiteout-io/addressparser/)
* [punycode.js](https://github.com/bestiejs/punycode.js)

* [stringencoding](https://github.com/whiteout-io/stringencoding) // every browser except ff
* [arraybuffer-slice](https://github.com/ttaubert/node-arraybuffer-slice) // phantomjs

## API

Expand Down Expand Up @@ -393,14 +415,32 @@ multipart/mixed
↳ application/x-zip
```

## Tests

Download `mailbuild` source and install dependencies
## Get your hands dirty

```bash
git clone [email protected]:Kreata/mailbuild.git
cd mailbuild
volo install
```

Tests are handled by QUnit. Open [testrunner.html](tests/testrunner.html) to run the tests.
git clone [email protected]:whiteout-io/mailbuild.git
cd mailbuild
npm install && npm test
grunt dev
go to http://localhost:12345/example/ to run the example
go to http://localhost:12345/test/ to run the tests in your browser of choice
```

## License

Copyright (c) 2013 Andris Reinman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
28 changes: 28 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "mailbuild",
"main": "src/mailbuild.js",
"version": "0.1.2",
"homepage": "https://github.com/whiteout-io/mailbuild",
"authors": [
"Andris Reinman <[email protected]>"
],
"description": "Parse rfc2822 address fields",
"keywords": [
"RFC2822",
"mime",
],
"license": "MIT",
"ignore": [
"node_modules",
"bower_components",
"example",
"test",
".gitignore",
".jshintrc",
".travis.yml",
"Gruntfile.js",
"LICENSE",
"package.json",
"README.md"
]
}
57 changes: 0 additions & 57 deletions example/app.js

This file was deleted.

35 changes: 0 additions & 35 deletions example/encoding-indexes.js

This file was deleted.

Loading

0 comments on commit 2a5b6b5

Please sign in to comment.