Skip to content

Instantly share code, notes, and snippets.

@xkikeg
Last active August 29, 2015 14:10
Show Gist options
  • Save xkikeg/ed827fc7a7c8a77ca55e to your computer and use it in GitHub Desktop.
Save xkikeg/ed827fc7a7c8a77ca55e to your computer and use it in GitHub Desktop.
PureScript開発に至る前の環境整備 ref: http://qiita.com/liquid_amber/items/c9a439813cb0ca8649bc
$ # Ubuntu
$ # nodebrewで入れた see http://qiita.com/sinmetal/items/154e81823f386279b33c
$ # Mac
$ brew install node
$ npm i -g bower
$ npm init
$ # いろいろ答える、適当でいいよ
$ bower init
$ # いろいろ答える、ちょっとは真面目に答えてね
$ npm i -g gulp
$ npm i --save-dev gulp gulp-purescript
user@~$ # 最新が0.6.2だった
user@~$ LATEST=0.6.2
user@~$ mkdir -p ~/cabal-sandbox/purescript/$LATEST
user@~$ cd ~/cabal-sandbox/purescript/$LATEST
user@~/cabal-sandbox/purescript/w.x.y.z$ cabal sandbox init --sandbox=`pwd`
user@~/cabal-sandbox/purescript/w.x.y.z$ cabal install -j purescript
user@~/cabal-sandbox/purescript/w.x.y.z$ cd ~/cabal-sandbox/purescript/
user@~/cabal-sandbox/purescript$ ln -s $LATEST current
user@~/cabal-sandbox/purescript$ ln -s current default
user@~$ # あとは$PATHの通ったところにコマンドをリンクしておく、例えば
user@~/local/bin% for i in ~/cabal-sandbox/purescript/default/bin/*; do ln -s $i; done
user@/path/to/project% gulp
[22:40:55] No gulpfile found
user@/path/to/project% emacs gulpfile.js
user@/path/to/project% gulp
[22:59:21] Using gulpfile /path/to/project/gulpfile.js
[22:59:21] Starting 'purescript'...
[22:59:21] Finished 'purescript' after 23 ms
[22:59:21] Starting 'default'...
[22:59:21] Finished 'default' after 12 μs
user@/path/to/project% gulp clean
module.js:338
throw err;
^
Error: Cannot find module 'del'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/path/to/project/gulpfile.js:3:11)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Liftoff.handleArguments (/home/user/.nodebrew/node/v0.11.14/lib/node_modules/gulp/bin/gulp.js:116:3)
user@/path/to/project% npm install --save-dev del
[email protected] node_modules/del
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
user@/path/to/project% gulp clean
[23:00:11] Using gulpfile /path/to/project/gulpfile.js
[23:00:11] Starting 'clean'...
[23:00:11] Finished 'clean' after 5.26 ms
var gulp = require('gulp');
var purescript = require('gulp-purescript');
var del = require('del');
var paths = {
purescripts: ['src/**/*.purs', 'bower_components/**/src/**/*.purs']
};
gulp.task('clean', function(cb) {
del(['build'], cb);
});
gulp.task('purescript', function() {
return (
gulp.src(paths.purescripts)
.pipe(purescript.psc({noPrelude: true}))
.pipe(gulp.dest('build/'))
);
});
gulp.task('default', ['purescript']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment