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…"
|
2024-03-17 11:51:26 +00:00
|
|
|
system!("RAILS_ENV=development bin/rails db:reset")
|
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")
|
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
|
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
|