frankfurter/deploy/before_restart

17 lines
475 B
Plaintext
Raw Normal View History

2015-03-09 12:25:11 +01:00
#!/usr/bin/env ruby
oldrev, newrev = ARGV
def run(cmd)
2016-04-11 15:14:10 +02:00
exit($CHILD_STATUS.exitstatus) unless system "umask 002 && #{cmd}"
2015-03-09 12:25:11 +01:00
end
2016-04-11 15:14:10 +02:00
run 'foreman run bundle install --deployment --without development:test'
run 'whenever --update-crontab'
2015-03-09 12:25:11 +01:00
tasks = []
num_migrations = `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z db/migrate`.split("\0").size
2016-04-11 15:14:10 +02:00
tasks << 'db:migrate' if num_migrations > 0
2016-04-11 15:18:39 +02:00
tasks << 'rates:load'
2015-03-09 12:25:11 +01:00
2016-04-11 15:18:39 +02:00
run "foreman run bundle exec rake #{tasks.join(' ')}"