<commit_before>
namespace :screenshots do

  Cucumber::Rake::Task.new({:reference => 'db:test:prepare'}, 'Take reference screenshots') do |t|
    t.profile = 'ref_screens'
  end

  Cucumber::Rake::Task.new({:comparison => 'db:test:prepare'}, 'Take comparison screenshots') do |t|
    t.profile = 'cmp_screens'
  end

  desc 'Take reference and comparison screenshots'
  task :all => [:reference, :comparison]

  desc 'Generate "flicker" images for easy comparison (requires RMagick)'
  task :flicker do
    require 'RMagick'
    screen_dir = Rails.root.join('tmp', 'screenshots')

    ref_dir = screen_dir.join('reference')
    cur_dir = screen_dir.join('current')

    Dir.glob("#{ref_dir}/*.png") do |img|
      filename = File.basename(img)

      if !File.exist?(cur_dir.join(filename))
        raise "the comparison screenshot for #{filename} doesn't exist!"
      end

      img_list = Magick::ImageList.new(ref_dir.join(filename), cur_dir.join(filename))
      img_list.delay = 65      # number of ticks between flicker img change (100 ticks/second)
      img_list.iterations = 0  # -> endless loop
      img_list.write(screen_dir.join("#{filename}.gif"))
    end

    puts %Q(
    Done!
    You can find the flicker images here:

      #{screen_dir}

    )
  end
end
<commit_msg>fix regression in 0.0.3.0 (close #3805)<commit_after>if defined? Cucumber

namespace :screenshots do

  Cucumber::Rake::Task.new({:reference => 'db:test:prepare'}, 'Take reference screenshots') do |t|
    t.profile = 'ref_screens'
  end

  Cucumber::Rake::Task.new({:comparison => 'db:test:prepare'}, 'Take comparison screenshots') do |t|
    t.profile = 'cmp_screens'
  end

  desc 'Take reference and comparison screenshots'
  task :all => [:reference, :comparison]

  desc 'Generate "flicker" images for easy comparison (requires RMagick)'
  task :flicker do
    require 'RMagick'
    screen_dir = Rails.root.join('tmp', 'screenshots')

    ref_dir = screen_dir.join('reference')
    cur_dir = screen_dir.join('current')

    Dir.glob("#{ref_dir}/*.png") do |img|
      filename = File.basename(img)

      if !File.exist?(cur_dir.join(filename))
        raise "the comparison screenshot for #{filename} doesn't exist!"
      end

      img_list = Magick::ImageList.new(ref_dir.join(filename), cur_dir.join(filename))
      img_list.delay = 65      # number of ticks between flicker img change (100 ticks/second)
      img_list.iterations = 0  # -> endless loop
      img_list.write(screen_dir.join("#{filename}.gif"))
    end

    puts %Q(
    Done!
    You can find the flicker images here:

      #{screen_dir}

    )
  end
end

end

{'fraction_non_alphanumeric': 0.13290175171363292, 'fraction_numerical': 0.007616146230007616, 'mean_word_length': 3.529310344827586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '3596069', 'n_tokens_mistral': 912, 'n_tokens_neox': 852, 'n_words': 216}