aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-12-19 17:36:09 +0100
committerAqua-sama <aqua@iserlohn-fortress.net>2017-12-19 17:36:09 +0100
commit1c53b56871a36fdf58e58ee87ac6b56d4e3355f0 (patch)
tree1eba5f045a2660a3708b1ec91be838e397cb8335 /tools
parentBug fixes (diff)
downloadsmolbote-1c53b56871a36fdf58e58ee87ac6b56d4e3355f0.tar.xz
Changed license from GPL3+ to GPL3
Diffstat (limited to 'tools')
-rwxr-xr-xtools/check_license.rb18
-rwxr-xr-xtools/fix_headers.rb18
2 files changed, 36 insertions, 0 deletions
diff --git a/tools/check_license.rb b/tools/check_license.rb
new file mode 100755
index 0000000..c519513
--- /dev/null
+++ b/tools/check_license.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/env ruby
+
+exit_code = 0
+file_names = Dir.glob("**/*.h") + Dir.glob("**/*.cpp")
+
+puts "Running in #{`pwd`}"
+
+# for each item in file_names
+file_names.each do |file_name|
+ File.open(file_name) { |file|
+ if file.grep(/SPDX-License-Identifier/).empty? then
+ puts "Missing or incorrect license header: #{file_name}"
+ exit_code = 1
+ end
+ }
+end
+
+exit exit_code
diff --git a/tools/fix_headers.rb b/tools/fix_headers.rb
new file mode 100755
index 0000000..6d23ed6
--- /dev/null
+++ b/tools/fix_headers.rb
@@ -0,0 +1,18 @@
+#!/usr/bin/ruby
+
+ # for all files
+
+file_names = Dir.glob("**/*.h") + Dir.glob("**/*.cpp")
+new_header = File.read('new_header')
+old_header = File.read('old_header')
+
+file_names.each do |file_name|
+ text = File.read(file_name)
+ new_contents = text.gsub(old_header, new_header)
+
+ # To merely print the contents of the file, use:
+ #puts new_contents
+
+ # To write changes to the file, use:
+ File.open(file_name, "w") {|file| file.puts new_contents }
+end