forked from NUBIC/surveyor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hudson.rakefile
33 lines (30 loc) · 1.2 KB
/
hudson.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
BUNDLER_VERSION="1.0.7"
import 'init_testbed.rakefile'
namespace :bundle do
task :ensure_bundler_available do
`gem list -i bundler -v '=#{BUNDLER_VERSION}'`
unless $? == 0
puts bordered_message("Installing bundler #{BUNDLER_VERSION}")
system("gem install bundler -v '=#{BUNDLER_VERSION}' --no-ri --no-rdoc")
unless $? == 0
fail bordered_message("Install failed.\nPlease fix the problem and try again or manually install bundler #{BUNDLER_VERSION}.")
end
end
end
def bordered_message(msg)
len = msg.split("\n").collect { |l| l.size }.max
['=' * len, msg, '=' * len].join("\n")
end
end
namespace :ci do
task :generate_testbed_for_hudson => [:'testbed:remove', :'testbed:generate'] do
# Hudson
chdir("testbed") do
database_yml = File.read('config/database.yml') + "\n\nhudson:\n <<: *test\n"
File.open('config/database.yml', 'w'){|f| f.write database_yml}
sh "cp config/environments/cucumber.rb config/environments/hudson.rb"
end
end
task :setup_testbed_for_hudson => [:'testbed:setup', :'testbed:migrate']
end
task :default => [:'bundle:ensure_bundler_available', :'ci:generate_testbed_for_hudson', :'ci:setup_testbed_for_hudson']