Cover of Frictionless Generators Join the Launch List

Once the book is ready in September 2023, you’ll get a handy reference sheet, a series of short practical tips from the book, and a discount.

No-nonsense, one-click unsubscribes.

We’ve all done it…

Duplicate an existing file. Then duplicate the corresponding test file. Open each of those files in your editor, and delete some stuff from each file. Search and replace throughout both files. Manually update a few more things.

Run the tests. Find some places where the search and replace went bad. Fix those issues, and run the tests again.

And then get back to the real work. It’s the copy/paste and search/replace dance.

You might daydream about how great it would be to have it automated, but you’re pretty sure the automation work would take longer than repeatedly trudging through the process manually.

You may have even started to build them once or twice but bailed out because the learning curve felt to steep.

An illustration of someone frantically typing with keys flying off the keyboard and a coffee mug spilled on their desk.

Besides, the copying and pasting and searching and replacing isn’t that painful. Maybe custom generators are only worth it in exceptional situations.

Thankfully that’s not the case if only you can flatten the learning curve.

Building Custom Generators Can be Faster

What if you could quickly build well-tested generators and turn those tedious and repetitive ten-minute distractions into ten-second commands—not just for you but for your entire team?

What if it wasn’t tricky or time-consuming?

An illustration of someone leaning back in their chair and completely relaxed at their desk computer.

How much time could you save yourself and your teammates? How many copy/paste/search/replace tasks could you automate once and for all?

Rails already provides all the tools you need, and with a little curated knowledge of the Rails helpers and some advanced warning about the speed bumps, it can be worth it in far more scenarios than you think.

You can create robust, reliable, and well-tested generator in minutes instead of hours. Countless tedious little tasks turn into solid opportunities for time-saving automation.

Think of it like a tiny superpower. You spend less time muddling through another round of copying, pasting, searching, and replacing so you’re able to focus on high-value, impactful work.

What does it cover?

Frictionless Generators is a guide to help show you how to create and test custom Rails Generators in less time. It is not a deep dive into the intricacies of built-in Rails Generators, and it will not get into advanced Generator tactics. You can think of it as a guide for saving time that just happens to be using custom Rails Generators as the methodology for saving time.

An illustration of generator where templates go in and completed files come out.

It includes a book, reference sheet, and a collection of pre-built generators. And all of it will be laser-focused on saving you time—including in the process of reading the book which will be short and sweet by design. If the whole point is to save time, you don’t want to spend two weeks reading a book, right?

These topics are likely to evolve slightly, but this should provide a solid overview of what to expect.

  • Introduction
    • Save Time and Avoid Tedium with Generators
    • Ensure Generators are Net Time-savers
  • Identify Opportunities
    • Recognize Optimal Generator Scenarios
    • Use Shell Scripts for System Stuff
    • Use Rake Tasks for Application Stuff
    • Use Generators to Create Source Files
  • Learn the Foundations
    • Thor is the Foundation
    • Use Thor Directly for the Simplest Cases
    • Draw Inspiration from Built-in Rails Generators
  • Designing Generators
    • Documentation-driven Design Helps You Go Faster
    • Apply the File Creation Pattern
    • Apply the File Updating Pattern
    • Use Arguments for Critical Values
    • Use Options for Adjusting Behavior
    • Minimize Friction with Focused Generators
  • Building Generators
    • The Generator Generator is an Accelerant
    • Careful Configuration can Save You
    • Let Thor Provide Your Documentation
    • Keep Your Templates Boring
    • Use `NamedBase` for Internal Generators
    • Use `Base` for Simpler Generators
    • Leverage Thor Helper Methods for Speed
    • Leverage Rails Helper Methods for Convenience
    • Start Simple and Enhance Later
  • Optimizing Arguments and Options
    • One Argument and One Collection is Ideal
    • Too Many Options Means Trouble
    • Specify Defaults and Requirements Judiciously
    • Use the Simplest Types Available
    • Fewer Options is Usually Faster
  • Testing Generators
    • Curate Your Test Configuration
    • The `/tmp` Folder is Your Friend
    • Testing Generators with RSpec
    • Rails Provides All the Test Helpers
    • Pre-built Common Scenarios
  • Tips & Tactics to Level Up
    • You can Support Different Workflows
    • ActiveRecord Introspection can Help
    • Generators can Rely on Other Generators
    • You can Extend and Adapt Built-in Generators
  • Inspiration & Ideas
    • Examples of Broadly Useful Generators
    • Less-obvious Ideas for Your Own Generators

An illustration of a stop watch illustrating the amount of time saved.

Additional Questions

When will it be released?

The short answer is September 2023. The longer answer is that the first draft is almost complete, and I’m aiming to have a beta version available September 2023. Then once the final draft is ready, everybody will be able to download the final version.

In the meantime, I’m also writing some blog posts on specific topics like creating custom generators, Rails Generators and templates, and a unified Summary of Rails Generator Actions, and there’s also an email list where I’ll be sharing compact and focused lessons.

And if you’re curious about some of the research and investigation I’ve been doing to make sure the book covers all the right topics, I’ve got a post about Ruby Introspection on Rails Generators.

Who is this for?

If you’re a Rails developer who wants to save time on tedious tasks but never quite made it over the initial learning curve creating your own generators, you’ll likely appreciate this book.

If you’re deeply experienced with building custom generators already, it likely won’t cover significant new ground for you, but it may still help surface some opportunities you’ve previously missed out on with custom generators.