Daniel Schmidt
Daniel Schmidt

Reputation: 11921

Creating own Rails generator

I would like to know how to create a rails generator, which is available to all projects, but I only found the rails generate generator command for a single project. Thanks for your help!

Upvotes: 1

Views: 74

Answers (1)

Prakash Murthy
Prakash Murthy

Reputation: 13067

Ruby on Rails Guides chapter on Creating and Customizing Rails Generators & Templates has the details about how to creating your own generator.

It only deals with how to implement a generator in a specific project. To make it available across projects, you need to package the code as a plugin or a gem.

A plugin would be installed as a folder within each app that requires it, where as a gem will be installed directly via bundler or rubygems. See more about the difference between a plugin and a gem at What's the difference between gem and plugin?

Check out How to Make your own gem on the RubyGems site.

There are a lot more useful resources out there for creating a gem available by googling.

Upvotes: 1

Related Questions