module Thor::Actions
def comment_lines(path, flag, *args)
comment_lines 'config/initializers/session_store.rb', /cookie_store/
==== Example
config
flag
path
==== Parameters
a single space after the comment hash.
which existed before the beginning of the line in tact and will insert
Comment all lines matching a given regex. It will leave the space
def comment_lines(path, flag, *args) flag = flag.respond_to?(:source) ? flag.source : flag gsub_file(path, /^(\s*)([^#\n]*#{flag})/, '\1# \2', *args) end