Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a ruby script to prepend files with a uniform header.

  • Loading branch information...
commit 207ce0926f8b276194f5be143284d72eb3a9db52 1 parent 6f2aab1
JorenSix authored
Showing with 71 additions and 0 deletions.
  1. +25 −0 new_prefix.txt
  2. +20 −0 old_prefix.txt
  3. +26 −0 prepender.rb
View
25 new_prefix.txt
@@ -0,0 +1,25 @@
+/*
+* _______ _____ _____ _____
+* |__ __| | __ \ / ____| __ \
+* | | __ _ _ __ ___ ___ ___| | | | (___ | |__) |
+* | |/ _` | '__/ __|/ _ \/ __| | | |\___ \| ___/
+* | | (_| | | \__ \ (_) \__ \ |__| |____) | |
+* |_|\__,_|_| |___/\___/|___/_____/|_____/|_|
+*
+* -----------------------------------------------------------
+*
+* TarsosDSP is developed by Joren Six at
+* The School of Arts,
+* University College Ghent,
+* Hoogpoort 64, 9000 Ghent - Belgium
+*
+* -----------------------------------------------------------
+*
+* Info: http://tarsos.0110.be/tag/TarsosDSP
+* Github: https://github.com/JorenSix/TarsosDSP
+* Releases: http://tarsos.0110.be/releases/TarsosDSP/
+*
+* TarsosDSP includes modified source code by various authors,
+* for credits and info, see README.
+*
+*/
View
20 old_prefix.txt
@@ -0,0 +1,20 @@
+/*
+* _______ _____ _____ _____
+* |__ __| | __ \ / ____| __ \
+* | | __ _ _ __ ___ ___ ___| | | | (___ | |__) |
+* | |/ _` | '__/ __|/ _ \/ __| | | |\___ \| ___/
+* | | (_| | | \__ \ (_) \__ \ |__| |____) | |
+* |_|\__,_|_| |___/\___/|___/_____/|_____/|_|
+*
+* -----------------------------------------------------------
+*
+* TarsosDSP is developed by Joren Six at
+* The Royal Academy of Fine Arts & Royal Conservatory,
+* University College Ghent,
+* Hoogpoort 64, 9000 Ghent - Belgium
+*
+* http://tarsos.0110.be/tag/TarsosDSP
+* https://github.com/JorenSix/TarsosDSP
+* http://tarsos.0110.be/releases/TarsosDSP/
+*
+*/
View
26 prepender.rb
@@ -0,0 +1,26 @@
+require 'rubygems'
+
+source_files = Dir.glob(File.join("**", "*.java"))
+new_prefix = File.open("new_prefix.txt", "r").read
+old_prefix = File.open("old_prefix.txt", "r").read
+
+
+def starts_with?(string, prefix)
+ prefix = prefix.to_s
+ string[0, prefix.length] == prefix
+end
+
+
+source_files.each do |source_file|
+ source_file_contents = File.open(source_file, "r").read
+ if source_file_contents.start_with? old_prefix
+ source_file_contents = source_file_contents.gsub(old_prefix,"")
+ end
+ unless source_file_contents.start_with? new_prefix
+ source_file_contents = new_prefix + "\n" + source_file_contents
+ File.open( source_file, 'w' ) { | file | file.puts source_file_contents }
+ end
+end
+
+puts source_files
+puts new_prefix
Please sign in to comment.
Something went wrong with that request. Please try again.