This repository has been archived by the owner on Mar 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Rakefile
74 lines (60 loc) · 1.94 KB
/
Rakefile
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
class String
def self.colorize(text, color_code)
"\e[#{color_code}m#{text}\e[0m"
end
def cyan
self.class.colorize(self, 36)
end
def green
self.class.colorize(self, 32)
end
end
desc 'Update and initialize the submodules'
task :update_submodules do
puts 'Updating submodules...'.cyan
`git submodule update --init --recursive`
end
desc 'Setup with example files and dummy fonts'
task :setup => :update_submodules do
# Copy examples defines
puts 'Copying example CDMDefines into place...'.cyan
`cp Other\\ Sources/CDMDefinesExample.h Other\\ Sources/CDMDefines.h`
`cp Other\\ Sources/CDMDefinesExample.m Other\\ Sources/CDMDefines.m`
# Make placeholder fonts
puts 'Creating dummy fonts...'.cyan
`mkdir -p Resources/Fonts`
`touch Resources/Fonts/Gotham-Bold.otf`
`touch Resources/Fonts/Gotham-BoldItalic.otf`
`touch Resources/Fonts/Gotham-Book.otf`
`touch Resources/Fonts/Gotham-BookItalic.otf`
# Done!
puts 'Done! You\'re ready to get started!'.green
end
# Run setup by default
task :default => :setup
# Tasks only for Nothing Magical
namespace :private do
desc 'Setup with private files'
task :setup => :update_submodules do
# Copy defines
puts 'Copying example CDMDefines into place...'.cyan
`cp ../cheddar-private/Mac/CDMDefines.* Other\\ Sources/`
# Make placeholder fonts
puts 'Coping Gotham...'.cyan
`cp -R ../cheddar-private/Resources/Fonts Resources/`
# Done!
puts 'Done! You\'re ready to get started!'.green
end
desc 'Sign update'
task :sign_update do
archive_path = ENV['archive_path']
unless archive_path and archive_path.length > 0
puts "Usage: rake sign_update archive_path=PATH_TO_ARCHIVE"
exit
end
openssl = '/usr/bin/openssl'
private_key = '../cheddar-private/Mac/dsa_priv.pem'
puts
puts `#{openssl} dgst -sha1 -binary < "#{archive_path}" | #{openssl} dgst -dss1 -sign "#{private_key}" | #{openssl} enc -base64`.green
end
end