Dream Gens
Brought to you by rubyloves.me
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!
- HAML Views
- Cucumber, Capybara, RSpec and Remarkable
To install
git submodule add git://github.com/dreamr/dream_gens.git vender/plugins/dream_gens
Usage – Dream Generatorsg
For Outside-In developing using Dream-gens, cucumber and rspec:
- generate a feature
- define the feature
Generate a feature
./script/generate dream_feature FeatureName Domain
or
./script/generate df 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, *]
or
./script/generate dr 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
Forked and modified from: meskyanichi
Contributers
Fork, make a patch, notify me, get here.