= Desert Desert is a component framework for Rails that allows you to seamlessly define in your plugins: * Models * Controllers * Views * Helpers * Routes * Migrations * Plugin Dependencies Classes are automatically mixed in with your own or other plugins' classes. This allows you to make full featured composable components. Desert is a replacement for Appable Plugins (http://wiki.pluginaweek.org/Appable_plugins). == Using desert To use Desert, you need to do only a few things: * require 'desert' before Rails::Initializer.run in environment.rb environment.rb require 'desert' Rails::Initializer.run do end * Install your desert plugin routes in routes.rb map.routes_from_plugin(:spiffy) == Example Say you want to create a plugin named acts_as_spiffy. Desert allows Spiffy to have a set of features that can be reused and extended in several projects. The Spiffy project has a: * SpiffyController * Spiffy model * SpiffyHelper * spiffy.rhtml * SpiffyLib library class The Spiffy plugin acts as its own mini Rails application. Here is the directory structure: RAILS_ROOT/vendor/plugins/spiffy/app/controllers/spiffy_controller.rb RAILS_ROOT/vendor/plugins/spiffy/app/models/spiffy.rb RAILS_ROOT/vendor/plugins/spiffy/app/helpers/spiffy_helper.rb RAILS_ROOT/vendor/plugins/spiffy/app/views/spiffy/spiffy.rhtml RAILS_ROOT/vendor/plugins/spiffy/lib/spiffy_lib.rb Now, say there is a Spiffy Store rails application that uses acts_as_spiffy. The Rails app can open up any of the Spiffy classes and override any of the methods. Say spiffy.rb in the Spiffy plugin is defined as: class Spiffy < ActiveRecord::Base def why? "I just am Spiffy" end end The Spiffy#why method can be overridden in RAILS_ROOT/app/models/spiffy.rb class Spiffy < ActiveRecord::Base def why? "I sell Spiffy stuff" end end == Running plugin tests You can run your plugin tests/specs like so: rake desert:testspec:plugins PLUGIN=spiffy Leaving off the PLUGIN environment variable will cause it to run all the test/specs for all installed plugins, which may not be what you want. == Running Desert tests Desert is a library that heavily monkey patches Rails. To ensure that Desert works with multiple versions of Rails, its tests are run against the supported versions of Rails. To set up the different supported versions of Rails, run `rake install_dependencies`. This will clone the Rails git repo and export the supported versions of rails into the respective directories. `rake update_dependencies` will update the clones repo on your machine.