copy_files (Merb::GeneratorHelpers)

    # File lib/merb-gen/helpers.rb, line 29
      def copy_files
        select_template_directories(true).each do |file|
          # Remove "template/" from the glob filename
          dir = relative(file)

          # Get all the files under the directory that are not directories or in
          # the list of excluded templates above.
          files = Dir["#{file.empty? ? "." : file}/*"].reject { |f| File.directory?(f) }

          next if files.empty?

          # We want to templatize any files that contain <% %> characters
          #--
          # This is old code, should we need it:
          # templates, to_copy = files.partition {|file| !(file =~ /\.erb$/) && File.read(file) =~ /<%.*%>/}
          templates, to_copy = files.partition { |file| File.read(file) =~ /<%.*%>/ }

          # Make the paths relative to the directory we're inspecting
          [to_copy, templates].each do |paths|
            paths.map! { |f| relative(f, dir) }
          end

          # Copy the files over
          to_copy.each do |filename|
            m.file(
              file_name(dir, filename),
              file_name(interpolate_path(dir), filename)
            )
          end

          # Copy the templates over
          templates.each do |filename|
            m.template(
              file_name(dir, filename),
              file_name(interpolate_path(dir), interpolate_path(filename))
            )
          end
        end
      end