<commit_before>libdir = File.dirname(__FILE__)
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

require "gittake/version"

module Gittake
  # Your code goes here...
end<commit_msg>Add terrible commit for possible demo, please refactor<commit_after>libdir = File.dirname(__FILE__)
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

require "gittake/version"

require "grit"
require "colormath"
require "rainbow"

module Gittake
  class Blame
    def initialize(repopath, blamepath)
      @repo = ::Grit::Repo.new(repopath)
      @blame = ::Grit::Blame.new(@repo, blamepath, @repo.commits.first)
      @dates = @blame.lines.map(&:commit).map(&:committed_date)
      @most_recent = @dates.max
      @age = @dates.max - @dates.min
    end

    # Percent -- higher is newer
    def age_rating(date)
      since(date).to_f / @age.to_f
    end

    def since(date)
      # Invert, so closest gives highest number
      @most_recent - date
    end

    def rg_scale(rating)
      ::ColorMath::HSL.new(120 * rating, 1, 0.5)
    end

    def graph_blame
      pry = true
      @blame.lines.each do |line|
        date = line.commit.date
        cm = rg_scale(age_rating(date))
        puts line.line.color(cm.red * 255, cm.green * 255, cm.blue * 255)
      end
    end
  end
end

app = Gittake::Blame.new ARGV[0], ARGV[1]
app.graph_blame
{'fraction_non_alphanumeric': 0.12342941611234294, 'fraction_numerical': 0.012564671101256468, 'mean_word_length': 3.140672782874618, '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': '3253035', 'n_tokens_mistral': 505, 'n_tokens_neox': 481, 'n_words': 108}