Skip to content

Repository files navigation

CI

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.

Setup

Requires the Ruby version in .ruby-version.sample, and Postgres.

./bin/setup

Seed

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!

Advisory submission flow

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 create writes. preview builds an unsaved RubymemAdvisory so it can validate and render the YAML, and never touches the database.
  • create redirects rather than renders, so refreshing cannot submit twice.
  • The submit buttons carry disable_with: false on 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 under advisory_presenter and the line separated version fields are split in AdvisoriesController#processed_params.
  • A submission is stored with imported: false and no identifier, so it stays off the archive and out of the feed until a reviewer merges it into the advisory database and RubymemImporter picks it up.

Testing

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

Collaboration

New issues and pull requests are welcome. Read our CODE_OF_CONDUCT.md before submitting an issue or pull request. Thank you! ❤️

FastRuby.io

fastruby rubymem.com is maintained and funded by FastRuby.io, inc. The names and logos for FastRuby.io are trademarks of FastRuby.io, inc.

About

Source Code for a Rails application to report Ruby gems that are known to have memory leaks.

Topics

Resources

Code of conduct

Stars

8 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages