Soc/bin/setup

34 lines
612 B
Plaintext
Raw 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")
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