Rakefile
1.11 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
$SPB_ENV = ENV.fetch('SPB_ENV', 'development')
ssh_config_file = "config/#{$SPB_ENV}/ssh_config"
ips_file = "config/#{$SPB_ENV}/ips.yaml"
config_file = "config/#{$SPB_ENV}/config.yaml"
ENV['CHAKE_SSH_CONFIG'] = ssh_config_file
require 'chake'
if Chake::VERSION < '0.4'
fail "Please upgrade to chake 0.4+"
end
begin
load 'local.rake'
rescue LoadError
# nothing
end
config = YAML.load_file(config_file)
ips = YAML.load_file(ips_file)
$nodes.each do |node|
node.data['config'] = config
node.data['peers'] = ips
end
task :console do
require 'pry'
binding.pry
end
task :test do
sh './test/run_all'
end
task :default => :test
file 'ssh_config.erb'
file 'config/development/ssh_config' => ['nodes.yaml', 'config/development/ips.yaml', 'ssh_config.erb'] do |t|
require 'erb'
template = ERB.new(File.read('ssh_config.erb'))
File.open(t.name, 'w') do |f|
f.write(template.result(binding))
end
puts 'ERB %s' % t.name
end
task :bootstrap_common => 'config/development/ssh_config'
unless ENV['nodeps']
task 'converge:integration' => 'converge:database'
task 'converge:social' => 'converge:database'
end