<commit_before>require 'digest/md5'

module JammitHelper

  def fingerprint(type, package)
    path = File.join(RACK_ROOT, 'public/jam', "#{package}.#{type}")

    if File.exist? path
      Digest::MD5.hexdigest(File.read path)
    else
      nil
    end
  end

  def jammit(type, package, options = {})
    paths = 
      if development?
        Jammit.packager.individual_urls(package, type)
      else
        ["/jam/#{package}.#{type}/#{fingerprint(type, package)}"]
      end

    if options[:async] && production?
      haml_tag :script do
        haml_concat "head.js(#{paths.map{|p|"'#{p}'"}.join ','});"
      end
    else
      paths.each { |p| asset(type, p, options) }
    end
  end

  def asset(type, path, options)
    case type
    when :js
      haml_tag :script, src: path
    when :css
      haml_tag :link, rel: 'stylesheet', href: path
    end
  end

  def manager_package
    package = "#{@controller}_manager"

    if Jammit.configuration[:javascripts].keys.include? package
      package
    else
      :jquery
    end
  end

  def google_web_fonts
    haml_tag :link, href: 'http://fonts.googleapis.com/css?family=Neuton&v1', rel: 'stylesheet', type: 'text/css'
  end

end<commit_msg>Fixed manager jammit package inclusion<commit_after>require 'digest/md5'

module JammitHelper

  def fingerprint(type, package)
    path = File.join(RACK_ROOT, 'public/jam', "#{package}.#{type}")

    if File.exist? path
      Digest::MD5.hexdigest(File.read path)
    else
      nil
    end
  end

  def jammit(type, package, options = {})
    paths = 
      if development?
        Jammit.packager.individual_urls(package, type)
      else
        ["/jam/#{package}.#{type}/#{fingerprint(type, package)}"]
      end

    if options[:async] && production?
      haml_tag :script do
        haml_concat "head.js(#{paths.map{|p|"'#{p}'"}.join ','});"
      end
    else
      paths.each { |p| asset(type, p, options) }
    end
  end

  def asset(type, path, options)
    case type
    when :js
      haml_tag :script, src: path
    when :css
      haml_tag :link, rel: 'stylesheet', href: path
    end
  end

  def manager_package
    package = "manager_#{@controller}".to_sym

    if Jammit.configuration[:javascripts].keys.include? package
      package
    else
      :jquery
    end
  end

  def google_web_fonts
    haml_tag :link, href: 'http://fonts.googleapis.com/css?family=Neuton&v1', rel: 'stylesheet', type: 'text/css'
  end

end
{'fraction_non_alphanumeric': 0.1343954248366013, 'fraction_numerical': 0.0024509803921568627, 'mean_word_length': 2.7332317073170733, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7363079', 'n_tokens_mistral': 854, 'n_tokens_neox': 822, 'n_words': 195}