UNPKG

2.52 kBtext/coffeescriptView Raw
1module.exports = ->
2 # Project configuration
3 @initConfig
4 pkg: @file.readJSON 'package.json'
5
6 # Updating the package manifest files
7 noflo_manifest:
8 update:
9 files:
10 'component.json': ['graphs/*', 'components/*']
11 'package.json': ['graphs/*', 'components/*']
12
13 # Browser build of NoFlo
14 noflo_browser:
15 build:
16 files:
17 'browser/noflo-core.js': ['component.json']
18
19 # CoffeeScript compilation
20 coffee:
21 spec:
22 options:
23 bare: true
24 expand: true
25 cwd: 'spec'
26 src: ['**.coffee']
27 dest: 'spec'
28 ext: '.js'
29
30 # JavaScript minification for the browser
31 uglify:
32 options:
33 report: 'min'
34 noflo:
35 files:
36 './browser/noflo-core.min.js': ['./browser/noflo-core.js']
37
38 # Automated recompilation and testing when developing
39 watch:
40 files: ['spec/*.coffee', 'components/*.coffee']
41 tasks: ['test']
42
43 # BDD tests on Node.js
44 mochaTest:
45 nodejs:
46 src: ['spec/*.coffee']
47 options:
48 reporter: 'spec'
49 require: 'coffee-script/register'
50 grep: process.env.TESTS
51
52 # BDD tests on browser
53 mocha_phantomjs:
54 options:
55 output: 'spec/result.xml'
56 reporter: 'spec'
57 failWithOutput: true
58 all: ['spec/runner.html']
59
60 # Coding standards
61 coffeelint:
62 components:
63 files:
64 src: ['components/*.coffee']
65 options:
66 max_line_length:
67 value: 80
68 level: 'warn'
69
70 # Grunt plugins used for building
71 @loadNpmTasks 'grunt-noflo-manifest'
72 @loadNpmTasks 'grunt-noflo-browser'
73 @loadNpmTasks 'grunt-contrib-coffee'
74 @loadNpmTasks 'grunt-contrib-uglify'
75
76 # Grunt plugins used for testing
77 @loadNpmTasks 'grunt-contrib-watch'
78 @loadNpmTasks 'grunt-mocha-test'
79 @loadNpmTasks 'grunt-mocha-phantomjs'
80 @loadNpmTasks 'grunt-coffeelint'
81
82 # Our local tasks
83 @registerTask 'build', 'Build NoFlo for the chosen target platform', (target = 'all') =>
84 @task.run 'noflo_manifest'
85 if target is 'all' or target is 'browser'
86 @task.run 'noflo_browser'
87
88 @registerTask 'test', 'Build NoFlo and run automated tests', (target = 'all') =>
89 @task.run 'coffeelint'
90 @task.run 'build'
91 if target is 'all' or target is 'nodejs'
92 @task.run 'mochaTest'
93 if target is 'all' or target is 'browser'
94 @task.run 'coffee'
95 @task.run 'mocha_phantomjs'
96
97 @registerTask 'default', ['test']