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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
What do you mean when you say ? "update the version of my app they''re running" if you app a gem / plugin ? are you trying to create a differential/incremental writer? It sound to me you are trying to do something that can be done with GIT. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mohammad El-abid
2010-Oct-07 15:15 UTC
Re: Append to end of file before ''end'' declaration
Radhames Brito wrote:> What do you mean when you say ? > > "update the version of my app they''re running" > > if you app a gem / plugin ? > > are you trying to create a differential/incremental writer? > > It sound to me you are trying to do something that can be done with GIT.I was thinking about GIT, but was unable to find a way to update with a GIT. It''s a Ruby On Rails framework I guess. It''s not a gem or plugin. Yes a differential writer would work. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mohammad El-abid
2010-Oct-07 15:40 UTC
Re: Append to end of file before ''end'' declaration
Mohammad El-abid wrote:> Radhames Brito wrote: >> What do you mean when you say ? >> >> "update the version of my app they''re running" >> >> if you app a gem / plugin ? >> >> are you trying to create a differential/incremental writer? >> >> It sound to me you are trying to do something that can be done with GIT. > > I was thinking about GIT, but was unable to find a way to update with a > GIT. It''s a Ruby On Rails framework I guess. It''s not a gem or plugin. > Yes a differential writer would work.I should add that this is so I can add routes to the route.rb file. So I don''t want to overwrite the user''s custom routes. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Oct-07 16:05 UTC
Re: Re: Append to end of file before ''end'' declaration
I am guessing but, i think your app should be a gem but you dont know how to make it a gem, because what you want to do , it done with rubygems. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.