Soc/bin/setup

34 lines
619 B
Ruby
Executable File

#!/usr/bin/env ruby
def setup
log "Installing gems…"
system!("bundle check || bundle install")
log "Dropping, creating and seeding development database…"
system!("RAILS_ENV=development bin/rails db:seed:replant")
log "Dropping, creating and seeding test database…"
system!("RAILS_ENV=test bin/rails db:reset")
log "Loading fixtures…"
system!("bin/rails db:fixtures:load")
end
def log(message)
puts "[ bin/setup ] #{message}"
end
def system!(*args)
log "Executing #{args}"
if system(*args)
log "…success!"
else
log "…failed"
abort
end
end
setup
# vi:syntax=ruby