From 85c68442b478ac7bc9c0936f1ce26e76aa9a303a Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Tue, 18 Jun 2013 16:36:04 +0200 Subject: [PATCH] added .coffee support to source code filter --- script/source_code_filter.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/script/source_code_filter.rb b/script/source_code_filter.rb index fc4413095..8faf1bcb1 100755 --- a/script/source_code_filter.rb +++ b/script/source_code_filter.rb @@ -6,7 +6,12 @@ require 'code_beauty_ruby.rb' def checkForHeader(fileName) foundHeader = false; foundSheBang = false; + isCoffee = false; + header = "# Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/\n\n" + if File.extname(fileName) == '.coffee' + isCoffee = true + end file = File.open(fileName) t_file = Tempfile.new('Temp') @@ -39,16 +44,17 @@ def checkForHeader(fileName) t_file.close FileUtils.cp(t_file.path, fileName) t_file.unlink - - t_file = RBeautify.beautify_file(fileName) + if !isCoffee + t_file = RBeautify.beautify_file(fileName) + end end #folder array -folder = ['app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ] - +#folder = ['app/assets/javascripts/app','app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ] +folder = ['script'] folder.each do |folder| puts 'Working on folder' + folder.to_s - rbfiles = File.join("../#{folder}**", "*.rb") + rbfiles = File.join("../#{folder}**", "*.{rb,coffee}") d = Dir.glob(rbfiles) d.each {|fileName|