Skip to content

Commit 2bc66e3

Browse files
author
Felix Hammerl
committed
add grunt, phantomjs, unify code style
1 parent 857f6b1 commit 2bc66e3

17 files changed

+365
-2655
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
deps
1+
node_modules/
2+
npm-debug.log
3+
.DS_Store

.jshintrc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"indent": 4,
3+
"strict": true,
4+
"globalstrict": true,
5+
"node": true,
6+
"browser": true,
7+
"nonew": true,
8+
"curly": true,
9+
"eqeqeq": true,
10+
"indent": false,
11+
"immed": true,
12+
"newcap": true,
13+
"regexp": true,
14+
"evil": true,
15+
"eqnull": true,
16+
"expr": true,
17+
"trailing": true,
18+
"undef": true,
19+
"unused": true,
20+
21+
"globals": {
22+
"TextEncoder": true,
23+
"TextDecoder": true,
24+
"mimefuncs": true,
25+
"console": true,
26+
"define": true,
27+
"describe": true,
28+
"it": true,
29+
"beforeEach": true,
30+
"afterEach": true,
31+
"window": true,
32+
"mocha": true,
33+
"mochaPhantomJS": true,
34+
"importScripts": true,
35+
"postMessage": true,
36+
"before": true,
37+
"self": true
38+
}
39+
}

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: node_js
2+
node_js:
3+
- "0.11"
4+
before_install:
5+
- npm install -g grunt-cli
6+
notifications:
7+
email:
8+

Gruntfile.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
module.exports = function(grunt) {
2+
'use strict';
3+
4+
// Project configuration.
5+
grunt.initConfig({
6+
jshint: {
7+
all: ['*.js', 'src/*.js', 'test/*.js'],
8+
options: {
9+
jshintrc: '.jshintrc'
10+
}
11+
},
12+
13+
connect: {
14+
dev: {
15+
options: {
16+
port: 12345,
17+
base: '.',
18+
keepalive: true
19+
}
20+
}
21+
},
22+
23+
mocha_phantomjs: {
24+
all: {
25+
options: {
26+
reporter: 'spec'
27+
},
28+
src: ['test/index.html']
29+
}
30+
}
31+
});
32+
33+
// Load the plugin(s)
34+
grunt.loadNpmTasks('grunt-contrib-jshint');
35+
grunt.loadNpmTasks('grunt-mocha-phantomjs');
36+
grunt.loadNpmTasks('grunt-contrib-connect');
37+
grunt.loadNpmTasks('grunt-mocha-test');
38+
39+
// Tasks
40+
grunt.registerTask('dev', ['connect:dev']);
41+
grunt.registerTask('default', ['jshint', 'mocha_phantomjs']);
42+
};

LICENSE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Copyright (c) 2013 Andris Reinman
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
11+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16+
SOFTWARE.

README.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
11
# mimeparser
22

3-
Another prototype for parsing mime streams, see [example application here](https://github.com/Kreata/mimeparser-example).
3+
Lib for parsing mime streams.
44

55
## Scope
66

77
This is supposed to be a "low level" mime parsing module. No magic is performed on the data (eg. no joining HTML parts etc.). All body data is emitted out as ArrayBuffer values, so no need to perform any base64 or quoted printable decoding by yourself.
88

9-
## Usage
9+
[![Build Status](https://travis-ci.org/whiteout-io/mimeparser.png?branch=master)](https://travis-ci.org/whiteout-io/mimeparser)
1010

11-
### Volo
11+
## Installation
1212

13-
Install with [volo](http://volojs.org/):
13+
### [volo](http://volojs.org/):
1414

15-
volo add Kreata/mimeparser/master
15+
volo add whiteout-io/mimeparser/0.1.0
1616

17-
### AMD
17+
### [Bower](http://bower.io/):
1818

19-
Require [mimeparser.js](mimeparser.js) as `mimeparser`
19+
bower install [email protected]:whiteout-io/mimeparser.git#0.1.0
2020

21-
### Create a parser
21+
### [npm](https://www.npmjs.org/):
2222

23-
Create a parser by invoking `mimeparser()`
23+
npm install https://github.com/whiteout-io/mimeparser/tarball/0.1.0
2424

25-
```javascript
26-
var parser = mimeparser();
27-
```
25+
## Dependencies
2826

29-
## Methods
27+
This module depends on [mimefuncs](https://github.com/whiteout-io/mimefuncs). The dependency will not be fetched automatically, so make sure it is there.
28+
29+
## Usage
30+
31+
### AMD
32+
33+
var MimeParser = require('mimeparser');
34+
35+
### non-AMD
36+
37+
<script src="mimeparser"></script>
38+
// exposes MimeParser the constructor to the global object
3039

3140
### Feed data to the parser
3241

@@ -83,18 +92,29 @@ This seems like asynchronous but actually it is not. So always define `onheader`
8392

8493
**message/rfc822** is automatically parsed if the mime part does not have a `Content-Disposition: attachment` header, otherwise it will be emitted as a regular attachment (as one long ArrayBuffer value).
8594

86-
## Tests
87-
88-
Download `mimeparser` source and install dependencies
95+
## Hands on
8996

9097
```bash
91-
git clone [email protected]:Kreata/mimeparser.git
92-
cd mailcomposer
93-
volo install
98+
git clone [email protected]:whiteout-io/mimeparser.git
99+
cd mimeparser
100+
npm install && npm test
94101
```
95102

96-
Tests are handled by QUnit. Open [testrunner.html](tests/testrunner.html) to run the tests. There's only a few test currently, just to check for syntax errors but not so much individual features.
97-
98103
## License
99104

100-
**MIT**
105+
Copyright (c) 2013 Andris Reinman
106+
107+
Permission is hereby granted, free of charge, to any person obtaining a copy
108+
of this software and associated documentation files (the "Software"), to deal
109+
in the Software without restriction, including without limitation the rights
110+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111+
copies of the Software, and to permit persons to whom the Software is
112+
furnished to do so, subject to the following conditions:
113+
114+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
115+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
116+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
117+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
118+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
119+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120+
SOFTWARE.

bower.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "mimeparser",
3+
"main": "src/mimeparser.js",
4+
"version": "0.1.0",
5+
"homepage": "https://github.com/whiteout-io/mimeparser",
6+
"authors": ["Andris Reinman <[email protected]>"],
7+
"description": "Parse a mime tree, no magic included.",
8+
"keywords": ["mime"],
9+
"license": "MIT",
10+
"ignore": [
11+
"node_modules",
12+
"bower_components",
13+
"test",
14+
".gitignore",
15+
".jshintrc",
16+
".travis.yml",
17+
"Gruntfile.js",
18+
"LICENSE",
19+
"package.json",
20+
"README.md"
21+
]
22+
}

package.json

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
{
2-
"main": "mimeparser",
3-
"volo": {
4-
"baseDir": "deps",
5-
"dependencies": {
6-
"mimefuncs": "github:Kreata/mimefuncs/v0.1.3"
7-
}
8-
}
2+
"name": "mimeparser",
3+
"version": "0.1.0",
4+
"homepage": "https://github.com/whiteout-io/mimeparser",
5+
"description": "Parse a mime tree, no magic included.",
6+
"author": "Andris Reinman <[email protected]>",
7+
"keywords": ["mime"],
8+
"license": "MIT",
9+
"scripts": {
10+
"test": "grunt"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git://github.com/whiteout-io/mimeparser.git"
15+
},
16+
"main": "src/mimeparser",
17+
"dependencies": {},
18+
"devDependencies": {
19+
"chai": "~1.8.1",
20+
"grunt": "~0.4.1",
21+
"grunt-mocha-phantomjs": "~0.4.0",
22+
"grunt-contrib-connect": "~0.6.0",
23+
"grunt-contrib-jshint": "~0.8.0",
24+
"mocha": "~1.16.2",
25+
"phantomjs": "~1.9.7-1",
26+
"requirejs": "~2.1.10",
27+
"stringencoding": "https://github.com/whiteout-io/stringencoding/tarball/0.1.0",
28+
"arraybuffer-slice": "0.0.2",
29+
"mimefuncs": "https://github.com/whiteout-io/mimefuncs/tarball/0.1.5"
30+
},
31+
"volo": {}
932
}

0 commit comments

Comments
 (0)