6a53c401 by Michael Richards

Update to grunt 0.4.x and replace grunt.js with a Gruntfile.coffee. Update devel…

…opment dependencies to use tasks from grunt-contrib-*.
1 parent 8db554cd
1 module.exports = (grunt) ->
2 grunt.initConfig
3 pkg: grunt.file.readJSON('package.json')
4
5 meta:
6 banner:
7 '// rivets.js\n' +
8 '// version: <%= pkg.version %>\n' +
9 '// author: <%= pkg.author %>\n' +
10 '// license: <%= pkg.licenses[0].type %>\n'
11
12 coffee:
13 all:
14 files:
15 'lib/rivets.js': 'src/rivets.coffee'
16
17 uglify:
18 all:
19 options:
20 banner: '<%= meta.banner %>'
21 files:
22 'lib/rivets.min.js': 'lib/rivets.js'
23
24 jasmine:
25 all:
26 src: 'lib/rivets.js'
27 options:
28 specs: 'spec/rivets/**/*.js'
29 helpers: ['spec/matchers.js', 'spec/mock.data.js']
30
31 watch:
32 all:
33 files: 'src/rivets.coffee'
34 tasks: ['build', 'spec']
35
36 grunt.loadNpmTasks 'grunt-contrib-coffee'
37 grunt.loadNpmTasks 'grunt-contrib-uglify'
38 grunt.loadNpmTasks 'grunt-contrib-jasmine'
39 grunt.loadNpmTasks 'grunt-contrib-watch'
40
41 grunt.registerTask 'default', ['watch']
42 grunt.registerTask 'spec', ['jasmine']
43 grunt.registerTask 'build', ['coffee', 'uglify']
1 module.exports = function(grunt) {
2 grunt.initConfig({
3 pkg: '<json:package.json>',
4 meta: {
5 banner:
6 '// rivets.js\n' +
7 '// version: <%= pkg.version %>\n' +
8 '// author: <%= pkg.author %>\n' +
9 '// license: <%= pkg.licenses[0].type %>'
10 },
11 jasmine: {
12 all: ['spec/index.html']
13 },
14 lint: {
15 files: ['grunt.js', 'lib/**/*.js', 'spec/**/*.js']
16 },
17 min: {
18 dist: {
19 src: ['<banner:meta.banner>', 'lib/rivets.js'],
20 dest: 'lib/rivets.min.js'
21 }
22 },
23 watch: {
24 files: 'src/rivets.coffee',
25 tasks: 'build spec'
26 },
27 });
28
29 grunt.loadNpmTasks('grunt-jasmine-task');
30
31 grunt.registerTask('compile', 'Compiles CoffeeScript source into JavaScript.', function(){
32 var coffee = require('coffee-script');
33 var js = coffee.compile(grunt.file.read('src/rivets.coffee'));
34 var banner = grunt.task.directive('<banner:meta.banner>', function() { return null; });
35 if (js) grunt.file.write('lib/rivets.js', banner + js);
36 });
37
38 grunt.registerTask('default', 'watch');
39 grunt.registerTask('spec', 'jasmine');
40 grunt.registerTask('build', 'compile min');
41 };
1 { 1 {
2 "name" : "rivets", 2 "name": "rivets",
3 "description" : "Declarative data binding facility.", 3 "description": "Declarative data binding facility.",
4 "version" : "0.4.9", 4 "version": "0.4.9",
5 "author" : "Michael Richards", 5 "author": "Michael Richards",
6 "url" : "http://rivetsjs.com", 6 "url": "http://rivetsjs.com",
7 "main" : "./lib/rivets.js", 7 "main": "./lib/rivets.js",
8 "licenses" : [{ 8 "licenses": [
9 "type" : "MIT", 9 {
10 "url" : "https://github.com/mikeric/rivets/blob/master/LICENSE" 10 "type": "MIT",
11 }], 11 "url": "https://github.com/mikeric/rivets/blob/master/LICENSE"
12 "repository" : { 12 }
13 "type" : "git", 13 ],
14 "url" : "https://github.com/mikeric/rivets.git" 14 "repository": {
15 "type": "git",
16 "url": "https://github.com/mikeric/rivets.git"
15 }, 17 },
16 "devDependencies" : { 18 "devDependencies": {
17 "grunt" : "0.3.x", 19 "grunt": "~0.4.1",
18 "grunt-jasmine-task" : "0.2.x", 20 "grunt-contrib-coffee": "~0.7.0",
19 "coffee-script" : "1.3.x" 21 "grunt-contrib-uglify": "~0.2.0",
22 "grunt-contrib-jasmine": "~0.4.2",
23 "grunt-contrib-watch": "~0.3.1"
20 } 24 }
21 } 25 }
......