2014-04-08 14:18:56 +00:00
|
|
|
spawn = require("child_process").spawn
|
|
|
|
|
2014-02-12 17:27:43 +00:00
|
|
|
module.exports = (grunt) ->
|
|
|
|
grunt.initConfig
|
|
|
|
coffee:
|
|
|
|
app_src:
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
|
|
|
cwd: "app"
|
|
|
|
src: ['coffee/*.coffee'],
|
|
|
|
dest: 'app/js/',
|
|
|
|
ext: '.js'
|
|
|
|
|
|
|
|
app:
|
|
|
|
src: "app.coffee"
|
|
|
|
dest: "app.js"
|
|
|
|
|
|
|
|
unit_tests:
|
|
|
|
expand: true
|
|
|
|
cwd: "test/unit/coffee"
|
|
|
|
src: ["**/*.coffee"]
|
|
|
|
dest: "test/unit/js/"
|
|
|
|
ext: ".js"
|
|
|
|
|
|
|
|
acceptance_tests:
|
|
|
|
expand: true
|
|
|
|
cwd: "test/acceptance/coffee"
|
|
|
|
src: ["**/*.coffee"]
|
|
|
|
dest: "test/acceptance/js/"
|
|
|
|
ext: ".js"
|
|
|
|
|
|
|
|
smoke_tests:
|
|
|
|
expand: true
|
|
|
|
cwd: "test/smoke/coffee"
|
|
|
|
src: ["**/*.coffee"]
|
|
|
|
dest: "test/smoke/js"
|
|
|
|
ext: ".js"
|
|
|
|
|
|
|
|
clean:
|
|
|
|
app: ["app/js/"]
|
|
|
|
unit_tests: ["test/unit/js"]
|
|
|
|
acceptance_tests: ["test/acceptance/js"]
|
|
|
|
smoke_tests: ["test/smoke/js"]
|
|
|
|
|
2014-04-02 20:55:14 +00:00
|
|
|
execute:
|
|
|
|
app:
|
|
|
|
src: "app.js"
|
2014-02-12 17:27:43 +00:00
|
|
|
|
2017-08-07 15:21:37 +00:00
|
|
|
mkdir:
|
|
|
|
all:
|
|
|
|
options:
|
|
|
|
create: ["cache", "compiles"]
|
|
|
|
|
2014-02-12 17:27:43 +00:00
|
|
|
mochaTest:
|
|
|
|
unit:
|
|
|
|
options:
|
|
|
|
reporter: "spec"
|
2014-12-09 11:07:58 +00:00
|
|
|
grep: grunt.option("grep")
|
2014-02-12 17:27:43 +00:00
|
|
|
src: ["test/unit/js/**/*.js"]
|
|
|
|
acceptance:
|
|
|
|
options:
|
|
|
|
reporter: "spec"
|
|
|
|
timeout: 40000
|
2014-04-03 13:03:51 +00:00
|
|
|
grep: grunt.option("grep")
|
2014-02-12 17:27:43 +00:00
|
|
|
src: ["test/acceptance/js/**/*.js"]
|
|
|
|
smoke:
|
|
|
|
options:
|
|
|
|
reported: "spec"
|
|
|
|
timeout: 10000
|
|
|
|
src: ["test/smoke/js/**/*.js"]
|
|
|
|
|
|
|
|
grunt.loadNpmTasks 'grunt-contrib-coffee'
|
|
|
|
grunt.loadNpmTasks 'grunt-contrib-clean'
|
|
|
|
grunt.loadNpmTasks 'grunt-mocha-test'
|
|
|
|
grunt.loadNpmTasks 'grunt-shell'
|
2014-04-02 20:55:14 +00:00
|
|
|
grunt.loadNpmTasks 'grunt-execute'
|
|
|
|
grunt.loadNpmTasks 'grunt-bunyan'
|
2017-08-07 15:21:37 +00:00
|
|
|
grunt.loadNpmTasks 'grunt-mkdir'
|
2014-02-12 17:27:43 +00:00
|
|
|
|
2014-04-08 14:18:56 +00:00
|
|
|
grunt.registerTask 'compile:bin', () ->
|
|
|
|
callback = @async()
|
|
|
|
proc = spawn "cc", [
|
2014-04-09 11:44:51 +00:00
|
|
|
"-o", "bin/synctex", "-Isrc/synctex",
|
|
|
|
"src/synctex.c", "src/synctex/synctex_parser.c", "src/synctex/synctex_parser_utils.c", "-lz"
|
2014-04-08 14:18:56 +00:00
|
|
|
], stdio: "inherit"
|
|
|
|
proc.on "close", callback
|
|
|
|
|
2014-04-09 11:37:04 +00:00
|
|
|
grunt.registerTask 'compile:app', ['clean:app', 'coffee:app', 'coffee:app_src', 'coffee:smoke_tests', 'compile:bin']
|
2014-04-02 20:55:14 +00:00
|
|
|
grunt.registerTask 'run', ['compile:app', 'bunyan', 'execute']
|
2014-02-12 17:27:43 +00:00
|
|
|
|
|
|
|
grunt.registerTask 'compile:unit_tests', ['clean:unit_tests', 'coffee:unit_tests']
|
|
|
|
grunt.registerTask 'test:unit', ['compile:app', 'compile:unit_tests', 'mochaTest:unit']
|
|
|
|
|
|
|
|
grunt.registerTask 'compile:acceptance_tests', ['clean:acceptance_tests', 'coffee:acceptance_tests']
|
|
|
|
grunt.registerTask 'test:acceptance', ['compile:acceptance_tests', 'mochaTest:acceptance']
|
|
|
|
|
|
|
|
grunt.registerTask 'compile:smoke_tests', ['clean:smoke_tests', 'coffee:smoke_tests']
|
|
|
|
grunt.registerTask 'test:smoke', ['compile:smoke_tests', 'mochaTest:smoke']
|
|
|
|
|
|
|
|
grunt.registerTask 'install', 'compile:app'
|
|
|
|
|
2017-08-07 15:21:37 +00:00
|
|
|
grunt.registerTask 'default', ['mkdir', 'run']
|
2014-02-12 17:27:43 +00:00
|
|
|
|
|
|
|
|