1 | /* |
---|
2 | * grunt-contrib-clean |
---|
3 | * http://gruntjs.com/ |
---|
4 | * |
---|
5 | * Copyright (c) 2013 Tim Branyen, contributors |
---|
6 | * Licensed under the MIT license. |
---|
7 | */ |
---|
8 | |
---|
9 | 'use strict'; |
---|
10 | |
---|
11 | module.exports = function(grunt) { |
---|
12 | |
---|
13 | // Project configuration. |
---|
14 | grunt.initConfig({ |
---|
15 | jshint: { |
---|
16 | all: [ |
---|
17 | 'Gruntfile.js', |
---|
18 | 'tasks/*.js', |
---|
19 | '<%= nodeunit.tests %>' |
---|
20 | ], |
---|
21 | options: { |
---|
22 | jshintrc: '.jshintrc' |
---|
23 | }, |
---|
24 | }, |
---|
25 | |
---|
26 | // Configuration to be run (and then tested). |
---|
27 | clean: { |
---|
28 | short: ['tmp/sample_short'], |
---|
29 | long: { |
---|
30 | src: ['tmp/sample_long'], |
---|
31 | }, |
---|
32 | }, |
---|
33 | |
---|
34 | // Unit tests. |
---|
35 | nodeunit: { |
---|
36 | tests: ['test/*_test.js'], |
---|
37 | }, |
---|
38 | }); |
---|
39 | |
---|
40 | // Actually load this plugin's task(s). |
---|
41 | grunt.loadTasks('tasks'); |
---|
42 | |
---|
43 | // These plugins provide necessary tasks. |
---|
44 | grunt.loadNpmTasks('grunt-contrib-jshint'); |
---|
45 | grunt.loadNpmTasks('grunt-contrib-nodeunit'); |
---|
46 | grunt.loadNpmTasks('grunt-contrib-internal'); |
---|
47 | |
---|
48 | // Setup a test helper to create some folders to clean. |
---|
49 | grunt.registerTask('copy', 'Copy fixtures to a temp location.', function() { |
---|
50 | grunt.file.copy('test/fixtures/sample_long/long.txt', 'tmp/sample_long/long.txt'); |
---|
51 | grunt.file.copy('test/fixtures/sample_short/short.txt', 'tmp/sample_short/short.txt'); |
---|
52 | }); |
---|
53 | |
---|
54 | // Whenever the 'test' task is run, first create some files to be cleaned, |
---|
55 | // then run this plugin's task(s), then test the result. |
---|
56 | grunt.registerTask('test', ['copy', 'clean', 'nodeunit']); |
---|
57 | |
---|
58 | // By default, lint and run all tests. |
---|
59 | grunt.registerTask('default', ['jshint', 'test', 'build-contrib']); |
---|
60 | }; |
---|