Soc/bin/setup

37 lines
700 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env ruby
2024-03-07 09:14:06 +00:00
def setup
log "Installing gems…"
system!("bundle check || bundle install")
2024-03-07 09:14:06 +00:00
log "Dropping, creating and seeding development database…"
2024-03-17 11:51:26 +00:00
system!("RAILS_ENV=development bin/rails db:reset")
2024-03-07 09:14:06 +00:00
log "Dropping, creating and seeding test database…"
system!("RAILS_ENV=test bin/rails db:reset")
2024-03-07 09:14:06 +00:00
log "Loading fixtures…"
system!("bin/rails db:fixtures:load")
2024-08-08 10:35:36 +00:00
log "Removing old logs and temp files…"
system!("bin/rails log:clear tmp:clear")
2024-03-07 09:14:06 +00:00
end
2024-03-07 09:14:06 +00:00
def log(message)
puts "[ bin/setup ] #{message}"
end
2024-03-07 09:14:06 +00:00
def system!(*args)
log "Executing #{args}"
if system(*args)
log "…success!"
else
log "…failed"
abort
end
end
2024-03-07 09:14:06 +00:00
setup
2024-03-07 09:14:06 +00:00
# vi:syntax=ruby