Staying Dry in Rails using code generation
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Staying Dry in Rails using code generation

on

  • 3,295 views

A presentation about a code generator that generates a complete datamodel for ruby on rails

A presentation about a code generator that generates a complete datamodel for ruby on rails

Statistics

Views

Total Views
3,295
Views on SlideShare
3,282
Embed Views
13

Actions

Likes
6
Downloads
35
Comments
2

2 Embeds 13

http://www.slideshare.net 12
http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • I really like this!
    Are you sure you want to
    Your message goes here
    Processing…
  • Awesome slides, trying the tool out tonight.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Staying Dry in Rails using code generation Presentation Transcript

  • 1. Being DRY Your code might be, but are you? By Jeroen van Dijk
  • 2. Examples of tools to make you DRY... rails-templates capistrano I18n rake scaffolds sass haml make_resourceful
  • 3. What is missing to keep you DRY? ... An idea: Scaffold of your complete datamodel?
  • 4. But scaffolds generate code... ... for just one resource! ... not following my own conventions! ... that still requires a lot of customization! All true, that’s why I’ll not talk about the old way of scaffolding...
  • 5. Instant Rails rails shop -m http://www.jeevidee.nl/instant_rails_application.txt
  • 6. Don’t like uml or need customization? For examples or just to start For an old application: “rake dm:export” For a new application: “rake dm:xmi:to_yaml” Customize • which templates should be generated • which attributes/association should be used in your templates
  • 7. Not enough? • Adapt the templates to your liking • Define your own formats email: native_type: string examples: valid: jeroen@jeevidee.nl invalid: jeroen_jeevidee.nl display: default: “mail_to(“{{field}}”)
  • 8. Useful for... • super fast prototyping • refactoring • applying good conventions (e.g. css, models) Not just uml2rails
  • 9. The new DRY for Rails? • Design the basics of your application • Run the generator with your own customizations • Customize the application
  • 10. Summary of features Yaml/Uml export to: OK Models OK Views (+helpers) OK Controllers OK Migrations OK Fixtures OK Custom formats FAIL Documentation + Tests PENDING Intelligent generation of Routes PENDING Generation of Tests/Specs/Stories Information on attributes and associations is exploited in all of the above.
  • 11. More info or contribute Source http://github.com/jeroenvandijk/dm_generator http://github.com/jeroenvandijk/dm_templates http://github.com/jeroenvandijk/dm_designs Documentation/blog (coming soon) http://www.jeevidee.nl Demonstration rails shop -m http://www.jeevidee.nl/instant_rails_application.txt
  • 12. Questions?