A Rails Engine framework that helps safe and rapid feature prototyping
A Rails Engine framework that helps safe and rapid feature prototyping
Motorhead is a prototyping framework for Rails. It's something akin to "feature toggle". It can be used for "A/B testing" as well. But essentially, the main purpose of this framework is to provide a way to rapidly and safely deliver new features to the production environment.
Bundle into your Rails app.
Motorhead helps you mounting specially creafted Isolated Engines onto the main Rails app. An engine can contain whole MVC components, which means that you can encapsulate everything that are needed for your new feature under one single directory. This helps your team creating multiple new features simultaneously without causing code conflict.
Each Motorhead engine can be configured to be enabled/disabled. The condition is not just a flag but can be a Ruby Proc which will be dynamically evaluated on each request in the controller context.
If any RuntimeError happens inside an engine on the production environment, Motorhead absorbs the error and executes the appropriate fallback code so that the end users would never even notice the occurrence of the error.
Motorhead provides an interface to override the main app's controller actions.
Motorhead provides a hook to partially overwrite any part of your existing view.
main_app
├── Gemfile
├── Gemfile.lock
├── Rakefile
├── app
│ ├── assets
│ ├── controllers
│ ├── engines
│ │ ├── my_awesome_new_feature
│ │ │ ├── app
│ │ │ │ ├── assets
│ │ │ │ ├── controllers
│ │ │ │ │ └── my_awesome_new_feature
│ │ │ │ │ └── welcome_controller.rb
│ │ │ │ ├── helpers
│ │ │ │ │ └── my_awesome_new_feature
│ │ │ │ │ └── welcome_helper.rb
│ │ │ │ ├── mailers
│ │ │ │ ├── models
│ │ │ │ └── views
│ │ │ │ ├── layouts
│ │ │ │ │ └── my_awesome_new_feature
│ │ │ │ │ └── application.html.erb
│ │ │ │ └── my_awesome_new_feature
│ │ │ │ └── welcome
│ │ │ ├── config
│ │ │ │ └── routes.rb
│ │ │ ├── lib
│ │ │ │ ├── my_awesome_new_feature
│ │ │ │ │ └── engine.rb
│ │ │ │ ├── my_awesome_new_feature.rb
│ │ │ │ └── tasks
│ │ │ ├── my_awesome_new_feature.gemspec
│ │ │ └── test
│ │ └── yet_another_new_feature
│ │ ├── app
│ │ ...
│ ├── helpers
│ ├── mailers
│ ├── models
│ └── views
├── bin
├── config
├── db
...Put active_if directive inside the Engine class. The whole engine will only be executed if the block is evaluated to be truthy on runtime.
Example:
# app/engines/my_awesome_new_feature/config/routes.rb
module MyAwesomeNewFeature
class Engine You might also want to configure the RoadCrew Engine's active_if directive for security.
# config/initializers/mh_road_crew.rb
RoadCrew::Engine.active_if { current_user.admin? }Pull requests are welcome on GitHub at https://github.com/amatsuda/motorhead.
Better generator
Model extension
Documentation
This product is deeply inspired by Chanko.
The gem is available as open source under the terms of the MIT License.
No open issues yet, or sync has not completed.