Gruntfile.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 2.33

Size

Lines of Code 136
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
nc 3
dl 0
loc 136
rs 10
c 0
b 0
f 0
wmc 7
mnd 1
bc 6
fnc 3
bpm 2
cpm 2.3333
noi 0
1
module.exports = function (grunt) {
2
3
	// Autoload all Grunt tasks
4
	require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
5
6
	grunt.initConfig({
7
		pkg: grunt.file.readJSON('package.json'),
8
		// Meta informations
9
		meta: {
10
			now: grunt.template.today('ddd, d mmm yyyy h:MM:ss'),
11
			files: {
12
				bin: {
13
					tester: 'vendor/bin/tester',
14
				},
15
			},
16
		},
17
18
		nette_tester: {
19
			options: {
20
				bin: 'vendor/bin/tester',
21
				jobs: 10,
22
				quiet: false,
23
				phpIni: 'tests/php.ini',
24
			},
25
			src: ['tests'],
26
		},
27
28
		shell: {
29
			nette_tester: {
30
				command: 'php -f vendor/nette/tester/Tester/tester.php -- -c tests/php-unix.ini -j 10 tests/unit',
31
			},
32
			codeception: {
33
				command: 'php -f vendor/codeception/codeception/codecept run acceptance',
34
			},
35
			ftpDeployment: {
36
				command: 'php -f vendor/dg/ftp-deployment/deployment deployment.ini',
37
			},
38
			ftpDeploymentTest: {
39
				command: 'php -f vendor/dg/ftp-deployment/deployment deployment.ini --test',
40
			}
41
		},
42
43
		clean: {
44
			container: ['temp/Container_*'],
45
			cache: [
46
				'temp/cache/_*',
47
				'temp/cache/Nette.*',
48
			],
49
		},
50
51
		conventionalChangelog: {
52
			options: {
53
				changelogOpts: {
54
					// conventional-changelog options go here
55
					preset: 'angular'
56
				},
57
				context: {
58
					// context goes here
59
				},
60
				gitRawCommitsOpts: {
61
					// git-raw-commits options go here
62
				},
63
				parserOpts: {
64
					// conventional-commits-parser options go here
65
				},
66
				writerOpts: {
67
					// conventional-changelog-writer options go here
68
				}
69
			},
70
			release: {
71
				src: 'CHANGELOG.md'
72
			}
73
		},
74
75
		bump: {
76
			options: {
77
				files: [
78
					'package.json',
79
				],
80
				updateConfigs: ['pkg'],
81
				commitFiles: [
82
					'package.json',
83
					'CHANGELOG.md',
84
				],
85
				commitMessage: 'Release v%VERSION%',
86
				createTag: true,
87
				tagName: 'v%VERSION%',
88
				tagMessage: 'Release v%VERSION%',
89
				push: true,
90
				pushTo: 'origin',
91
			}
92
		},
93
94
		// Watch task
95
		watch: {
96
			php: {
97
				files: ['**/*.php'],
98
				tasks: ['test'],
99
			},
100
		},
101
102
	});
103
104
	grunt.registerTask('build', 'Bumps version and builds JS.', function(version_type) {
105
		if (version_type !== 'patch' && version_type !== 'minor' && version_type !== 'major') {
106
		version_type = 'minor';
107
		}
108
		return grunt.task.run([
109
			"bump-only:" + version_type,
110
			'conventionalChangelog',
111
			'bump-commit',
112
		]);
113
	});
114
115
	grunt.registerTask('deploy', 'Deploy files to server over FTP.', function(account) {
116
		if (typeof account !== 'undefined') {
117
			return grunt.task.run(['ftp-deploy:' + account]);
118
		} else {
119
			return grunt.task.run([
120
				'shell:nette_tester',
121
				'shell:codeception',
122
				'shell:ftpDeployment',
123
			]);
124
		}
125
	});
126
127
	grunt.registerTask('test', [
128
		'shell:nette_tester',
129
		'shell:codeception',
130
	]);
131
132
	grunt.registerTask('dev', [
133
	]);
134
135
	grunt.registerTask('default', 'watch');
136
};
137