How to create files from template in rails lib directory?
I am writing a gem and to use it, some directories, ruby classes and yaml files should be created in rails lib directory. I'd like to have a scaffold method, which creates appropriate files with basic information, that will be modified later. How should I do this?
Should I add something to 'script' directory or to 'script/generate'? Where to store templates? Just for convenience I was using temporary solution: ruby script that creates files and then ju开发者_开发问答st puts content as strings line by line, but I don't like it at all and it doesn't seem much a ruby way...
Thanks for any suggestions.
Check out the Rails Guide on Generators.
They use the gem Thor under the hood.
精彩评论