<commit_before>module Teabag
  class Engine < ::Rails::Engine

    isolate_namespace Teabag

    initializer :assets, :group => :all do |app|
      # default the root if it's not set
      Teabag.configuration.root ||= app.root

      # append the asset paths from the configuration
      Teabag.configuration.asset_paths.each do |path|
        app.config.assets.paths << Teabag.configuration.root.join(path).to_s
      end
    end
  end
end<commit_msg>adds a patch to rails (3 -- needs adjustment for 4) to not include files more than once when using javascript_include_tag.<commit_after>module Teabag
  class Engine < ::Rails::Engine

    isolate_namespace Teabag

    initializer :assets, :group => :all do |app|
      # default the root if it's not set
      Teabag.configuration.root ||= app.root

      # append the asset paths from the configuration
      Teabag.configuration.asset_paths.each do |path|
        app.config.assets.paths << Teabag.configuration.root.join(path).to_s
      end

      # todo: temporary bug fix for rails including more files that is should -- adds a flatten before uniq.
      module ::Sprockets::Helpers::RailsHelper
        def javascript_include_tag(*sources)
          options = sources.extract_options!
          debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
          body  = options.key?(:body)  ? options.delete(:body)  : false
          digest  = options.key?(:digest)  ? options.delete(:digest)  : digest_assets?

          sources.collect do |source|
            if debug && asset = asset_paths.asset_for(source, 'js')
              asset.to_a.map { |dep|
                super(dep.pathname.to_s, { :src => path_to_asset(dep, :ext => 'js', :body => true, :digest => digest) }.merge!(options))
              }
            else
              super(source.to_s, { :src => path_to_asset(source, :ext => 'js', :body => body, :digest => digest) }.merge!(options))
            end
          end.flatten.uniq.join("\n").html_safe
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.11214953271028037, 'fraction_numerical': 0.000983767830791933, 'mean_word_length': 2.5936395759717317, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2930693', 'n_tokens_mistral': 618, 'n_tokens_neox': 595, 'n_words': 164}