Gruntfile.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 53
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 1
dl 0
loc 53
rs 10
c 1
b 0
f 0
wmc 2
mnd 0
bc 2
fnc 2
bpm 1
cpm 1
noi 0
1
/**
2
 * Grunt configuration file.
3
 *
4
 * @package WordPoints_BuddyPress
5
 * @since 1.0.0
6
 */
7
8
/* jshint node:true */
9
module.exports = function( grunt ) {
10
11
	var SOURCE_DIR = 'src/',
12
		DEV_LIB_DIR = 'dev-lib/';
13
14
	// Load tasks.
15
	require( 'matchdep' ).filterDev( 'grunt-*' ).forEach( grunt.loadNpmTasks );
16
	grunt.loadTasks( DEV_LIB_DIR + 'grunt/tasks/' );
17
18
	// Project configuration.
19
	grunt.initConfig({
20
		autoloader: {
21
			all: {
22
				src_dir: SOURCE_DIR,
23
				prefix: 'wordpoints_bp_',
24
				filter:  function ( class_files ) {
25
26
					// This class needs to come before other event classes.
27
					class_files.splice(
28
						class_files.indexOf( 'entity.php' ) + 1
29
						, 0
30
						, class_files.splice(
31
							class_files.indexOf( 'entity/activity/user.php' )
32
							, 1
33
						)[0]
34
					);
35
36
					return class_files;
37
				}
38
			}
39
		},
40
		watch: {
41
			autoloader: {
42
				files: [
43
					SOURCE_DIR + '**/classes/**/*.php',
44
					'!' + SOURCE_DIR + '**/classes/index.php'
45
				],
46
				tasks: ['autoloader'],
47
				options: {
48
					event: [ 'added', 'deleted' ]
49
				}
50
			},
51
			// This triggers an automatic reload of the `watch` task.
52
			config: {
53
				files: 'Gruntfile.js',
54
				tasks: ['build']
55
			}
56
		}
57
	});
58
59
	grunt.registerTask( 'build', ['autoloader'] );
60
	grunt.registerTask( 'default', 'build' );
61
};
62
63
// EOF
64