-
Notifications
You must be signed in to change notification settings - Fork 15
/
Rakefile
75 lines (61 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
65
66
67
68
69
70
71
72
73
74
75
# -*- encoding : utf-8 -*-
require "./decko_gem"
DOCKER_IMAGES = %w[base bundled mysql postgres sandbox].map { |name| "decko-#{name}" }
# DOCKER_IMAGES = ["decko-base", "decko-bundled"]
# NOTE: these tasks are not in any gem and are thus not available to monkeys.
# Therefore they should contain only platypus tasks.
task :push_gems do
each_gem do |dir, gem|
gem ||= dir
v = gem == :card ? DeckoGem.card_version : version
system %(cd #{dir}; #{push_gem gem, v})
end
end
task :version do
puts version
end
task :release do
system %(
git tag -a v#{version} -m "Decko Version #{version}"
git push --tags decko
)
end
# do NOT use `bundle exec` or bundle update won't work
task :build_images do
system "docker pull phusion/passenger-full:latest"
system "cd docker/template; bundle update"
DOCKER_IMAGES.each do |i|
system "echo '\nBUILDING: #{i}'"
system "cd docker; "\
"docker build -f repos/#{i}.dockerfile "\
"-t ethn/#{i} -t ethn/#{i}:latest -t ethn/#{i}:v#{version} ."
system "docker push ethn/#{i}:latest"
system "docker push ethn/#{i}:v#{version}"
end
end
# task :retag_latest do
# DOCKER_IMAGES.each do |i|
# i = "ethn/#{i}"
# system "docker pull #{i}:v#{version}"
# system "docker tag #{i}:v#{version} #{i}:latest"
# system "docker push #{i}:latest"
# end
# end
#------ Support methods -----------
def each_gem
yield :cardname
yield :card
Dir.each_child("mod") { |mod| yield "mod/#{mod}", "card-mod-#{mod}" }
yield :decko
Dir.each_child("support") { |lib| yield "support/#{lib}", lib }
end
def push_gem gem, version, prefix=""
%(
rm *.gem
gem build #{prefix}#{gem}.gemspec
gem push #{prefix}#{gem}-#{version}.gem
)
end
def version
DeckoGem.decko_version
end