rails_module_unification

Ember's module unification brought to Rails.

Build Status Code Climate Test Coverage Dependency Status

What is this about?

With large rails application, the default architecture can result in a resource's related files being very spread out through the overall project structure. For example, lets say you have 50 controllers, serializers, policies, and operations. That's four different top level folders that spread out all the related objects. It makes sense do it this way, as it makes rails' autoloading programmatically easy.

This gem provides a way to re-structure your app so that like-objects are grouped together.

The new structure

app/

Checkout the sample rails app in the tests directory.

Usage

gem 'rails_module_unification'

Including the gem in your gemfile enables the new structure.

Migrating

Each part of your app can be migrated gradually (either manually or automatically).

In order to automatically migrate resources, just run:

rake rmu:migrate_resource[Post]

This will move all unnamespaced classes that contain any of the supported resource suffixes to the app/resources/posts directory.

Configuration

# (Rails.root)/config/initializers/rails_module_unification.rb
RailsModuleUnification.directory = 'pods'

Sets the folder for the new structure to be in the app/pods directory if you want the new structure separate from the main app files.

Contributing

Feel free to open an issue, or fork and make a pull request.

All discussion is welcome :-)