• Stars
    star
    1,643
  • Rank 28,446 (Top 0.6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Real World Rails applications and their open source codebases for developers to learn from

Real World Rails

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 and engines 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 in the apps/ and engines/ subdirectories.

Real World Rails was begun to help teach newer developers and to research and write about Rails development practices:

  • 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
  • See how Rails engines are built
  • โ€ฆ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

How to install on your computer

# Clone this git repo:
git clone [email protected]:eliotsykes/real-world-rails.git

cd real-world-rails/

# The Rails apps are linked to as git submodules.
# This will take some time...(see comment below for possible speedup)
git submodule update --init

# OR If you've got git 2.9+ installed try to run updates in parallel:
# git submodule update --init --jobs 4

# To run the `bin/rwr` inspectors, install gems:
bundle install

echo "All done! Why not run some inspections? Run bin/rwr"

Other Real World Codebase Collections

How you can analyze Real World Rails apps

Find job subclasses

This will find most, but not all job subclasses (requires ag):

# Outputs jobs source in terminal
ag --ruby '< [A-Za-z]+Job\b'

# Open each job in your editor (e.g. atom)
ag --ruby -l '< [A-Za-z]+Job\b' | xargs atom

(used to research Real World Rails Background Jobs)

List models from every Real World Rails application

Interested in seeing how your fellow developers name their models? Run:

bin/rwr models | sort -f | uniq -c | sort -k 1nr -k 2f

Show constants of every Real World Rails app

bin/rwr constants

(this helped when researching Magic Numbers in Ruby & How You Make Them Disappear)

Show view specs

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)

Show model methods

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 projects using gem

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

Analyze view naming practices

bin/rwr shared-view-dirs
bin/rwr view-naming

Find ideas on how to configure your foreman processes

# Outputs contents from all Procfiles
find apps/ -name 'Procfile*' | xargs cat

Settings

Analyzing directories outside of apps/

Prefix the bin/rwr command with the FILES_PATTERN environment variable:

FILES_PATTERN=~/dev/my-rails-app/**/*.rb bin/rwr

Change source output format to markdown

Prefix bin/rwr with the SOURCE_OUTPUT_FORMAT environment variable:

SOURCE_OUTPUT_FORMAT=markdown bin/rwr view-specs

Information for Contributors

How to add a Real World Rails app

Given a GitHub repo for a Rails app githubuser/foo:

# Inside real-world-rails root:
git submodule add -b master [email protected]:githubuser/foo.git apps/foo

Regenerate repos.md:

# Requires valid GITHUB_ACCESS_TOKEN
bin/get_project_data > repos.md

# OR, if GitHub GraphQL API v4 schema has changed, update cached copy of schema:
FETCH_LATEST_SCHEMA=true bin/get_project_data > repos.md

Updating the Rails apps submodules to latest

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

How to remove a git submodule

Only use this if a previously public repo has been removed:

# Remove the submodule from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule from .git/modules
rm -rf .git/modules/path/to/submodule

# Remove from .gitmodules and remove the submodule directory
git rm -f path/to/submodule

Writing an Inspector? Some docs to help understand AST, Parserโ€ฆ

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:


Contributors

  • 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.

More Repositories

1

rspec-rails-examples

RSpec cheatsheet & Rails app: Learn how to expertly test Rails apps from a model codebase
Ruby
2,150
star
2

rails-security-checklist

๐Ÿ”‘ Community-driven Rails Security Checklist (see our GitHub Issues for the newest checks that aren't yet in the README)
Ruby
1,332
star
3

rack-zippy

Rack middleware for serving gzip files
Ruby
160
star
4

rails-testing-toolbox

๐Ÿ”ง Tools to help Rails developers test
Ruby
127
star
5

asset_fingerprint

Asset Fingerprint Plugin for Ruby on Rails - allows you to use md5 or timestamps in query string or in asset filenames as suggested by Google Page Speed
Ruby
99
star
6

awesome-challenges

Sharpen skills & prepare for interview. Includes puzzles, kata, algorithm & data structure exercises
37
star
7

monitorstxt

monitors.txt - lazy web app monitoring, see http://monitorstxt.org and http://monitorstxt.org/monitors.txt
31
star
8

spree-zoom-photos

Lightbox+Zoom product photos for your Spree store
JavaScript
27
star
9

page_cache

Holeless page caching plugin for Rails. Users never have to wait for cached pages to be generated (unlike the page caching that ships with Rails).
Ruby
26
star
10

rails-code-review

An evolving set of guidelines & supporting reasons to consider when code reviewing Ruby on Rails apps
21
star
11

rails-static-router

Enjoy static routes in your Rails config/routes.rb
Ruby
18
star
12

real-world-ember

Use the source: Read & learn from Real World Ember apps
17
star
13

rspec-katas

A friendly place for RSpec-driven Kata to gather and teach those wanting to learn the ways of RSpec.
Ruby
16
star
14

spree-single-product-urls

Extension for Spree to give each product a single URL to minimize duplicate content issues. Behaves like Amazon's "Look for similar items in these categories" product page section.
Ruby
13
star
15

spree-redirects

An extension for managing redirects within Spree
Ruby
10
star
16

spree-titles

Replaces the general Spree title with accurate titles.
Ruby
10
star
17

spree-db-tools

An extension to add a few useful Spree-related database rake tasks.
Ruby
9
star
18

less-css-jawr

Less CSS for JAWR
Java
7
star
19

spring-site-scope

Sample code to show how a site scope in Spring might work.
Java
6
star
20

6-minute-backups

Simple ruby script for securely backing up directories and mysql databases
Ruby
6
star
21

spree-i18n-db

Spree extension to override YAML translations with translations stored in the database.
Ruby
5
star
22

spree-products-page-remover

Extension for removing the /products page in Spree. Helps avoid duplicate content issues between home page and /products.
Ruby
5
star
23

acts_as_geocodable_extra

Some personal changes I needed to acts_as_geocodable - see the original project at the homepage url below
Ruby
4
star
24

rails-testing-cheatsheet

๐ŸšŒ Community-driven Rails Testing Cheatsheet. Contributions welcome!
4
star
25

rails-activerecord-aerobics

[UNMAINTAINED] Boost your Rails ActiveRecord Query core fitness with this workout plan. A+ abs or your money back.
Ruby
3
star
26

rails-console-cheatsheet

Rails console cheatsheet ๐Ÿ“ โ˜บ๏ธ
2
star
27

debugging-rails

๐Ÿ› Tips & links for debugging Ruby and Ruby on Rails
2
star
28

ruby-data-structures

Ruby Data Structures
2
star
29

gordonflash

Gordon Flash Grails plugin protects flash scope from being cleared out unnecessarily
Groovy
1
star
30

tools

Handy Script Collection (for Rubyists)
Shell
1
star
31

gz-compare

Compare compression file sizes for gzip with Zopfli
Ruby
1
star
32

asset_fingerprint_tester

Rails app exists purely for testing the Asset Fingerprint plugin - you probably don't want this
Ruby
1
star
33

gitbook-plugin-markrundown

Write runnable markdown documents, with superpowers for technical authors
JavaScript
1
star
34

rails-troubleshooter

Troubleshoot common Ruby on Rails issues
1
star