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
line.
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
end
end
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).
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.