Created
July 25, 2015 13:09
-
-
Save ftomassetti/400a2450e716e400184f to your computer and use it in GitHub Desktop.
Small script to update the comment at the top of all source files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$new_text = """/* | |
* Copyright (C) 2007-2010 Júlio Vilmar Gesser. | |
* Copyright (C) 2011, 2013-2015 The JavaParser Team. | |
* | |
* This file is part of JavaParser. | |
* | |
* JavaParser can be used either under the terms of | |
* a) the GNU Lesser General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* b) the terms of the Apache License | |
* | |
* You should have received a copy of both licenses in LICENCE.LGPL and | |
* LICENCE.APACHE. Please refer to those files for details. | |
* | |
* JavaParser is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
* GNU Lesser General Public License for more details. | |
*/ | |
""" | |
$old_text = """/* | |
* Copyright (C) 2007-2010""" | |
def process_file(f) | |
unless f.include? "generated" or f.include? "/resources" | |
content = File.new(f).read | |
if content.start_with?($old_text) | |
end_index = content.index('*/') + 2 | |
to_replace = content[0..end_index] | |
new_content = content.gsub(to_replace, $new_text) | |
File.open(f, 'w') { |file| file.write(new_content) } | |
else | |
puts "KO #{f}" | |
puts "#{content[0..30]}" | |
end | |
end | |
end | |
Dir["javaparser-testing/**/*.java"].each do |f| | |
process_file(f) | |
end | |
Dir["javaparser-model/**/*.java"].each do |f| | |
process_file(f) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewed.
I think it is fine, I see a lot of other files with less verbatim.
Other thing to consider is the *.jj file. Although I think we agreed that will need an additional Copyright line for walkmod/javalang.