forked from hansmaaherra/wordpress_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
38 lines (30 loc) · 1.03 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
require "bundler/gem_tasks"
require "yard"
require "wordpress_client/version"
YARD::Rake::YardocTask.new
namespace :docker do
DOCKER_DIR = File.expand_path("../spec/docker", __FILE__).freeze
IMAGE_NAME = "hemnet/wordpress_client_test".freeze
DEV_IMAGE = [IMAGE_NAME, "dev"].join(":").freeze
desc "Build the docker image"
task :build do
sh "docker", "build", "-t", DEV_IMAGE, DOCKER_DIR
end
desc "Release current dev build"
task release: :build do
version = prompt "Which version do you want to release"
raise "Invalid version string" unless version =~ /\A[\d.]+\z/
latest = prompt "Do you want this to be the :latest release? [Y/n]"
latest = (latest.empty? || latest.casecmp("y").zero?)
sh "docker", "tag", DEV_IMAGE, "#{IMAGE_NAME}:#{version}"
sh "docker", "push", "#{IMAGE_NAME}:#{version}"
if latest
sh "docker", "tag", DEV_IMAGE, "#{IMAGE_NAME}:latest"
sh "docker", "push", "#{IMAGE_NAME}:latest"
end
end
end
def prompt(message)
print "#{message} > "
STDIN.gets.strip
end