This repository has been archived by the owner on May 29, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
78 lines (67 loc) · 2.65 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
75
76
77
78
# TODO: sign source distribution: gpg --armor --detach-sign file.tgz
require 'fileutils'
remote = "teapot@167.71.110.79"
config_path = "/etc/nginx/sites-available/download.rethinkdb.com"
remote_path = "/var/www/download.rethinkdb.com/public_html"
desc 'Update the nginx configuration'
task :update_nginx do
nginx_conf = "nginx.conf"
sh "scp #{nginx_conf} #{remote}:#{config_path}"
sh "ssh #{remote} -t 'sudo service nginx restart'"
end
desc 'Use rsync to upload files to the download server.'
task :publish, [:force] do |t, args|
if args.force == "force"
puts "Publishing to #{remote_path}."
pretend = ''
else
puts "Not publishing to #{remote_path} (Dry-run, use publish[force] to do the actual upload)."
pretend = "--dry-run"
end
src = 'download.rethinkdb.com'
# Have removed --delay-updates to avoid running out of disk space.
sh "rsync --progress --recursive --delete --compress --human-readable --rsh='ssh' --itemize-changes --copy-links #{pretend} #{src}/ #{remote}:#{remote_path}"
if args.force == "force"
puts "Published to #{remote_path}."
else
puts "Not published to #{remote_path} (Dry-run, use publish[force] to do the actual upload)."
end
end
def env_version
version = ENV['VERSION']
fail "missing VERSION" unless version
return version
end
def cpe(src, dst, srcname, dstname = '')
dstname = srcname if dstname.empty?
FileUtils::Verbose.copy_entry "#{src}/#{srcname}", "#{dst}/#{dstname}"
end
desc 'add a new version to the apt repo'
task :apt do
version = env_version
sh "./apt-repo/add-version #{version}"
sh "./apt-repo/build-repo"
end
desc 'copy all files except for deb packages over to the directory to be uploaded'
task :copy do
version = env_version
src = "version/#{version}"
dst = "download.rethinkdb.com"
cpe "#{src}/dist", "#{dst}/dist", "rethinkdb-#{version}.tgz"
cpe "#{src}/osx", "#{dst}/osx", "rethinkdb.dmg", "rethinkdb-#{version}.dmg"
[[7, 'x86_64'], [8, 'x86_64']].each do |pair|
ver, arch = pair
cpe "#{src}/centos#{ver}", "#{dst}/centos/#{ver}/#{arch}", "rethinkdb-#{version.sub('-','_')}.#{arch}.rpm"
sh "git annex add #{dst}/centos/#{ver}/#{arch}"
sh "git annex unlock #{dst}/centos/#{ver}/#{arch}/repodata"
sh "createrepo #{dst}/centos/#{ver}/#{arch}"
end
sh "git annex add #{dst}"
end
desc "copy files and build repos for a specific release"
task :prepare => [:apt, :copy] do
version = env_version
sh "git commit -m 'Prepared files for #{version}'"
puts "Before publishing these new files"
puts "please copy them to the backup using 'git annex copy --to'"
end