This is the Rails app that powers RubyMem.com: A website to submit new reports about gems which have memory leaks. Also, a nice way to browse existing memory leak advisories.
Requires the Ruby version in .ruby-version.sample, and Postgres.
./bin/setup
Setup steps will take care of this. If you want to reset your database, you can remove all records from the database and then call:
# ./bin/rails console
RubymemImporter.new.import!Submitting an advisory is a two step flow, and previewing deliberately stores nothing: the preview page invites the submitter to revise the generated YAML, or to skip the site and open the pull request against the advisory database themselves.
| request | valid | invalid |
|---|---|---|
GET /advisories/new |
the form | |
POST /advisories/preview |
the generated YAML plus a "Submit for review" button | back to the form with the errors, 422 |
POST /advisories |
stores the advisory, notifies the reviewers, redirects | back to the preview with the errors, 422 |
GET /advisories/thanks |
the thank-you page, safe to refresh |
Notes for anyone changing this:
- Only
createwrites.previewbuilds an unsavedRubymemAdvisoryso it can validate and render the YAML, and never touches the database. createredirects rather than renders, so refreshing cannot submit twice.- The submit buttons carry
disable_with: falseon purpose. A page that comes back with errors has to let the submitter fix a field and submit again from that same page. - The form is bound to
AdvisoryPresenter, not to the record, so the params arrive underadvisory_presenterand the line separated version fields are split inAdvisoriesController#processed_params. - A submission is stored with
imported: falseand noidentifier, so it stays off the archive and out of the feed until a reviewer merges it into the advisory database andRubymemImporterpicks it up.
After making changes, make sure you run the test suite:
bin/rails test
bin/rails test:system
The system tests drive the app through Capybara's rack_test driver, so they
need no browser or driver binaries.
CI runs both commands against Postgres, once per
boot: Gemfile and Gemfile.next. To run the suite against the next boot
locally:
BUNDLE_GEMFILE=Gemfile.next bin/rails test
New issues and pull requests are welcome. Read our CODE_OF_CONDUCT.md before submitting an issue or pull request. Thank you! ❤️
rubymem.com is maintained and funded by FastRuby.io, inc. The names and logos for FastRuby.io are trademarks of FastRuby.io, inc.
