-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathRakefile
86 lines (73 loc) · 2.87 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
76
77
78
79
80
81
82
83
84
85
require 'bundler/setup'
require 'rake'
require 'rspec/core/rake_task'
task :default => "minimum2scp:all"
namespace :minimum2scp do
desc 'create all images'
task :all => [:debian]
desc 'build minimum2scp/debian image'
task :debian do
tag = ->(env, default){
env ? (!env.empty? ? "TAG=#{env}" : "") : "TAG=#{default}"
}[ENV['TAG_DEBIAN'], 'minimum2scp/debian:latest']
env = ENV.select{|k,v| %w[http_proxy].include?(k)}.map{|k,v| "#{k}=#{v}"}.join(" ")
sh "cd debian && rake clobber mkimage README.md #{tag} #{env}"
end
desc 'build minimum2scp/debian-bookworm image'
task :debian_bookworm do
tag = ->(env, default){
env ? (!env.empty? ? "TAG=#{env}" : "") : "TAG=#{default}"
}[ENV['TAG_DEBIAN'], 'minimum2scp/debian-bookworm:latest']
env = ENV.select{|k,v| %w[http_proxy].include?(k)}.map{|k,v| "#{k}=#{v}"}.join(" ")
sh "cd debian-bookworm && rake clobber mkimage README.md #{tag} #{env}"
end
desc 'build minimum2scp/debian-bullseye image'
task :debian_bullseye do
tag = ->(env, default){
env ? (!env.empty? ? "TAG=#{env}" : "") : "TAG=#{default}"
}[ENV['TAG_DEBIAN'], 'minimum2scp/debian-bullseye:latest']
env = ENV.select{|k,v| %w[http_proxy].include?(k)}.map{|k,v| "#{k}=#{v}"}.join(" ")
sh "cd debian-bullseye && rake clobber mkimage README.md #{tag} #{env}"
end
desc 'build minimum2scp/debian-buster image'
task :debian_buster do
tag = ->(env, default){
env ? (!env.empty? ? "TAG=#{env}" : "") : "TAG=#{default}"
}[ENV['TAG_DEBIAN'], 'minimum2scp/debian-buster:latest']
env = ENV.select{|k,v| %w[http_proxy].include?(k)}.map{|k,v| "#{k}=#{v}"}.join(" ")
sh "cd debian-buster && rake clobber mkimage README.md #{tag} #{env}"
end
desc 'build minimum2scp/debian-stretch image'
task :debian_stretch do
tag = ->(env, default){
env ? (!env.empty? ? "TAG=#{env}" : "") : "TAG=#{default}"
}[ENV['TAG_DEBIAN'], 'minimum2scp/debian-stretch:latest']
env = ENV.select{|k,v| %w[http_proxy].include?(k)}.map{|k,v| "#{k}=#{v}"}.join(" ")
sh "cd debian-stretch && rake clobber mkimage README.md #{tag} #{env}"
end
desc "create deps.svg from deps.dot (visualize dependencies)"
file "deps.svg" => "deps.dot" do
sh "dot -T svg -o deps.svg deps.dot"
end
%w[check-update ci].each do |name|
desc "create .github/workflows/#{name}.yml"
file ".github/workflows/#{name}.yml" => ".github/workflows/#{name}.yml.erb" do |t,args|
sh "erb -T - #{t.prerequisites[0]} > #{t.name}"
end
end
end
namespace :spec do
targets = []
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
targets << File.basename(dir)
end
task :all => targets
task :default => :all
targets.each do |target|
desc "Run serverspec tests to #{target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
t.pattern = "spec/#{target}/*_spec.rb"
end
end
end