-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRakefile.rb
More file actions
66 lines (56 loc) · 1.81 KB
/
Copy pathRakefile.rb
File metadata and controls
66 lines (56 loc) · 1.81 KB
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
# encoding: utf-8
require 'rubygems'
require 'pp'
require 'json'
require 'yaml'
require 'active_support'
require 'active_support/core_ext'
if Process.euid > 0
begin
require 'bundler'
rescue LoadError
$stderr.puts "Bundler could not be loaded. Please make sure to run ./scripts/bootstrap"
exit(1)
end
Bundler.setup if defined?(Bundler)
end
# The top of the repository checkout
ROOT = File.expand_path("..", __FILE__)
STATEDIR = File.expand_path("../baremetal-state", ROOT)
PRIVATE_SSH_KEY = File.expand_path("support/id_rsa", STATEDIR)
CONFIG_FILES = [
File.join(ROOT, 'defaults.yml'),
File.join(STATEDIR, 'config.yml'),
]
$conf = {}
CONFIG_FILES.each do |config_yml|
$conf.deep_merge!(YAML.load_file(config_yml).deep_symbolize_keys) if File.exist?(config_yml)
end
# make rake more silent
RakeFileUtils.verbose_flag = false
# support files
Dir[ File.join(File.dirname(__FILE__), 'tasks', 'support', '*.rb') ].sort.each do |f|
require f
end
# tasks
Dir[ File.join(File.dirname(__FILE__), 'tasks', '*.rake') ].sort.each do |f|
load f
end
sh "tmux new-session -d -s 'baremetal' 2>/dev/null|| true"
task :default do
puts "baremetal cloud"
puts "---------------"
puts "ROOT=#{ROOT}"
puts "CONFIG_FILES"
CONFIG_FILES.each do |config_yml|
puts " #{config_yml}: #{File.exist?(config_yml)}"
end
puts "STATEDIR=#{STATEDIR}: #{File.directory?(STATEDIR)}"
puts "PRIVATE_SSH_KEY=#{PRIVATE_SSH_KEY}: #{File.exist?(PRIVATE_SSH_KEY)}"
puts
puts "Hetzner account configured: #{!!$conf[:hetzner]}"
puts "OVH account configured: #{!!$conf[:ovh]}"
puts "Soyoustart account configured: #{!!$conf[:soyoustart]}"
puts "Servers.com account configured: #{!!$conf[:serverscom]}"
puts "Leaseweb accounts configured: #{($conf[:leaseweb] && $conf[:leaseweb].keys.join(', ')) || "none"}"
end