Simon Krahnke
2/24/2009 7:54:00 AM
* Srinath A. <srinathbtech@gmail.com> (07:16) schrieb:
> How to append static text for all files in application .
> I want to append comment lines on top of each file in app/controllers/
Appending is "inserting" text at the end of the file. If you want to
modify something before the end you got to read it all in, do your
changes, and write it out again.
If your Files are small enough to be read in whole, it's quite easy in
Ruby:
content = File.read(filename)
File.open(filename, "w") do | f |
f << "# comment\n"
f << content
end
mfg, simon .... untested