2023-08-08 16:48:09 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
def setup
|
|
|
|
log "Installing gems…"
|
|
|
|
system!("bundle check || bundle install")
|
2023-08-08 16:48:09 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
log "Dropping, creating and seeding development database…"
|
|
|
|
system!("RAILS_ENV=development bin/rails db:seed:replant")
|
2023-08-08 16:48:09 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
log "Dropping, creating and seeding test database…"
|
|
|
|
system!("RAILS_ENV=test bin/rails db:reset")
|
2023-09-29 14:53:32 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
log "Loading fixtures…"
|
|
|
|
system!("bin/rails db:fixtures:load")
|
|
|
|
end
|
2023-08-08 16:48:09 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
def log(message)
|
|
|
|
puts "[ bin/setup ] #{message}"
|
|
|
|
end
|
2023-09-29 14:53:32 +00:00
|
|
|
|
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
|
2023-08-08 16:48:09 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
setup
|
2023-08-08 16:48:09 +00:00
|
|
|
|
2024-03-07 09:14:06 +00:00
|
|
|
# vi:syntax=ruby
|