-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
36 lines (28 loc) · 907 Bytes
/
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
# frozen_string_literal: true
IMAGE = 'chillum/liquibase'
LB_VER = '3.10.3'
LB_TAR = "liquibase-#{LB_VER}.tar.gz"
JDBC_VER = '42.2.18'
JDBC = "postgresql-#{JDBC_VER}.jar"
require 'open-uri'
task default: :build
desc "Build Docker image: #{IMAGE}:#{LB_VER}"
task build: :download do
sh "docker build -t #{IMAGE} ."
sh "docker tag #{IMAGE} #{IMAGE}:#{LB_VER}"
end
def download(url)
file = File.basename(url)
return if File.exist?(file)
puts "Downloading #{file}"
IO.copy_stream(URI.open(url), file)
end
desc "Download #{LB_TAR} and #{JDBC}"
task :download do
download "https://github.com/liquibase/liquibase/releases/download/v#{LB_VER}/#{LB_TAR}"
download "https://jdbc.postgresql.org/download/#{JDBC}"
end
desc 'Clean up working directory (use this if you switch Liquibase or JDBC driver versions)'
task :clean do
Dir.glob('*.{jar,tar.gz}').each { |file| rm(file) }
end