-
Notifications
You must be signed in to change notification settings - Fork 1
/
bulk-generate.rb
executable file
·41 lines (37 loc) · 2.03 KB
/
bulk-generate.rb
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
#!/usr/bin/env ruby
require 'date'
RELEASE_VERSION = ARGV[0]
OS_VERSIONS = %w(20.04 22.04 24.04)
NGINX_VERSIONS = %w(1.24.0)
PASSENGER_VERSIONS = %w(6.0.23)
raise "Must provide release number as first argument" if RELEASE_VERSION.nil?
def build_and_extract(os_version, nginx_version, passenger_version, release_version)
puts "#{DateTime.now} - COMPILING & EXTRACTING [OS:#{os_version}] [NGINX:#{nginx_version}] [PASSENGER:#{passenger_version}] [RELEASE:#{release_version}]"
expected_filenames = [
"#{Dir.pwd}/output/binaries/ubuntu-#{os_version}-nginx-#{release_version}.tar.gz",
]
expected_filenames << "#{Dir.pwd}/output/binaries/ubuntu-#{os_version}-passenger-enterprise-#{release_version}.tar.gz" if include_passenger_enterprise?(passenger_version)
if expected_filenames.all? { |expected_filename| File.exist?(expected_filename) }
puts " #{DateTime.now} - DONE"
else
puts " #{DateTime.now} - COMPILING"
success = system("./compile_nginx.sh #{os_version} #{nginx_version} #{passenger_version} #{release_version}")
raise "Failed to compile [OS:#{os_version}] [NGINX:#{nginx_version}] [PASSENGER:#{passenger_version}] [RELEASE:#{release_version}]" unless success
puts " #{DateTime.now} - EXTRACTING"
success = system("./extract_nginx.sh #{os_version} #{nginx_version} #{passenger_version} #{release_version}")
raise "Failed to extract [OS:#{os_version}] [NGINX:#{nginx_version}] [PASSENGER:#{passenger_version}] [RELEASE:#{release_version}]" unless success
puts " #{DateTime.now} - DONE"
end
end
def include_passenger_enterprise?(passenger_version)
return File.exist?("passenger_enterprise/passenger-enterprise-license") && File.exist?("passenger_enterprise/passenger-enterprise-server-#{passenger_version}.tar.gz")
end
puts "#{DateTime.now} - STARTING"
OS_VERSIONS.each do |os_version|
NGINX_VERSIONS.each do |nginx_version|
PASSENGER_VERSIONS.each do |passenger_version|
build_and_extract(os_version, nginx_version, passenger_version, RELEASE_VERSION)
end
end
end
puts "#{DateTime.now} - COMPLETE"