Skip to content

Commit

Permalink
Updates for 0.11 (#10)
Browse files Browse the repository at this point in the history
* Updates for 0.11

* eslint

* Remove test script, eslint --fix

* Add .eslintrc
  • Loading branch information
paf31 authored Apr 5, 2017
1 parent 49829c6 commit 5c09f73
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 131 deletions.
39 changes: 39 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"env": {
"node": true,
},
"rules": {
"valid-jsdoc": [2, {
"prefer": { "return": "returns" },
"requireReturn": true,
"requireParamDescription": true,
"requireReturnDescription": false
}],
"camelcase": 1,
"no-multi-spaces": 0,
"comma-spacing": 1,
"comma-style": [2, "first"],
"consistent-return": 0,
"eol-last": 1,
"indent": [1, 4],
"no-use-before-define": [2, "nofunc"],
"no-process-exit": 0,
"no-trailing-spaces": 1,
"no-underscore-dangle": 0,
"no-unused-vars": 1,
"space-infix-ops": 1,
"quotes": [1, "single"],
"semi": [1, "always"],
"semi-spacing": 1,
"strict": [2, "global"],
"yoda": [1, "never"]
},
"globals": {
"describe": true,
"it": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true
}
}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/.*
!/.gitignore
!/.jscsrc
!/.jshintrc
!/.eslintrc
!/.travis.yml
/bower_components/
/node_modules/
Expand Down
17 changes: 0 additions & 17 deletions .jscsrc

This file was deleted.

19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ install:
script:
- bower install --production
- npm run -s build
- bower install
- npm test
after_success:
- >-
test $TRAVIS_TAG &&
Expand Down
20 changes: 10 additions & 10 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"package.json"
],
"dependencies": {
"purescript-exceptions": "^2.0.0",
"purescript-foreign": "^3.0.0",
"purescript-functions": "^2.0.0",
"purescript-maps": "^2.0.0",
"purescript-node-fs": "^3.0.0",
"purescript-node-streams": "^2.0.0",
"purescript-nullable": "^2.0.0",
"purescript-posix-types": "^2.0.0",
"purescript-unsafe-coerce": "^2.0.0"
"purescript-exceptions": "^3.0.0",
"purescript-foreign": "^4.0.0",
"purescript-functions": "^3.0.0",
"purescript-maps": "^3.0.0",
"purescript-node-fs": "^4.0.0",
"purescript-node-streams": "^3.0.0",
"purescript-nullable": "^3.0.0",
"purescript-posix-types": "^3.0.0",
"purescript-unsafe-coerce": "^3.0.0"
},
"devDependencies": {
"purescript-console": "^2.0.0"
"purescript-console": "^3.0.0"
}
}
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
"test": "pulp test"
"build": "eslint src && pulp build -- --censor-lib --strict"
},
"devDependencies": {
"jscs": "^3.0.7",
"jshint": "^2.9.4",
"pulp": "^9.0.1",
"purescript-psa": "^0.3.9",
"purescript": "^0.10.1",
"eslint": "^3.17.1",
"pulp": "^11.0.0",
"purescript-psa": "^0.5.0",
"purescript": "^0.11.1",
"rimraf": "^2.5.4"
}
}
134 changes: 67 additions & 67 deletions src/Node/ChildProcess.js
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
"use strict";
'use strict';

/* eslint-env node*/

exports.unsafeFromNullable = function unsafeFromNullable (msg) {
return function (x) {
if (x === null) throw new Error(msg);
return x;
};
return function (x) {
if (x === null) throw new Error(msg);
return x;
};
};

exports.spawnImpl = function spawnImpl (command) {
return function (args) {
return function (opts) {
return function () {
return require("child_process").spawn(command, args, opts);
};
return function (args) {
return function (opts) {
return function () {
return require('child_process').spawn(command, args, opts);
};
};
};
};
};

exports.execImpl = function execImpl (command) {
return function (opts) {
return function (callback) {
return function () {
return require("child_process").exec(command, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
};
return function (opts) {
return function (callback) {
return function () {
return require('child_process').exec(command, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
};
};
};
};
};

exports.execFileImpl = function execImpl (command) {
return function (args) {
return function (opts) {
return function (callback) {
return function () {
return require("child_process").execFile(command, args, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
return function (args) {
return function (opts) {
return function (callback) {
return function () {
return require('child_process').execFile(command, args, opts, function (err, stdout, stderr) {
callback(err)(stdout)(stderr)();
});
};
};
};
};
};
};
};

exports.fork = function fork (cmd) {
return function (args) {
return function () {
return require("child_process").fork(cmd, args);
return function (args) {
return function () {
return require('child_process').fork(cmd, args);
};
};
};
};

exports.mkOnExit = function mkOnExit (mkChildExit) {
return function onExit (cp) {
return function (cb) {
return function () {
cp.on("exit", function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
return function onExit (cp) {
return function (cb) {
return function () {
cp.on('exit', function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
};
};
};

exports.mkOnClose = function mkOnClose (mkChildExit) {
return function onClose (cp) {
return function (cb) {
return function () {
cp.on("exit", function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
return function onClose (cp) {
return function (cb) {
return function () {
cp.on('exit', function (code, signal) {
cb(mkChildExit(code)(signal))();
});
};
};
};
};
};

exports.onDisconnect = function onDisconnect (cp) {
return function (cb) {
return function () {
cp.on("disconnect", cb);
return function (cb) {
return function () {
cp.on('disconnect', cb);
};
};
};
};

exports.mkOnMessage = function mkOnMessage (nothing) {
return function (just) {
return function onMessage (cp) {
return function (cb) {
return function () {
cp.on("message", function (mess, sendHandle) {
cb(mess, sendHandle ? just(sendHandle) : nothing)();
});
return function (just) {
return function onMessage (cp) {
return function (cb) {
return function () {
cp.on('message', function (mess, sendHandle) {
cb(mess, sendHandle ? just(sendHandle) : nothing)();
});
};
};
};
};
};
};
};

exports.onError = function onError (cp) {
return function (cb) {
return function () {
cp.on("error", function (err) {
cb(err)();
});
return function (cb) {
return function () {
cp.on('error', function (err) {
cb(err)();
});
};
};
};
};

exports.undefined = undefined;
Expand Down
10 changes: 5 additions & 5 deletions src/Node/ChildProcess.purs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module Node.ChildProcess
import Prelude

import Control.Alt ((<|>))
import Control.Monad.Eff (Eff)
import Control.Monad.Eff (kind Effect, Eff)
import Control.Monad.Eff.Exception as Exception
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)

Expand All @@ -68,10 +68,10 @@ import Node.Stream (Readable, Writable, Stream)
import Unsafe.Coerce (unsafeCoerce)

-- | A handle for inter-process communication (IPC).
foreign import data Handle :: *
foreign import data Handle :: Type

-- | The effect for creating and interacting with child processes.
foreign import data CHILD_PROCESS :: !
foreign import data CHILD_PROCESS :: Effect

newtype ChildProcess = ChildProcess ChildProcessRec

Expand Down Expand Up @@ -283,7 +283,7 @@ foreign import execFileImpl
-> (Nullable Exception.Error -> Buffer -> Buffer -> Eff (cp :: CHILD_PROCESS | eff) Unit)
-> Eff (cp :: CHILD_PROCESS | eff) Unit

foreign import data ActualExecOptions :: *
foreign import data ActualExecOptions :: Type

convertExecOptions :: ExecOptions -> ActualExecOptions
convertExecOptions opts = unsafeCoerce
Expand Down Expand Up @@ -376,7 +376,7 @@ foreign import process :: forall props. { | props }
ignore :: Array (Maybe StdIOBehaviour)
ignore = map Just [Ignore, Ignore, Ignore]

foreign import data ActualStdIOBehaviour :: *
foreign import data ActualStdIOBehaviour :: Type

toActualStdIOBehaviour :: StdIOBehaviour -> ActualStdIOBehaviour
toActualStdIOBehaviour b = case b of
Expand Down
4 changes: 2 additions & 2 deletions test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Node.ChildProcess (CHILD_PROCESS, Exit(..), defaultExecOptions, exec, onE
import Node.Encoding (Encoding(UTF8))
import Node.Stream (onData)

type TestEff = Eff (cp :: CHILD_PROCESS, console :: CONSOLE, err :: EXCEPTION, buffer :: Buffer.BUFFER) Unit
type TestEff = Eff (cp :: CHILD_PROCESS, console :: CONSOLE, exception :: EXCEPTION, buffer :: Buffer.BUFFER) Unit

main :: TestEff
main = do
Expand All @@ -36,7 +36,7 @@ main = do

log "kills processes"
spawn "ls" ["-la"] defaultSpawnOptions >>= \ls -> do
kill SIGTERM ls
_ <- kill SIGTERM ls
onExit ls \exit ->
case exit of
BySignal SIGTERM ->
Expand Down

0 comments on commit 5c09f73

Please sign in to comment.