def expand_dirs_to_files(*dirs)
      extensions = %w[rb erb rake rhtml haml slim builder rxml rabl]

      dirs.flatten.map do |entry|
        next unless File.exist? entry

        if File.directory? entry
          Dir[File.join(entry, '**', "*.{#{extensions.join(',')}}")]
        else
          entry
        end
      end.flatten
    end
def expand_dirs_to_files(*dirs)
      extensions = %w[rb erb rake rhtml haml slim builder rxml rabl]

      dirs.flatten.map do |entry|
        next unless File.exist? entry

        if File.directory? entry
          Dir[File.join(entry, '**', "*.{#{extensions.join(',')}}")]
        else
          entry
        end
      end.flatten
    end
expand all files with extenstion rb, erb, haml, slim, builder and rxml under the dirs

 @param [Array] dirs what directories to expand
 @return [Array] all files expanded