Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

0.7 stream updates #44

Merged
merged 3 commits into from
Jul 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions MODULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,47 @@ multipipe2 :: forall a b c. Stream a b -> Stream b c -> Stream a c



## Module GulpPurescript.OS

#### `OS`

``` purescript
data OS :: !
```


#### `Platform`

``` purescript
data Platform
= Darwin
| Linux
| Win32
```


#### `showPlatform`

``` purescript
instance showPlatform :: Show Platform
```


#### `isForeignPlatform`

``` purescript
instance isForeignPlatform :: IsForeign Platform
```


#### `platform`

``` purescript
platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
```



## Module GulpPurescript.Options

#### `isForeignEither`
Expand Down Expand Up @@ -269,47 +310,6 @@ pscDocsOptions :: Foreign -> Either ForeignError [String]



## Module GulpPurescript.OS

#### `OS`

``` purescript
data OS :: !
```


#### `Platform`

``` purescript
data Platform
= Darwin
| Linux
| Win32
```


#### `showPlatform`

``` purescript
instance showPlatform :: Show Platform
```


#### `isForeignPlatform`

``` purescript
instance isForeignPlatform :: IsForeign Platform
```


#### `platform`

``` purescript
platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
```



## Module GulpPurescript.Package

#### `Pkg`
Expand Down Expand Up @@ -389,10 +389,10 @@ pscDocs :: forall eff. Foreign -> (Error -> Eff (Effects eff) Unit) -> (File ->
```


#### `dotPsci`
#### `psci`

``` purescript
dotPsci :: forall eff. Eff (Effects eff) (Stream File Unit)
psci :: forall eff. Eff (Effects eff) (Stream File Unit)
```


Expand Down
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ var gulp = require('gulp');

var purescript = require('gulp-purescript');

gulp.task('purescript', function(){
return gulp.src('src/**/*.purs').
pipe(purescript.psc({noPrelude: true})).
pipe(gulp.dest('build'));
gulp.task('psc', function(){
return purescript.psc({
src: 'src/*.purs'
});
});
```

Expand All @@ -38,11 +38,11 @@ Invokes the `psc` command. The following options are supported.

###### `src` (String or String Array)

The location of the source files to compile. Glob syntax is supported.
Files to compile. Glob syntax is supported.

###### `ffi` (String or String Array)

Sets one or more `--ffi=<string>` that specifies files for code that is included with a `foreign import` in the PureScript source.
Files for code that is included with a `foreign import` in the PureScript source. Glob syntax is supported.

###### `noTco` (Boolean)

Expand Down Expand Up @@ -78,7 +78,7 @@ Invokes the `psc-bundle` command. The following options are supported.

###### `src` (String or String Array)

The location of the `psc`-produced javascript source files to bundle. Glob syntax is supported.
The `psc`-produced JavaScript source files to bundle. Glob syntax is supported.

###### `output` (String)

Expand All @@ -98,7 +98,11 @@ Sets `--browser-namespace=<string>` that specifies the namespace that PureScript

### `purescript.pscDocs(options)`

Invokes the `pscDocs` command. The following options are supported.
Invokes the `psc-docs` command. The following options are supported.

###### `src` (String or String Array)

Files to be used for generating the documentation. Glob syntax is supported.

###### `format` (markdown | etags | ctags)

Expand All @@ -110,11 +114,19 @@ Sets `--docgen=...` that can be used to filter the modules documentation is gene

- If a string value is provided, the documentation for that single module will be generated.
- If a list of strings is provided, the documentation for all listed modules will be generated.
- If an object with module name/filename pairs (for example, `{ Module: "docs/Module.md" }`) is provided, files will be written for each of the modules. In this mode, the task requires no `dest` as no value is returned.
- If an object with module name/filename pairs (for example, `{ Module: 'docs/Module.md' }`) is provided, files will be written for each of the modules. In this mode, the task requires no `dest` as no value is returned.

### `purescript.psci(options)`

Generates a `.psci` file.

### `purescript.dotPsci()`
###### `src` (String or String Array)

Files added to the `.psci` file with the `:m` command. Glob syntax is supported.

###### `ffi` (String or String Array)

Generates a `.psci` file in the current directory. Each source file is added with the `:m` command.
Files added to the `.psci` file with the `:f` command. Glob syntax is supported.

## Command line arguments

Expand Down
30 changes: 6 additions & 24 deletions entry.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
'use strict';

var gulpPurescript = require('GulpPurescript.Plugin');
var Promise = require('promise');

function promisify(aff) {
return new Promise(function (resolve, reject) {
var errback = function (err) {
return function () {
reject(err);
};
};
var callback = function (x) {
return function () {
resolve(x);
};
};
aff(errback)(callback)();
});
}

function psc(options) {
return promisify(gulpPurescript.psc(options));
return gulpPurescript.psc(options)();
}

function pscBundle(options) {
return promisify(gulpPurescript.pscBundle(options));
return gulpPurescript.pscBundle(options)();
}

function pscDocs(options) {
return promisify(gulpPurescript.pscDocs(options));
return gulpPurescript.pscDocs(options)();
}

function dotPsci() {
var result = gulpPurescript.dotPsci();
return result;
function psci(options) {
return gulpPurescript.psci(options)();
}

module.exports.psc = psc;
Expand All @@ -42,4 +24,4 @@ module.exports.pscBundle = pscBundle;

module.exports.pscDocs = pscDocs;

module.exports.dotPsci = dotPsci;
module.exports.psci = psci;
2 changes: 2 additions & 0 deletions foreign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
function test(){
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@
"purescript"
],
"dependencies": {
"async": "^1.3.0",
"cross-spawn": "^0.4.0",
"glob": "^5.0.5",
"gulp-util": "^3.0.4",
"logalot": "^2.1.0",
"minimist": "^1.1.1",
"multipipe": "^0.1.2",
"promise": "^7.0.3",
"resolve-bin": "^0.3.0",
"through2": "^0.6.3",
"which": "^1.0.9"
},
"devDependencies": {
Expand All @@ -49,6 +47,7 @@
"run-sequence": "^1.0.2",
"tap-spec": "^2.2.2",
"tape": "^3.5.0",
"through2": "^0.6.3",
"webpack": "^1.8.9"
}
}
20 changes: 0 additions & 20 deletions src/FS.purs

This file was deleted.

53 changes: 53 additions & 0 deletions src/Glob.purs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module GulpPurescript.Glob
( Glob()
, glob
, globAll
) where

import Control.Monad.Aff (Aff(), makeAff)
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (Error())

import Data.Function

foreign import data Glob :: !

glob :: forall eff. String -> Aff (glob :: Glob | eff) [String]
glob pattern = makeAff $ runFn3 globFn pattern

foreign import globFn """
function globFn(pattern, errback, callback) {
return function(){
var glob = require('glob');

glob(pattern, function(error, result){
if (error) errback(new Error(error))();
else callback(result)();
});
};
}
""" :: forall eff. Fn3 String
(Error -> Eff (glob :: Glob | eff) Unit)
([String] -> Eff (glob :: Glob | eff) Unit)
(Eff (glob :: Glob | eff) Unit)

globAll :: forall eff. [String] -> Aff (glob :: Glob | eff) [[String]]
globAll patterns = makeAff $ runFn3 globAllFn patterns

foreign import globAllFn """
function globAllFn(patterns, errback, callback) {
return function(){
var glob = require('glob');

var async = require('async');

async.map(patterns, glob, function(error, result){
if (error) errback(new Error(error))();
else callback(result)();
});
};
}
""" :: forall eff. Fn3 [String]
(Error -> Eff (glob :: Glob | eff) Unit)
([[String]] -> Eff (glob :: Glob | eff) Unit)
(Eff (glob :: Glob | eff) Unit)
21 changes: 0 additions & 21 deletions src/GulpUtil.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ module GulpPurescript.GulpUtil
( File()
, mkPluginError
, mkFile
, filePath
, fileIsNull
, fileIsStream
) where

import Control.Monad.Eff.Exception (Error())
Expand Down Expand Up @@ -34,21 +31,3 @@ function mkFileFn(path, contents) {
return new gutil.File({path: path, contents: contents});
}
""" :: Fn2 String Buffer File

foreign import filePath """
function filePath(file) {
return file.path;
}
""" :: File -> String

foreign import fileIsNull"""
function fileIsNull(file) {
return file.isNull();
}
""" :: File -> Boolean

foreign import fileIsStream """
function fileIsStream(file) {
return file.isStream();
}
""" :: File -> Boolean
17 changes: 0 additions & 17 deletions src/Multipipe.purs

This file was deleted.

Loading