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

Commit 967988e

Browse files
committed
Remove --verbose argument
Since the compiler output is less verbose, this argument is no longer necessary. Also, warnings were being hidden unless the argument was provided. Resolves #51
1 parent e0397d7 commit 967988e

File tree

9 files changed

+10
-65
lines changed

9 files changed

+10
-65
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ Files added to the `.psci` file with the `:m` command. Glob syntax is supported.
134134

135135
Files added to the `.psci` file with the `:f` command. Glob syntax is supported.
136136

137-
## Command line arguments
138-
139-
The `--verbose` argument will display the output during the `psc` command. For example `gulp --verbose`.
140-
141137
## Full example
142138

143139
This example will make and bundle the code, run tests, and produce a `.psci` file and documentation for a project using the common `bower_components`/`src` file layout.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"test:run": "node test.js | tap-spec",
1919
"test": "npm run-script build && npm run-script test:run",
2020
"build": "npm run-script build:compile && npm run-script build:docs && npm run-script build:package",
21-
"build:compile": "./node_modules/.bin/pulp build",
21+
"build:compile": "./node_modules/.bin/pulp build -o build",
2222
"build:docs": "./node_modules/.bin/pulp docs",
2323
"build:package": "./node_modules/.bin/webpack --progress --colors --profile --bail",
2424
"build:json": "./node_modules/.bin/webpack --progress --colors --profile --bail --json > index.json",
@@ -35,7 +35,6 @@
3535
"glob": "^5.0.5",
3636
"gulp-util": "^3.0.4",
3737
"logalot": "^2.1.0",
38-
"minimist": "^1.1.1",
3938
"resolve-bin": "^0.3.0",
4039
"which": "^1.0.9"
4140
},
@@ -45,7 +44,6 @@
4544
"gulp-plumber": "^1.0.0",
4645
"json-loader": "^0.5.1",
4746
"pulp": "^4.3.0",
48-
"rewire": "^2.3.1",
4947
"run-sequence": "^1.0.2",
5048
"tap-spec": "^2.2.2",
5149
"tape": "^3.5.0",

src/GulpPurescript/ChildProcess.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ function spawnFn(command, args, errback, callback) {
2121
});
2222

2323
process.on('close', function(code){
24-
if (code !== 0) errback(new Error(Buffer.concat([stdout, stderr]).toString()))();
25-
else callback(stdout.toString())();
24+
var result = Buffer.concat([stdout, stderr]).toString();
25+
26+
if (code !== 0) errback(new Error(result))();
27+
else callback(result)();
2628
});
2729
};
2830
}

src/GulpPurescript/Minimist.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/GulpPurescript/Minimist.purs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/GulpPurescript/Options.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ instance isForeignFormat :: IsForeign Format where
185185
"markdown" -> Right Markdown
186186
"etags" -> Right ETags
187187
"ctags" -> Right CTags
188-
a -> Left $ TypeMismatch "Format" a)
188+
b -> Left $ TypeMismatch "Format" b)
189189

190190
class CommandLineOption a where
191191
opt :: String -> NullOrUndefined a -> Array String

src/GulpPurescript/Plugin.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,4 @@
44

55
var cwd = process.cwd();
66

7-
var argv = process.argv.slice(2);
8-
97
exports.cwd = cwd;
10-
11-
exports.argv = argv;

src/GulpPurescript/Plugin.purs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Data.Foreign (Foreign())
2222
import Data.Foreign.Class (IsForeign, read, readProp)
2323
import Data.Foreign.NullOrUndefined (runNullOrUndefined)
2424
import Data.Maybe (Maybe(Just), maybe, fromMaybe)
25-
import Data.String (joinWith)
25+
import Data.String (joinWith, null)
2626
import Data.Tuple (Tuple(..))
2727
import Data.Tuple.Nested (tuple2)
2828

@@ -31,7 +31,6 @@ import GulpPurescript.ChildProcess (ChildProcess(), spawn)
3131
import GulpPurescript.Glob (Glob(), globAll)
3232
import GulpPurescript.GulpUtil (File(), mkFile, mkPluginError)
3333
import GulpPurescript.Logalot (Logalot(), info)
34-
import GulpPurescript.Minimist (minimist)
3534
import GulpPurescript.OS (OS(), Platform(Win32), platform)
3635
import GulpPurescript.Options (Psci(..), pscOptions, pscBundleOptions, pscDocsOptions)
3736
import GulpPurescript.Package (Pkg(), Package(..), package)
@@ -40,11 +39,6 @@ import GulpPurescript.ResolveBin (ResolveBin(), resolveBin)
4039
import GulpPurescript.Stream (Stream(), ReadableStream(), mkReadableStreamFromAff)
4140
import GulpPurescript.Which (Which(), which)
4241

43-
newtype Argv = Argv { verbose :: Boolean }
44-
45-
instance isForeignArgv :: IsForeign Argv where
46-
read obj = (\a -> Argv { verbose: a }) <$> readProp "verbose" obj
47-
4842
type Effects eff =
4943
( cp :: ChildProcess
5044
, glob :: Glob
@@ -77,12 +71,8 @@ pscBundleCommand = "psc-bundle"
7771

7872
pscDocsCommand = "psc-docs"
7973

80-
isVerbose = maybe false (\(Argv a) -> a.verbose) (minimist argv)
81-
8274
foreign import cwd :: String
8375

84-
foreign import argv :: Array String
85-
8676
throwPluginError :: forall eff. String -> Aff (Effects eff) _
8777
throwPluginError msg = liftEff (flip mkPluginError msg <$> (maybe "" (\(Package a) -> a.name))
8878
<$> package) >>= throwError
@@ -115,9 +105,9 @@ psc opts = mkReadableStreamFromAff $ do
115105
output <- either (throwPluginError <<< show)
116106
(execute pscCommand)
117107
(pscOptions opts)
118-
if isVerbose
119-
then liftEff $ info $ pscCommand ++ "\n" ++ output
120-
else pure unit
108+
if null output
109+
then pure unit
110+
else liftEff $ info $ pscCommand ++ "\n" ++ output
121111

122112
pscBundle :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream File)
123113
pscBundle opts = mkReadableStreamFromAff (either (throwPluginError <<< show) run (pscBundleOptions opts))

test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,11 @@ var gulp = require('gulp');
1010

1111
var through2 = require('through2');
1212

13-
var rewire = require('rewire');
14-
1513
var purescript = require('./');
1614

1715
test('psc - basic', function(t){
1816
t.plan(1);
1917

20-
var purescript = rewire('./');
21-
22-
var mock = {
23-
success: function(){
24-
t.fail('Should not get a log message');
25-
}
26-
};
27-
28-
purescript.__set__('logalot', mock);
29-
3018
var fixture = 'Fixture1.purs';
3119

3220
var stream = purescript.psc({src: fixture});

0 commit comments

Comments
 (0)