So I’m building my own updating controller that will allow users to
update the version of my app they’re running. I was unable to find a
plugin that did this
So now this looks for the last end in a file (such as routes.rb or a
controller and allows the update to add data at the end, right before
the ‘end’ declaration (append is the right work I think).
So I have this little part working, but I’m not sure how to replace the
file.split("\n").reverse.each do |line|
gives us the file in reverse
if line =~ /^(.+)end/
now we need to append here
line number = file.lineno
file = string that holds the file text
@append = string to append
also after the replacement is done, since it’s in an ‘if’ do I write
‘break’ once or twice (to break the ‘do’ loop).