This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
forked from zendesk/linksf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
64 lines (52 loc) · 1.76 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
require 'dotenv/tasks'
namespace :deploy do
task :s3 do
s3cfg = File.expand_path(File.dirname(__FILE__) + "/s3cfg")
if `which s3cmd`.chomp.empty?
puts 'please install and configure s3cmd'
exit
end
if !File.exist?(s3cfg)
puts "please copy s3cfg.example to s3cfg and configure"
exit
end
s3cmd = "s3cmd -c #{s3cfg}"
bucket = $bucket || abort("please call deploy:production or deploy:development")
deploy_glob = %w(
build/*.js
build/*.css
index.html
admin.html
)
Dir.glob(deploy_glob).each do |d|
system("#{s3cmd} put --acl-public #{d} s3://#{bucket}/#{d}")
end
# deploy everything in vendor/font
system("#{s3cmd} sync --acl-public vendor/font/ s3://#{bucket}/vendor/font/")
# deploy everything in images
system("#{s3cmd} sync --acl-public img/ s3://#{bucket}/img/")
end
task :parse do
system("cd #{File.dirname(__FILE__) + '/server'} && parse deploy #{$parse_target}")
end
task :setup_production => :dotenv do
abort unless system("grunt", "build:production")
$bucket = "www.link-sf.com"
$parse_target = '"Link SF"'
ENV['PARSE_APP_ID'] = ENV['PARSE_PROD_APP_ID']
ENV['PARSE_JS_KEY'] = ENV['PARSE_PROD_JS_KEY']
end
task :setup_development => :dotenv do
abort unless system("grunt", "build:development")
$bucket = "dev.link-sf.com"
$parse_target = '"Link SF -- Development"'
ENV['PARSE_APP_ID'] = ENV['PARSE_DEV_APP_ID']
ENV['PARSE_JS_KEY'] = ENV['PARSE_DEV_JS_KEY']
end
task :production => ['clean', 'deploy:setup_production', 'deploy', 'clean']
task :development => ['clean', 'deploy:setup_development', 'deploy', 'clean']
end
task :clean do
system 'rm', 'build/*'
end
task :deploy => ['deploy:parse', 'deploy:s3']