forked from felixrieseberg/Ghost-Desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
166 lines (151 loc) · 6.61 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// # Task automation for Ghost
//
// Run various tasks when developing for and working with Ghost Desktop.
//
// **Usage instructions:** can be found in the by running `grunt --help`.
//
// **Debug tip:** If you have any problems with any Grunt tasks, try running them with the `--verbose` command
const package = require('./package.json');
const winTools = require('./scripts/create-windows-build');
const configureGrunt = function (grunt) {
// #### Load all grunt tasks
//
// Find all of the task which start with `grunt-` and load them, rather than explicitly declaring them all
require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
if (process.platform === 'linux') {
grunt.loadNpmTasks('grunt-electron-installer-debian');
}
const config = {
jscs: {
app: {
files: {
src: [
'app/**/*.js',
'!node_modules/**/*.js',
'!bower_components/**/*.js',
'!tests/**/*.js',
'!tmp/**/*.js',
'!dist/**/*.js'
]
}
},
tests: {
files: {
src: [
'tests/**/*.js'
]
}
}
},
eslint: {
configFile: '.eslintrc.json',
target: [
'main/**/*.js',
'app/**/*.js',
'!node_modules/**/*.js',
'!bower_components/**/*.js',
'!tests/**/*.js',
'!tmp/**/*.js',
'!dist/**/*.js'
]
},
shell: {
test: {
command: 'ember electron:test'
},
build: {
command: `ember electron:package --environment production --arch x64 --platform ${process.platform} --app-version ${package.version} --overwrite`
},
build32: {
command: `ember electron:package --environment production --arch ia32 --platform ${process.platform} --app-version ${package.version} --overwrite`
},
logCoverage: {
command: 'node ./scripts/log-coverage.js'
},
dmg: {
command: 'node ./scripts/create-osx-build.js'
},
fetchContributors: {
command: 'node ./scripts/fetch-github-contributors.js'
},
},
clean: {
builds32: [
'electron-builds/Ghost-win32-ia32-installer/**/*',
'electron-builds/Ghost-win32-ia32/**/*',
'electron-builds/Ghost-linux-ia32-installer/**/*',
'electron-builds/Ghost-linux-ia32/**/*',
'electron-builds/Ghost-darwin-ia32/**/*'
],
builds64: [
'electron-builds/Ghost-win32-x64-installer/**/*',
'electron-builds/Ghost-win32-x64/**/*',
'electron-builds/Ghost-linux-x64-installer/**/*',
'electron-builds/Ghost-linux-x64/**/*',
'electron-builds/Ghost-darwin-x64/**/*'
],
},
'create-windows-installer': {
ia32: {
appDirectory: './electron-builds/Ghost-win32-ia32',
outputDirectory: './electron-builds/Ghost-win32-ia32-installer',
authors: 'Ghost Foundation',
exe: 'Ghost.exe',
iconUrl: `https://raw.githubusercontent.com/TryGhost/Ghost-Desktop/master/assets/icons/ghost.ico`,
setupIcon: `${__dirname}/assets/icons/ghost.ico`,
title: 'Ghost',
noMsi: true,
loadingGif: './assets/win/installer-dev.gif',
certificateFile: winTools.getSigningCert(),
certificatePassword: winTools.getSigningPassword()
},
x64: {
appDirectory: './electron-builds/Ghost-win32-x64',
outputDirectory: './electron-builds/Ghost-win32-x64-installer',
authors: 'Ghost Foundation',
exe: 'Ghost.exe',
iconUrl: `https://raw.githubusercontent.com/TryGhost/Ghost-Desktop/master/assets/icons/ghost.ico`,
setupIcon: `${__dirname}/assets/icons/ghost.ico`,
title: 'Ghost',
noMsi: true,
loadingGif: './assets/win/installer-dev.gif'
}
},
'electron-installer-debian': {
app: {
options: {
name: 'Ghost',
maintainer: 'Felix Rieseberg <[email protected]>',
homepage: 'https://tryghost.com',
genericName: 'Blogging Software',
arch: 'amd64',
icon: `${__dirname}/assets/icons/ghost-osx.png`,
bin: 'Ghost',
productDescription: 'A beautiful desktop application enabling you to easily manage multiple Ghost blogs and work without distractions.'
},
src: './electron-builds/Ghost-linux-x64',
dest: './electron-builds/Ghost-linux-x64-installer'
}
},
trimtrailingspaces: {
main: {
src: ['app/**/*.js', 'tests/**/*.js', 'scripts/**/*.js', 'Gruntfile.js', 'main/**/*.js'],
options: {
filter: 'isFile',
encoding: 'utf8',
failIfTrimmed: false
}
}
}
};
grunt.initConfig(config);
grunt.registerTask('codestyle', 'Test Code Style', ['trimtrailingspaces', 'eslint', 'jscs:app']);
grunt.registerTask('validate', 'Test Code Style and App', ['codestyle', 'shell:test', 'shell:logCoverage']);
grunt.registerTask('build', 'Compile Ghost Desktop for the current platform', ['shell:fetchContributors', 'shell:build']);
grunt.registerTask('installer-32', ['clean:builds32', 'shell:fetchContributors', 'shell:build32', 'create-windows-installer:ia32'])
grunt.registerTask('installer-64', ['clean:builds64', 'shell:fetchContributors', 'shell:build', 'create-windows-installer:x64'])
grunt.registerTask('installer', 'Create Windows Installers for Ghost', ['installer-32', 'installer-64']);
grunt.registerTask('debian', ['clean:builds64', 'shell:fetchContributors', 'shell:build', 'electron-installer-debian']);
grunt.registerTask('dmg', 'Create an OS X dmg for Ghost', ['shell:fetchContributors', 'shell:build', 'shell:dmg']);
};
module.exports = configureGrunt;