-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
52 lines (45 loc) · 1.18 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
# -*- ruby -*-
version_key = "CHUPA_TEXT_DOCKER_VERSION"
dockerfile_paths = [
"chupa-text/ubuntu/Dockerfile",
"chupa-text/debian/Dockerfile",
]
dockerfile_content = File.read(dockerfile_paths[0])
/#{version_key}=(.+?)$/ =~ dockerfile_content
version = $1
task :default => :run
desc "Build images"
task :build do
sh("docker-compose", "build", "proxy")
sh("docker-compose", "build", "chupa-text")
end
desc "Run"
task :run => :build do
sh("docker-compose", "up")
end
namespace :version do
desc "Bump version"
task :bump do
new_version = ENV["VERSION"]
raise "No ENV['VERSION']" if new_version.nil?
dockerfile_paths.each do |dockerfile_path|
dockerfile_content = File.read(dockerfile_path)
new_dockerfile_content =
dockerfile_content
.gsub(/#{version_key}=.+?$/,
"#{version_key}=#{new_version}")
File.open(dockerfile_path, "w") do |dockerfile|
dockerfile.print(new_dockerfile_content)
end
end
end
end
desc "Tag #{version}"
task :tag do
sh("git", "tag",
"-a", version,
"-m", "#{version} has been released!!!")
sh("git", "push", "--tags")
end
desc "Release #{version}"
task :release => :tag