5 all_files = Dir.glob('**/*').select {|f| File.file?(f)}
6 src_files = all_files.select {|f| f.match(/\.(cpp|H|h|C)$/)}
7 zyn_files = src_files.select {|f| f.match(/^src/)}
10 puts "Please Enter a description for #{fname}:"
11 short = fname.match(/.*\/(.*)/)[1]
13 desc = $stdin.gets.strip
15 ZynAddSubFX - a software synthesizer
18 Copyright (C) 2016 Mark McCurry
20 This program is free software; you can redistribute it and/or
21 modify it under the terms of the GNU General Public License
22 as published by the Free Software Foundation; either version 2
23 of the License, or (at your option) any later version.
26 Open3.popen3("ed -p: #{fname}") do |stdin, stdout, stderr|
37 def update_license(fname, first, last)
38 str = %{ This program is free software; you can redistribute it and/or
39 modify it under the terms of the GNU General Public License
40 as published by the Free Software Foundation; either version 2
41 of the License, or (at your option) any later version.
43 Open3.popen3("ed -p: #{fname}") do |stdin, stdout, stderr|
45 stdin.puts "#{first},#{last}c"
55 zyn_files.sort.each do |fname|
62 if(fname.match(/jack_osc/) || fname.match(/NSM/))
66 f = File.open(fname, "r")
69 puts "Info: Processing '#{fname}'"
71 #Check for Copyright Header
75 if(!first.match /\/\*/)
76 puts "Error: No Copyright Header Found"
86 if(!ln.match /ZynAddSubFX - a software synthesizer/)
87 puts "Warning: Unexpected Program Name"
95 puts "Warning: Broken Formatting"
101 if(!ln.match /(.*) - (.*)/)
102 puts "Warning: Invalid Description"
113 if(ln.match(/^$/)|| ln.match(/Author/))
116 if(!(ln.match(/Copyright \(C\) ([0-9]*)-([0-9]*) (.*)/) ||
117 ln.match(/Copyright \(C\) ([0-9]*) (.*)/)))
118 puts "Warning: Invalid Copyright Field"
124 #Out-Of-Date Author Section
125 if(ln.match /Author/)
135 #Completely Standard Copyright Stuff
138 if(ln.match /This program is free software/)
139 puts "Info: GPL Found..."
141 while(!ln.match(/\*\//))
144 if(ln.downcase.match(/version 2/))
150 update_license(fname, initial_line, final_line)
151 puts "Info: GPL Lines #{initial_line} #{final_line} total #{final_line-initial_line}"
154 puts "Error: Invalid Copyright Header"
155 puts " Line = <#{ln}>"
159 #zyn_files = src_files.select
160 #puts Dir.glob('**/*').select { |f| !!(File.file?(f) && f.match(/\.(cpp|H|h|C)$/))}