Skip to content

Commit 13902dd

Browse files
committed
Initial commit
0 parents  commit 13902dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4209
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/node_modules/*

.eslintrc

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
env:
3+
browser: true
4+
node: true
5+
es6: true
6+
rules:
7+
handle-callback-err: 2
8+
indent: [2, 2, {SwitchCase: 1}]
9+
no-dupe-class-members: 2
10+
no-multi-spaces: 2
11+
no-shadow: 2
12+
no-unused-expressions: 2
13+
no-unused-vars: [2, {args: none}]
14+
quotes: [2, single, avoid-escape]
15+
semi: [2, always]
16+
keyword-spacing: 2
17+
space-before-blocks: 2
18+
strict: [2, global]

.gitattributes

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Reference: https://help.github.com/articles/dealing-with-line-endings/
2+
3+
# enforce LF line endings
4+
* text eol=lf
5+
6+
# Denote all files that are truly binary and should not be modified.
7+
*.png binary
8+
*.jpg binary
9+
*.ico binary
10+
*.icns binary
11+
12+
*.eot binary
13+
*.otf binary
14+
*.svg binary
15+
*.ttf binary
16+
*.woff binary
17+
*.woff2 binary

.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
*-ar.*
2+
*-fr.*
3+
*-it.*
4+
*-pt.*
5+
*-ru.*
6+
*.log
7+
*.pyc
8+
*.pyc
9+
.DS_Store
10+
.grunt
11+
.Icon
12+
/.idea
13+
/temp
14+
/wrap
15+
app.asar
16+
node_modules
17+
npm-debug.log
18+
Wire*.zip

.travis.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/
2+
sudo: false
3+
4+
# http://docs.travis-ci.com/user/languages/javascript-with-nodejs/
5+
language: node_js
6+
node_js:
7+
- "5.1.1"
8+
9+
# https://docs.travis-ci.com/user/languages/javascript-with-nodejs#Node.js-v4-(or-io.js-v3)-compiler-requirements
10+
env:
11+
- CXX=g++-4.8
12+
addons:
13+
apt:
14+
sources:
15+
- ubuntu-toolchain-r-test
16+
packages:
17+
- g++-4.8
18+
19+
git:
20+
submodules: false
21+
22+
cache:
23+
directories:
24+
- node_modules
25+
- electron/node_modules
26+
27+
# http://docs.travis-ci.com/user/build-lifecycle/
28+
install:
29+
- npm install
30+
31+
# http://docs.travis-ci.com/user/build-lifecycle/
32+
before_script:
33+
- export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start
34+
35+
# http://docs.travis-ci.com/user/pull-requests/
36+
script:
37+
- npm test
38+
39+
notifications:
40+
email: false
41+
42+
branches:
43+
only:
44+
- master

Gruntfile.coffee

+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
#
2+
# Wire
3+
# Copyright (C) 2016 Wire Swiss GmbH
4+
#
5+
# This program is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program. If not, see http://www.gnu.org/licenses/.
17+
#
18+
19+
electron_packager = require 'electron-packager'
20+
21+
ELECTRON_PACKAGE_JSON = 'electron/package.json'
22+
PACKAGE_JSON = 'package.json'
23+
INFO_JSON = 'info.json'
24+
25+
module.exports = (grunt) ->
26+
require('load-grunt-tasks') grunt, pattern: ['grunt-*']
27+
path = require 'path'
28+
29+
grunt.initConfig
30+
pkg: grunt.file.readJSON PACKAGE_JSON
31+
info: grunt.file.readJSON INFO_JSON
32+
33+
clean:
34+
wrap: 'wrap'
35+
build: 'wrap/build'
36+
dist: 'wrap/dist'
37+
win: 'wrap/**/<%= info.name %>-win*'
38+
osx: 'wrap/**/<%= info.name %>-darwin*'
39+
linux: 'wrap/**/<%= info.name %>-linux*'
40+
pkg: '*.pkg'
41+
42+
productbuild:
43+
options:
44+
sign:
45+
app: '<%= info.sign.app %>'
46+
package: '<%= info.sign.package %>'
47+
parent: 'resources/osx/entitlements/parent.plist'
48+
child: 'resources/osx/entitlements/child.plist'
49+
dir: 'wrap/dist/<%= info.name %>-mas-x64/<%= info.name %>.app'
50+
name: '<%= info.name %>'
51+
52+
electron:
53+
options:
54+
name: '<%= info.name %>'
55+
dir: 'electron'
56+
out: 'wrap/build'
57+
version: '1.3.1'
58+
overwrite: true
59+
arch: 'all'
60+
asar: true
61+
'app-copyright': '<%= info.copyright %>'
62+
'app-version': '<%= info.version %>'
63+
'build-version': '<%= info.build %>'
64+
'min-version': '10.9.0'
65+
protocols: [
66+
{name: '', schemes: ['wire']}
67+
]
68+
osx_internal:
69+
options:
70+
name: '<%= info.nameInternal %>'
71+
platform: 'mas'
72+
icon: 'resources/osx/wire.internal.icns'
73+
'app-bundle-id': 'com.wearezeta.zclient.mac.internal'
74+
'dev-region': 'en'
75+
osx_prod:
76+
options:
77+
platform: 'mas'
78+
out: 'wrap/dist/'
79+
icon: 'resources/osx/wire.icns'
80+
'app-category-type': 'public.app-category.social-networking'
81+
'app-bundle-id': 'com.wearezeta.zclient.mac'
82+
'helper-bundle-id': 'com.wearezeta.zclient.mac.helper'
83+
'dev-region': 'en'
84+
'extend-info': 'resources/osx/custom.plist'
85+
win_internal:
86+
options:
87+
name: '<%= info.nameInternal %>'
88+
platform: 'win32'
89+
icon: 'resources/win/wire.internal.ico'
90+
arch: 'ia32'
91+
'version-string':
92+
CompanyName: '<%= info.name %>'
93+
FileDescription: '<%= info.description %>'
94+
OriginalFilename: '<%= info.nameInternal %>.exe'
95+
ProductName: '<%= info.nameInternal %>'
96+
InternalName: '<%= info.nameInternal %>.exe'
97+
98+
win_prod:
99+
options:
100+
platform: 'win32'
101+
icon: 'resources/win/wire.ico'
102+
arch: 'ia32'
103+
'version-string':
104+
CompanyName: '<%= info.name %>'
105+
FileDescription: '<%= info.description %>'
106+
OriginalFilename: '<%= info.name %>.exe'
107+
ProductName: '<%= info.name %>'
108+
InternalName: '<%= info.name %>.exe'
109+
110+
linux:
111+
options:
112+
platform: 'linux'
113+
114+
'create-windows-installer':
115+
internal:
116+
title: '<%= info.nameInternal %>'
117+
description: '<%= info.description %>'
118+
version: '<%= info.version %>.<%= info.build %>'
119+
appDirectory: 'wrap/build/<%= info.nameInternal %>-win32-ia32'
120+
outputDirectory: 'wrap/internal/<%= info.nameInternal %>-win32-ia32'
121+
authors: '<%= info.nameInternal %>'
122+
exe: '<%= info.nameInternal %>.exe'
123+
setupIcon: 'resources/win/wire.internal.ico'
124+
noMsi: true
125+
loadingGif: 'resources/win/icon.internal.256x256.png'
126+
iconUrl: 'https://wire-app.wire.com/win/internal/wire.internal.ico'
127+
prod:
128+
title: '<%= info.name %>'
129+
description: '<%= info.description %>'
130+
version: '<%= info.version %>.<%= info.build %>'
131+
appDirectory: 'wrap/build/<%= info.name %>-win32-ia32'
132+
outputDirectory: 'wrap/prod/<%= info.name %>-win32-ia32'
133+
authors: '<%= info.name %>'
134+
exe: '<%= info.name %>.exe'
135+
setupIcon: 'resources/win/wire.ico'
136+
noMsi: true
137+
loadingGif: 'resources/win/icon.256x256.png'
138+
iconUrl: 'https://wire-app.wire.com/win/prod/wire.ico'
139+
140+
gitcommit:
141+
release:
142+
options:
143+
message: 'Release <%= info.version %>.<%= info.build %>'
144+
files:
145+
src: [INFO_JSON, ELECTRON_PACKAGE_JSON]
146+
147+
gittag:
148+
release:
149+
options:
150+
tag: 'release/<%= info.version %>.<%= info.build %>'
151+
message: 'Release <%= info.version %>.<%= info.build %>'
152+
153+
gitpush:
154+
task:
155+
options:
156+
tags: true
157+
branch: 'master'
158+
159+
githubChanges:
160+
release:
161+
options:
162+
auth: true
163+
onlyPulls: true
164+
useCommitBody: true
165+
owner : 'wireapp'
166+
repository : 'wire-desktop'
167+
168+
169+
###############################################################################
170+
# Tasks
171+
###############################################################################
172+
grunt.registerTask 'build-inc', ->
173+
info = grunt.config.get 'info'
174+
info.build = "#{parseInt(info.build, 10) + 1 }"
175+
grunt.config.set 'info', info
176+
grunt.file.write INFO_JSON, JSON.stringify(info, null, 2) + '\n'
177+
178+
electron_pkg = grunt.file.readJSON ELECTRON_PACKAGE_JSON
179+
electron_pkg.version = "#{info.version}.#{info.build}"
180+
grunt.file.write ELECTRON_PACKAGE_JSON, JSON.stringify(electron_pkg, null, 2) + '\n'
181+
182+
grunt.log.write("Build number increased to #{info.build} ").ok();
183+
184+
grunt.registerTask 'release-internal', ->
185+
info = grunt.config.get 'info'
186+
electron_pkg = grunt.file.readJSON ELECTRON_PACKAGE_JSON
187+
electron_pkg.updateWinUrl = info.updateWinUrlInternal
188+
electron_pkg.environment = 'internal'
189+
electron_pkg.name = info.nameInternal.toLowerCase()
190+
electron_pkg.productName = info.nameInternal
191+
grunt.file.write ELECTRON_PACKAGE_JSON, JSON.stringify(electron_pkg, null, 2) + '\n'
192+
grunt.log.write("Releases URL points to #{electron_pkg.updateWinUrl} ").ok();
193+
194+
grunt.registerTask 'release-prod', ->
195+
info = grunt.config.get 'info'
196+
electron_pkg = grunt.file.readJSON ELECTRON_PACKAGE_JSON
197+
electron_pkg.updateWinUrl = info.updateWinUrlProd
198+
electron_pkg.environment = 'production'
199+
electron_pkg.name = info.name.toLowerCase()
200+
electron_pkg.productName = info.name
201+
grunt.file.write ELECTRON_PACKAGE_JSON, JSON.stringify(electron_pkg, null, 2) + '\n'
202+
grunt.log.write("Releases URL points to #{electron_pkg.updateWinUrl} ").ok();
203+
204+
grunt.registerMultiTask 'electron', 'Package Electron apps', ->
205+
done = this.async()
206+
electron_packager @options(), (error) ->
207+
if (error)
208+
grunt.warn error
209+
else
210+
done()
211+
212+
grunt.registerTask 'productbuild', 'Build Mac Appstore package', ->
213+
execSync = require('child_process').execSync
214+
options = @options()
215+
216+
[
217+
'Electron Framework.framework/Versions/A/Electron Framework'
218+
'Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib'
219+
'Electron Framework.framework/Versions/A/Libraries/libnode.dylib'
220+
'Electron Framework.framework/'
221+
"#{options.name} Helper.app/Contents/MacOS/#{options.name} Helper"
222+
"#{options.name} Helper.app/"
223+
"#{options.name} Helper EH.app/Contents/MacOS/#{options.name} Helper EH"
224+
"#{options.name} Helper EH.app/"
225+
"#{options.name} Helper NP.app/Contents/MacOS/#{options.name} Helper NP"
226+
"#{options.name} Helper NP.app/"
227+
].forEach (framework) ->
228+
execSync "codesign --deep -fs '#{options.sign.app}' --entitlements '#{options.child}' '#{options.dir}/Contents/Frameworks/#{framework}'"
229+
230+
execSync "codesign -fs '#{options.sign.app}' --entitlements '#{options.child}' '#{options.dir}/Contents/MacOS/#{options.name}'"
231+
execSync "codesign -fs '#{options.sign.app}' --entitlements '#{options.parent}' '#{options.dir}'"
232+
execSync "productbuild --component '#{options.dir}' /Applications --sign '#{options.sign.package}' '#{options.name}.pkg'"
233+
234+
235+
grunt.registerTask 'release', ['build-inc', 'gitcommit', 'gittag', 'gitpush']
236+
237+
grunt.registerTask 'osx', ['clean:osx', 'release-internal', 'electron:osx_internal']
238+
grunt.registerTask 'osx-prod', ['clean:osx', 'release-prod', 'electron:osx_prod', 'productbuild']
239+
240+
grunt.registerTask 'win', ['clean:win', 'release-internal', 'electron:win_internal', 'create-windows-installer:internal']
241+
grunt.registerTask 'win-prod', ['clean:win', 'release-prod', 'electron:win_prod', 'create-windows-installer:prod']
242+
243+
grunt.registerTask 'linux', ['clean:linux', 'release-internal', 'electron:linux']

0 commit comments

Comments
 (0)