rails new --skip-comments

19 views
Skip to first unread message

mat...@prbytes.com

unread,
Jan 25, 2018, 11:21:49 PM1/25/18
to Ruby on Rails: Core

The first thing I do after generating a Rails app is remove the default code comments. I was having trouble finding a script to do this automatically, so I decided to make this. It's super hacky and not recommended since it removes them after they've been added, but it gets the job done for now.


It would be cool to allow the user to skip generating the comments by adding a "--skip-comments" flag and by wrapping each comment in the template files:


<% unless skip_comments -%>
  # comment
<% end -%>


But I can see how maintaining this could get out of hand, since each comment in a template would require this logic. An alternative would be using a similar approach to my method and removing them after they've been created, but this might cause issues in future Ruby versions and template changes.

You’ve probably already thought about this, but this would save me a lot of time so I want to make sure. :D

Thanks!

Matias

Rolandas Barysas

unread,
Jan 26, 2018, 1:46:09 AM1/26/18
to rubyonra...@googlegroups.com
I don't think that this would be a good tradeoff, because it would introduce a lot of noise into the codebase. If those comments are really bothering you, you might achieve similar results with certain editors (search and replace maybe?).

In any case, the good news is that you only have to do it once.

Rolandas
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages