Dream Gens

Brought to you by rubyloves.me

If you enjoy these tools please give me a recommendation at: working with rails!

Please be restful. If you decide you want to leave the golden path you should fork this and make it so you can do your weird, non restful shit. These gens are purely an effort to get back to the original beauty of what drew many to rails, only updated for TDD/BDD using the technologies listed below.

Step by step these generators will build the bare bones skeleton for a restfully designed resource to match a feature.

Generators for rapid rails development WITH testing!

Preconfigured for development using:

  • HAML
  • SASS
  • Compass
  • Cucumber
  • Capybara
  • RSpec
  • FactoryGirl
  • Remarkable

To install

As a gem (source: gemcutter.org) gem install dream_gens

As a plugin (git) git submodule add git://github.com/dreamr/dream_gens.git vender/plugins/dream_gens

Usage – Dream Generators

For Outside-In developing using Dream-gens, cucumber and rspec:

  • generate a feature
  • define the feature
  • generate a resource
  • modify the spec to do something different than the norm
  • modify the resource files to match your changed spec
  • rinse and repeat

Generate a feature

./script/generate dream_feature FeatureName Domain

eg. ./script/generate dream_feature user_logs_in authentication

will create:

  • features/_user_logs_in.feature
  • features/step_definitions/authentication_steps.rb

Generate a model, migration and behavior specification file

To generate full rest views and routing

./script/generate dream_resource Resource [attribute:type, *]

eg. ./script/generate dream_resource User email:string crypted_password:string

will create:

  • app/controllers/users_controller.rb
  • app/models/user.rb
  • app/views/users/
  • partials/_form.html.haml
  • partials/_user.html.haml
  • index.html.haml
  • new.html.haml
  • edit.html.haml
  • show.html.haml
  • config/routes.rb << map.resources :users
  • db/migrate/*****_create_and_index_users.rb
  • spec/controllers/users_controller_spec.rb
  • spec/factories/user_factory.rb
  • spec/models/user_spec.rb

To generate specific rest views and routing

./script/generate dream_resource Resource [attribute:type, *] [rest_action, *]

eg. ./script/generate dream_resource User email:string crypted_password:string new create show

will create:

  • app/controllers/users_controller.rb
  • app/models/user.rb
  • app/views/users/
  • _form.html.haml
  • new.html.haml
  • show.html.haml
  • config/routes.rb << map.resources :users
  • db/migrate/*****_create_and_index_users.rb
  • spec/controllers/users_controller_spec.rb
  • spec/factories/user_factory.rb
  • spec/models/user_spec.rb

Contributions

Maintainer: dreamr

Contributers

Fork, make a patch, notify me, get here.