Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
939 bytes
|
Line | |
---|
1 | #!/usr/bin/ruby |
---|
2 | |
---|
3 | exts = ['m', 'cpp', 'sh'] |
---|
4 | |
---|
5 | # check license in files, add it if not present |
---|
6 | require 'find' |
---|
7 | |
---|
8 | updated = 0 |
---|
9 | conform = 0 |
---|
10 | exts.each() do |ext| |
---|
11 | puts "--- processing #{ext} files" |
---|
12 | license = IO.readlines('license.'+ext).join() |
---|
13 | Find.find('./') do |f| |
---|
14 | if File.file?(f) && File.extname(f) == '.'+ext |
---|
15 | content = '' |
---|
16 | header = '' |
---|
17 | IO.readlines(f).each() do |line| |
---|
18 | if content.length == 0 && (ext == 'xml' || ext == 'html') && (line.index('<?') == 0 || (line.index('<!') == 0 && line.index('<!--') != 0)) |
---|
19 | header += line |
---|
20 | else |
---|
21 | content += line |
---|
22 | end |
---|
23 | end |
---|
24 | if content.index(license) != 0 |
---|
25 | File.open(f, 'w') do |f2| |
---|
26 | f2.puts header + license + content |
---|
27 | end |
---|
28 | puts "#{f} updated" |
---|
29 | updated += 1 |
---|
30 | else |
---|
31 | conform += 1 |
---|
32 | end |
---|
33 | end |
---|
34 | end |
---|
35 | end |
---|
36 | puts "------------------------------------------------" |
---|
37 | puts "#{updated} files updated, #{conform} already compliant" |
---|
Note: See
TracBrowser
for help on using the repository browser.