How do I change the default gemfile created with 'rails new' command?

牧云@^-^@ 提交于 2019-12-04 22:31:56

问题


I have recently experienced an issue where I must add the following to my gemfile:

gem 'execjs'
gem 'therubyracer'

I must do this to avoid a javascript runtime error that occurs when starting the rails server. I would like to have this modification added to all new gemfiles created with the rails new command.


回答1:


You're looking for application templates.




回答2:


Rails documentation on Application Templates

If you want the option to customize each app individually instead of having a rigid template, a really good option is Rails Composer. It prompts you about common gems during setup, and it nails a lot of the more common gems.

Finally, if you like Rails Composer, but want to be able to re-use application templates, check out Rails Apps Composer. I haven't looked into this too much, but it seems to give you a lot of flexibility while doing most of the heavy lifting for you.



来源:https://stackoverflow.com/questions/8548267/how-do-i-change-the-default-gemfile-created-with-rails-new-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!