forked from foundation/foundation-emails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
110 lines (108 loc) · 3.39 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assemble: {
options: {partials: 'css/*.css'},
templates: {
src: 'templates/**/*.html',
dest: 'build/downloads',
cwd: './'
},
docsDev: {
src: 'docs/examples/*.html',
dest: 'build/docs',
cwd: './'
},
docsDeploy: {
src: 'docs/examples/*.html',
dest: 'build',
cwd: './'
}
},
shell: {
makeStage: {
command: [
'rm -rf build',
'mkdir build',
'mkdir build/downloads',
'mkdir build/downloads/templates',
'mkdir build/downloads/framework',
'mkdir build/docs',
].join('&&')
},
zipTemplates: {
command: [
'cd build/downloads/templates/base',
'cp * ../',
'cd ../',
'rm -rf base',
'zip all-templates.zip *.html',
'for i in *.html; do zip "${i%}.zip" "$i"; done',
'cd ../../../'
].join('&&')
},
zipFramework: {
command: [
'cp css/ink.css build/downloads/framework/ink.css',
'cp templates/boilerplate.html build/downloads/framework/boilerplate.html',
'cp -r build/downloads/templates/examples build/downloads/framework/examples',
'cd build/downloads/framework',
'zip -r ink-<%= pkg.version %>.zip *',
'cd ../../../',
].join('&&')
},
linkFramework: {
command: [
'cd build/downloads',
'echo \'<?php $download_file = \"framework/ink-<%= pkg.version %>.zip\" ?>\' > latest.php',
'cd ../../',
].join('&&')
},
deployDownloads: {
command: [
'cd build/downloads',
'rsync -r . [email protected]:/var/www/ink/shared/downloads',
'cd ../../'
].join('&&')
},
testDocs: {
command: [
'cp -r docs/test/* build/docs',
'cp -r docs/components build/docs/components',
'cp docs/docs.php build/docs/docs.php',
].join('&&')
},
deployDocs: {
command: [
'rsync -r docs build --exclude test --exclude examples',
'cd build/docs',
'rsync -r . [email protected]:/var/www/ink/shared/docs',
'cd ../../'
].join('&&')
},
cleanUp: {
command: [
'rm -rf build',
'echo "Deploy Completed"'
].join('&&')
}
},
watch: {
docs: {
files: ['docs/docs.php', 'docs/**/*.php', 'docs/**/*.html', 'css/*.css'],
tasks: ['shell:makeStage', 'assemble:docsDev', 'shell:testDocs'],
options: {
livereload: true,
},
},
},
});
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('make:templates', ['assemble:templates', 'shell:zipTemplates']);
grunt.registerTask('deploy:downloads', ['shell:makeStage', 'assemble:templates', 'shell:zipTemplates', 'shell:zipFramework', 'shell:linkFramework', 'shell:deployDownloads', 'shell:cleanUp']);
grunt.registerTask('make:docs', ['shell:makeStage', 'assemble:docsDev', 'shell:testDocs']);
grunt.registerTask('deploy:docs', ['shell:makeStage', 'assemble:docsDeploy', 'shell:deployDocs', 'shell:cleanUp']);
grunt.registerTask('default', ['make:docs', 'watch']);
};