File: fix_copyright.rb

package info (click to toggle)
tagua 1.0~alpha2-16-g618c6a0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,004 kB
  • sloc: cpp: 26,141; ansic: 13,039; makefile: 183; ruby: 88; sh: 39
file content (26 lines) | stat: -rwxr-xr-x 662 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/ruby

require 'find'

stmt = %{/*
  Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
            (c) 2007 Maurizio Monge <maurizio.monge@kdemail.net>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
*/

}


Find.find('.') do |filename|
    if filename =~ /\.(cpp|h)$/
        code = File.open(filename) {|f| f.read}
        unless code =~ /copyright/i
            File.open(filename, 'w') {|f| f.write(stmt + code)}
        end
    end
end