From 85c68442b478ac7bc9c0936f1ce26e76aa9a303a Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Tue, 18 Jun 2013 16:36:04 +0200 Subject: [PATCH 1/2] 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| From aff81215d49beb794cd4e94645e5210ab7793b39 Mon Sep 17 00:00:00 2001 From: Johannes Nickel Date: Tue, 18 Jun 2013 16:37:05 +0200 Subject: [PATCH 2/2] updated folder array --- script/source_code_filter.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/source_code_filter.rb b/script/source_code_filter.rb index 8faf1bcb1..5bfcd865f 100755 --- a/script/source_code_filter.rb +++ b/script/source_code_filter.rb @@ -50,8 +50,7 @@ def checkForHeader(fileName) end #folder array -#folder = ['app/assets/javascripts/app','app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ] -folder = ['script'] +folder = ['app/assets/javascripts/app','app/controllers/', 'app/models/', 'app/helpers/', 'app/mailers/' ] folder.each do |folder| puts 'Working on folder' + folder.to_s rbfiles = File.join("../#{folder}**", "*.{rb,coffee}")