Robert Jones
2006-Feb-11 15:20 UTC
[Rails] [OT] How to prepend copyright notices to each source file
Sorry for the off-topic post, but I guess someone else may hit the same issue.... Having developed a rails application, I now need to put GPL text and a copyright notice at the start of each source file. For the .rb files, this will look like: # Copyright 2006 Robert Jones........... and for the .rhtml files it will look like: <!-- Copyright 2006 Robert Jones......... Can anyone think of a neat way to do this prepending programatically on Linux, rather than by hand? I''m sure I can be done with awk, sed, grep etc. Thanks in advance, -- Robert Jones
Michael Johnston
2006-Feb-11 16:17 UTC
[Rails] [OT] How to prepend copyright notices to each source file
make a script addhead in root directory: #!/bin/sh cat $2 $1 > $1.tmp mv $1.tmp $1 then execute find . -name "*.rb" -exec ./addhead {} header.txt \; Michael Johnston On 11-Feb-06, at 4:19 PM, Robert Jones wrote:> Sorry for the off-topic post, but I guess someone else may hit the > same > issue.... > > Having developed a rails application, I now need to put GPL text and a > copyright notice at the start of each source file. For the .rb > files, this > will look like: > > # Copyright 2006 Robert Jones........... > > and for the .rhtml files it will look like: > > <!-- Copyright 2006 Robert Jones......... > > Can anyone think of a neat way to do this prepending > programatically on > Linux, rather than by hand? I''m sure I can be done with awk, sed, > grep > etc. > > Thanks in advance, > -- > Robert Jones > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
David Mitchell
2006-Feb-11 23:13 UTC
[Rails] [OT] How to prepend copyright notices to each source file
If you''re using a layout file, put it in there. If you''re resorting to sed/awk/etc. for stuff like this, personally I''d think that your design needs to be looked at and possibly refactored. Layouts are incredibly handy... Regards Dave M. On 12/02/06, Robert Jones <jonesieboy@btinternet.com> wrote:> Sorry for the off-topic post, but I guess someone else may hit the same > issue.... > > Having developed a rails application, I now need to put GPL text and a > copyright notice at the start of each source file. For the .rb files, this > will look like: > > # Copyright 2006 Robert Jones........... > > and for the .rhtml files it will look like: > > <!-- Copyright 2006 Robert Jones......... > > Can anyone think of a neat way to do this prepending programatically on > Linux, rather than by hand? I''m sure I can be done with awk, sed, grep > etc. > > Thanks in advance, > -- > Robert Jones > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Charles M. Gerungan
2006-Feb-12 07:03 UTC
[Rails] [OT] How to prepend copyright notices to each source file
On 12-feb-2006, at 0:13, David Mitchell wrote:>> Having developed a rails application, I now need to put GPL text >> and a >> copyright notice at the start of each source file.> If you''re using a layout file, put it in there. > > If you''re resorting to sed/awk/etc. for stuff like this, personally > I''d think that your design needs to be looked at and possibly > refactored.Refactored? He wanted the notice "at the start of each source file." -- Regards, Charles.
David Mitchell
2006-Feb-12 07:27 UTC
[Rails] [OT] How to prepend copyright notices to each source file
Ah, my mistake - I read it as though he wanted to have a copyright notice on each (published) page. On 12/02/06, Charles M. Gerungan <charles@nednieuws.com> wrote:> On 12-feb-2006, at 0:13, David Mitchell wrote: > > >> Having developed a rails application, I now need to put GPL text > >> and a > >> copyright notice at the start of each source file. > > > If you''re using a layout file, put it in there. > > > > If you''re resorting to sed/awk/etc. for stuff like this, personally > > I''d think that your design needs to be looked at and possibly > > refactored. > > Refactored? He wanted the notice "at the start of each source file." > > -- > Regards, Charles. > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Robert Jones
2006-Feb-12 08:55 UTC
[Rails] Re: [OT] How to prepend copyright notices to each source file
Thanks Michael - works like a charm. So simple too. Robert Michael Johnston wrote:> make a script addhead in root directory: > > #!/bin/sh > cat $2 $1 > $1.tmp > mv $1.tmp $1 > > then execute > find . -name "*.rb" -exec ./addhead {} header.txt \; > > Michael Johnston > > On 11-Feb-06, at 4:19 PM, Robert Jones wrote: > >> Sorry for the off-topic post, but I guess someone else may hit the >> same >> issue.... >> >> Having developed a rails application, I now need to put GPL text and a >> copyright notice at the start of each source file. For the .rb >> files, this >> will look like: >> >> # Copyright 2006 Robert Jones........... >> >> and for the .rhtml files it will look like: >> >> <!-- Copyright 2006 Robert Jones......... >> >> Can anyone think of a neat way to do this prepending >> programatically on >> Linux, rather than by hand? I''m sure I can be done with awk, sed, >> grep >> etc. >> >> Thanks in advance, >> -- >> Robert Jones >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails
Seemingly Similar Threads
- [PATCH] ./run: Use 'prepend' function to build paths.
- Re: nbdkit rust plugin: copyright notices, Cargo workspace, and macro hygiene
- Re: nbdkit rust plugin: copyright notices, Cargo workspace, and macro hygiene
- Re: nbdkit rust plugin: copyright notices, Cargo workspace, and macro hygiene
- Re: nbdkit rust plugin: copyright notices, Cargo workspace, and macro hygiene