Skip to content

Commit 23bfbab

Browse files
committed
Updates for RC
1 parent b5eadd2 commit 23bfbab

File tree

8 files changed

+92
-47
lines changed

8 files changed

+92
-47
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/.*
22
!/.gitignore
3+
!/.jscsrc
4+
!/.jshintrc
35
!/.travis.yml
46
/bower_components/
57
/node_modules/
68
/output/
7-
/tmp/

.jscsrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"preset": "grunt",
3+
"disallowSpacesInAnonymousFunctionExpression": null,
4+
"requireSpacesInAnonymousFunctionExpression": {
5+
"beforeOpeningRoundBrace": true,
6+
"beforeOpeningCurlyBrace": true
7+
},
8+
"disallowSpacesInsideObjectBrackets": null,
9+
"requireSpacesInsideObjectBrackets": "all",
10+
"validateQuoteMarks": "\"",
11+
"requireCurlyBraces": null
12+
}

.jshintrc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"bitwise": true,
3+
"eqeqeq": true,
4+
"forin": true,
5+
"freeze": true,
6+
"funcscope": true,
7+
"futurehostile": true,
8+
"globalstrict": true,
9+
"latedef": true,
10+
"maxparams": 1,
11+
"noarg": true,
12+
"nocomma": true,
13+
"nonew": true,
14+
"notypeof": true,
15+
"singleGroups": true,
16+
"undef": true,
17+
"unused": true,
18+
"eqnull": true
19+
}

bower.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,21 @@
66
"purescript"
77
],
88
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "git://github.com/purescript/purescript-exceptions.git"
12+
},
913
"ignore": [
1014
"**/.*",
1115
"bower_components",
1216
"node_modules",
1317
"output",
18+
"test",
1419
"bower.json",
15-
"Gruntfile.js",
20+
"gulpfile.js",
1621
"package.json"
1722
],
1823
"dependencies": {
19-
"purescript-eff": "~0.1.0"
24+
"purescript-eff": "^0.1.0"
2025
}
2126
}

docs/Control.Monad.Eff.Exception.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# Module Documentation
2-
31
## Module Control.Monad.Eff.Exception
42

5-
63
This module defines an effect, actions and handlers for working
74
with Javascript exceptions.
85

@@ -22,13 +19,11 @@ data Error :: *
2219

2320
The type of Javascript errors
2421

25-
#### `showError`
26-
22+
##### Instances
2723
``` purescript
2824
instance showError :: Show Error
2925
```
3026

31-
3227
#### `error`
3328

3429
``` purescript
@@ -80,4 +75,3 @@ main = catchException print do
8075
```
8176

8277

83-

gulpfile.js

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,60 @@
1+
/* jshint node: true */
12
"use strict";
23

34
var gulp = require("gulp");
5+
var jshint = require("gulp-jshint");
6+
var jscs = require("gulp-jscs");
47
var plumber = require("gulp-plumber");
58
var purescript = require("gulp-purescript");
6-
var jsvalidate = require("gulp-jsvalidate");
9+
var rimraf = require("rimraf");
710

8-
var paths = [
11+
var sources = [
912
"src/**/*.purs",
1013
"bower_components/purescript-*/src/**/*.purs"
1114
];
1215

13-
gulp.task("make", function() {
14-
return gulp.src(paths)
15-
.pipe(plumber())
16-
.pipe(purescript.pscMake());
16+
var foreigns = [
17+
"src/**/*.js",
18+
"bower_components/purescript-*/src/**/*.js"
19+
];
20+
21+
gulp.task("clean-docs", function (cb) {
22+
rimraf("docs", cb);
1723
});
1824

19-
gulp.task("jsvalidate", ["make"], function () {
20-
return gulp.src("output/**/*.js")
21-
.pipe(plumber())
22-
.pipe(jsvalidate());
25+
gulp.task("clean-output", function (cb) {
26+
rimraf("output", cb);
2327
});
2428

25-
var docTasks = [];
29+
gulp.task("clean", ["clean-docs", "clean-output"]);
2630

27-
var docTask = function(name) {
28-
var taskName = "docs-" + name.toLowerCase();
29-
gulp.task(taskName, function () {
30-
return gulp.src("src/" + name.replace(/\./g, "/") + ".purs")
31-
.pipe(plumber())
32-
.pipe(purescript.pscDocs())
33-
.pipe(gulp.dest("docs/" + name + ".md"));
34-
});
35-
docTasks.push(taskName);
36-
};
31+
gulp.task("lint", function() {
32+
return gulp.src("src/**/*.js")
33+
.pipe(jshint())
34+
.pipe(jshint.reporter())
35+
.pipe(jscs());
36+
});
3737

38-
["Control.Monad.Eff.Exception"].forEach(docTask);
38+
gulp.task("make", ["lint"], function() {
39+
return gulp.src(sources)
40+
.pipe(plumber())
41+
.pipe(purescript.pscMake({ ffi: foreigns }));
42+
});
3943

40-
gulp.task("docs", docTasks);
44+
gulp.task("docs", ["clean-docs"], function () {
45+
return gulp.src(sources)
46+
.pipe(plumber())
47+
.pipe(purescript.pscDocs({
48+
docgen: {
49+
"Control.Monad.Eff.Exception": "docs/Control.Monad.Eff.Exception.md"
50+
}
51+
}));
52+
});
4153

4254
gulp.task("dotpsci", function () {
43-
return gulp.src(paths)
55+
return gulp.src(sources)
4456
.pipe(plumber())
4557
.pipe(purescript.dotPsci());
4658
});
4759

48-
gulp.task("default", ["jsvalidate", "docs", "dotpsci"]);
60+
gulp.task("default", ["make", "docs", "dotpsci"]);

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"private": true,
33
"devDependencies": {
44
"gulp": "^3.8.11",
5-
"gulp-jsvalidate": "^1.0.1",
5+
"gulp-jscs": "^1.6.0",
6+
"gulp-jshint": "^1.10.0",
67
"gulp-plumber": "^1.0.0",
7-
"gulp-purescript": "^0.3.1"
8+
"gulp-purescript": "^0.5.0-rc.1",
9+
"rimraf": "^2.3.3"
810
}
911
}

src/Control/Monad/Eff/Exception.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@
33

44
// module Control.Monad.Eff.Exception
55

6-
exports.showErrorImpl = function(err) {
6+
exports.showErrorImpl = function (err) {
77
return err.stack || err.toString();
88
};
99

10-
exports.error = function(msg) {
10+
exports.error = function (msg) {
1111
return new Error(msg);
1212
};
1313

14-
exports.message = function(e) {
14+
exports.message = function (e) {
1515
return e.message;
1616
};
1717

18-
exports.throwException = function(e) {
19-
return function() {
18+
exports.throwException = function (e) {
19+
return function () {
2020
throw e;
2121
};
2222
};
2323

24-
exports.catchException = function(c) {
25-
return function(t) {
26-
return function() {
24+
exports.catchException = function (c) {
25+
return function (t) {
26+
return function () {
2727
try {
2828
return t();
29-
} catch(e) {
30-
if (e instanceof Error || Object.prototype.toString.call(e) === '[object Error]') {
29+
} catch (e) {
30+
if (e instanceof Error || Object.prototype.toString.call(e) === "[object Error]") {
3131
return c(e)();
3232
} else {
3333
return c(new Error(e.toString()))();

0 commit comments

Comments
 (0)