2012-01-23 17:05:03 -05:00
|
|
|
#!/usr/bin/env rake
|
|
|
|
|
2016-11-18 17:33:50 -05:00
|
|
|
task :appraise do
|
|
|
|
failed = false
|
2012-01-23 17:05:03 -05:00
|
|
|
|
2016-11-18 17:33:50 -05:00
|
|
|
%w(4 5).each do |ver|
|
|
|
|
%w(production development).each do |env|
|
|
|
|
output = `bundle exec ruby integration_setup.rb`
|
|
|
|
if output.strip != ''
|
|
|
|
puts output
|
|
|
|
exit(-1)
|
|
|
|
end
|
2013-04-26 12:00:03 -04:00
|
|
|
|
2016-11-18 17:33:50 -05:00
|
|
|
rout, wout = IO.pipe
|
|
|
|
rerr, werr = IO.pipe
|
2013-04-26 12:00:03 -04:00
|
|
|
|
2016-11-18 17:33:50 -05:00
|
|
|
command = "bundle exec sidekiq"
|
|
|
|
pid = Process.spawn({'RAILS_ENV' => env, 'BUNDLE_GEMFILE' => "gemfiles/rails_#{ver}.gemfile"},
|
|
|
|
command, :out => wout, :err => werr)
|
|
|
|
status = nil
|
|
|
|
begin
|
|
|
|
require 'timeout'
|
|
|
|
Timeout.timeout(10) do
|
|
|
|
Process.wait(pid)
|
2016-11-17 17:40:09 -05:00
|
|
|
end
|
2016-11-18 17:33:50 -05:00
|
|
|
rescue Timeout::Error
|
|
|
|
puts "Killing #{pid}"
|
|
|
|
Process.kill('KILL', pid)
|
|
|
|
end
|
|
|
|
status = $?
|
|
|
|
|
|
|
|
# close write ends so we could read them
|
|
|
|
wout.close
|
|
|
|
werr.close
|
|
|
|
|
|
|
|
stdout = rout.readlines
|
|
|
|
stderr = rerr.readlines
|
|
|
|
|
|
|
|
# dispose the read ends of the pipes
|
|
|
|
rout.close
|
|
|
|
rerr.close
|
|
|
|
|
|
|
|
rc = status.exitstatus
|
|
|
|
success = stdout.grep(/Success/).size == 3
|
|
|
|
if success
|
|
|
|
puts "#{ver}/#{env} success, #{pid}/#{rc}/#{success}"
|
|
|
|
else
|
|
|
|
puts stdout.join
|
|
|
|
puts stderr.join if stderr.size > 0
|
|
|
|
puts "#{ver}/#{env} failed, #{pid}/#{rc}/#{success}"
|
|
|
|
failed = true
|
|
|
|
end
|
2016-11-17 17:40:09 -05:00
|
|
|
end
|
2013-04-26 12:00:03 -04:00
|
|
|
end
|
2016-11-18 17:33:50 -05:00
|
|
|
exit(failed ? -1 : 0)
|
2016-11-17 17:40:09 -05:00
|
|
|
end
|
2016-11-22 12:32:36 -05:00
|
|
|
|
|
|
|
task :default => :appraise
|