generators can be used inside an application, they can also be used to generate applications too, This kind of generator is referred as a “template”.
gem(“rspec-rails”, :group => “test”)
gem(“cucumber-rails”, :group => “test”)
if yes?(“Would you like to install Devise?”)
model_name = ask(“What would you like the user model to be called? [user]”)
model_name = “user” if model_name.blank?
here we specify
1) we want to add rspec-rails and cucumber-rails gem
2) asking whether or not like to install Devise. if answer is yes devise gem is added and then runs the devise:install generator
3) asking more input from user and run devise generator
if the file called template.rb. we can use it as follows
rails new myapp -m template.rb
For Rails Template Tutorials
For Rails Templates