Workflow

Start/stop server

rails s # start server
# Ctrl + c (stop server)

Refresh database (manual)

# stop running server, if running
rails db:drop
rails db:create
rails db:migrate
rails db:seed

Refresh database (automatic)

# stop running server, if running
rails db:f # refresh (runs drop/create/migrate/seed)
rails db:fs # refresh & start server

Run weather jobs

# normally, use this one (per-project basis)
rails c # rails console
p = Project.find_by(id: 1) # change id to desired project id
rails runner WeatherLogLastHourJob.perform_now(p) # backfills data to current time
rails runner WeatherLogPredictiveJob.perform_now(p)

# only run the following if you want to perform this for all existing projects
rails runner WeatherLogLastHourJob.perform_now
rails runner WeatherLogPredictiveJob.perform_now

# get out of rails console
# ctrl + z

# NOTE: may need to exit this terminal completely if you try to refresh database
# and it says something is still accessing it, so you can't

Run rubocop (formatter) (may fix PR build fails)

rubocop -a

Run tests

rails t test/controllers/api/v2 # all v2 tests
rails t test/controllers/api/v2/x_controller_test.rb # specific v2 test
rails t test/controllers/api/v2/x_controller_test.rb:80 #specific line (any line inside the "it" block)

Getting a lot of real weather data on develop or staging to test out weatherLog-related UI

"when I want to test with real data, I create a project with a start date of ~1 month ago. it will backfill weather from there (you can do that on develop also)" - Steven

Last updated