Skip to content

Helpful Commands

Shen Yang edited this page Oct 24, 2023 · 50 revisions

Table of Contents generated with DocToc

Terminal Commands

Open the Rails Console

  rails c

Start the App Locally

  rails s

List All Website Routes

  rails routes

Run Afterparty Tasks

  rake after_party:run

Reset Your Test Database

  rake db:reset && rake after_party:run

Open the Rails Console in the Production Environment(requires heroku access)

  heroku run rails c --app casa-production

Truncate database and reseed(requires heroku access)

  heroku run "DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rails db:seed:replant --trace" --app casa-qa in QA
  heroku run "DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rails db:seed:replant --trace" --app casa-r4g-staging in Staging

Run All Tests in a File or All Tests in a Directory

  bundle exec rpsec <PATH>

run cypress tests
bundle exec rails server -b 0.0.0.0 -p 4040
npm run test:cypress --exit-code 0

Javascript

Run jest tests

  yarn test

Lint

  yarn lint show linting errors
  yarn lint:fix try to automatically fix as many linting errors as possible

Rails Console Commands

Send a supervisor weekly digest email(opens in new tab)

  SupervisorMailer.weekly_digest(Supervisor.first).deliver_now

Delete all active storage attachments

  ActiveStorage::Attachment.all.each { |attachment| attachment.purge }

Set the court report template for a casa_org

  casa_org.court_report_template.attach(io: File.new(PATH TO DOCUMENT), filename: "document.docx")

Features

Additional Expenses

  FeatureFlagService.enable!("show_additional_expenses") enable
  FeatureFlagService.disable!("show_additional_expenses") disable

URLs

http://localhost:3000/rails/mailers An index of examples of every type of email

Clone this wiki locally