Thursday, 15 March 2012

ruby on rails - deleting a line in a file using Thor -



ruby on rails - deleting a line in a file using Thor -

is possible using thor actions delete line(s) of text file. illustration delete ruby comments. far have found 2 actions: comment_lines - comments out lines, , gsub_file

thanks

does not work remove comments?

gsub_file(filename, /#.*$/, '')

edit:

if want remove comments , delete lines comment information, try:

gsub_file(filename, /\s*#.*$/, '') # removes partial comments gsub_file(filename, /^\s*#.*\n/, '') # removes total line comments

ruby-on-rails thor

No comments:

Post a Comment