Real World Rails applications and their open source codebases for developers to learn from
This project brings 100+ (and growing) active, open source Rails apps together in one repository, making it easier for developers to download the collected codebases and learn from Rails apps written by experienced developers. Reading open source code can be an invaluable learning aid. You’ll find the source code for the Real World Rails apps in the apps/
subdirectory.
Real World Rails was begun to help teach newer developers and to research and write about Rails development practices.
Browse & search the Rails codebases to:
- Find example usage of a method you’re unsure of
- Learn how other developers use a gem you’d like to use
- Discover how to write tests
- …and much, much more.
If you've got an idea for something that'd be interesting or fun to find out about these Real World Rails apps, contribute your idea on the issue tracker — Eliot Sykes
# Clone this git repo:
git clone git@github.com:eliotsykes/real-world-rails.git
cd real-world-rails/
# The Rails apps are linked to as git submodules.
# This will take some time...
git submodule update --init
# To run the `bin/rwr` inspectors, install gems:
bundle install
echo "All done! Why not run some inspections? Run bin/rwr"
Interested in seeing how your fellow developers name their models? Run:
bin/rwr models | sort -f | uniq -c | sort -k 1nr -k 2f
bin/rwr constants
(this helped when researching Magic Numbers in Ruby & How You Make Them Disappear)
See the file path and source of every view spec in every app:
bin/rwr view-specs
(this will show 250+ view specs, see them in The Big List of View Specs)
See just the model method names and file paths:
bin/rwr model-method-names
See the model method source and file paths:
bin/rwr model-methods
find apps/ -name Gemfile.lock | xargs grep GEM_NAME_GOES_HERE
# e.g. Find all projects using doorkeeper gem
find apps/ -name Gemfile.lock | xargs grep doorkeeper
bin/rwr shared-view-dirs
bin/rwr view-naming
Prefix the bin/rwr
command with the FILES_PATTERN
environment variable:
FILES_PATTERN=~/dev/my-rails-app/**/*.rb bin/rwr
Prefix bin/rwr
with the SOURCE_OUTPUT_FORMAT
environment variable:
SOURCE_OUTPUT_FORMAT=markdown bin/rwr view-specs
Given a GitHub repo for a Rails app githubuser/foo
:
# Inside real-world-rails root:
git submodule add -b master git@github.com:githubuser/foo.git apps/foo
The Rails apps in apps/
are git submodules. Git submodules are locked to a revision and don't stay in sync with the latest revision.
To update the revisions, run:
# This will take some time:
git submodule foreach git pull
The inspectors are responsible for the analysis of the Rails apps.
Review the existing inspectors if you're looking for some info on how to write a new one, and see these API docs:
- http://whitequark.github.io/ast/AST/Node.html
- http://www.rubydoc.info/github/whitequark/parser/master/Parser/AST/Processor
- http://whitequark.github.io/ast/AST/Processor.html
- Eliot Sykes https://eliotsykes.com/
- Contributions are welcome, fork the GitHub repo, make your changes, then submit your pull request! Reach out if you'd like some help.