<commit_before>namespace :assets do
  desc 'GitLab | Assets | Fix Absolute URLs in CSS'
  task :precompile do
    css_files = Dir['public/assets/*.css']
    css_files.each do | file |
      puts "Fixing #{file}"
      system "sed", "-i", "-e", 's/url(\([\"\']\?\)\/assets\//url(\1.\//g', file
    end
  end
end<commit_msg>correct gzip files if they exist as well<commit_after>namespace :assets do
  desc 'GitLab | Assets | Fix Absolute URLs in CSS'
  task :precompile do
    css_files = Dir['public/assets/*.css']
    css_files.each do | file |
      # replace url(/assets/*) with url(./*)
      puts "Fixing #{file}"
      system "sed", "-i", "-e", 's/url(\([\"\']\?\)\/assets\//url(\1.\//g', file

      # rewrite the corresponding gzip file (if it exists)
      gzip = "#{file}.gz"
      if File.exist?(gzip)
        puts "Fixing #{gzip}"

        FileUtils.rm(gzip)
        mtime = File.stat(file).mtime

        File.open(gzip, 'wb+') do |f|
          gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)
          gz.mtime = mtime
          gz.write IO.binread(file)
          gz.close

          File.utime(mtime, mtime, f.path)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.16936170212765958, 'fraction_numerical': 0.001702127659574468, 'mean_word_length': 2.1956521739130435, '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': '881041', 'n_tokens_mistral': 430, 'n_tokens_neox': 415, 'n_words': 107}