<commit_before>class SimpleMailer < ActionMailer::Base
  default :from => "Circle Builds <<EMAIL>>"
  include ApplicationHelper
  helper :application

  # Sends an email for a build:
  # - work out who should be emailed based on their preferences
  # - decide what type of email (depends on the branch, previous success)
  # - email them
  def build_email(build_id)

    @build = Build.find(build_id)
    @users = @build.the_project.users
    #    @emails = @users.map { |u| u.email }.find_all { |e| e.include? "@" }
    @emails = "<EMAIL>"
    @project = @build.the_project

    if @build.failed?
      @logs = @build.logs
      @failing_log = @logs.last
      @other_logs = @logs[0..-1]
      raise if @failing_log.success?
      mail(:to => @emails, :subject => "[#{@project.github_project_name}] Test #{@build.build_num} failed", :template_name => "fail").deliver
    else
      mail(:to => @emails, :subject => "[Circle] Tests succeeded (#{@project.github_project_name} #{@build.build_num})", :template_name => "success").deliver
    end

    email.deliver
  end

  def build_error_email(build_id, error)
#    @build = Build.find(build_id)
    mail(:to => "<EMAIL>",
         :subject => "#{Rails.env}: build exception").deliver
  end
end
<commit_msg>Add SimpleMailer.test(addr)<commit_after>class SimpleMailer < ActionMailer::Base
  default :from => "<NAME> <<EMAIL>>"
  include ApplicationHelper
  helper :application

  # Sends an email for a build:
  # - work out who should be emailed based on their preferences
  # - decide what type of email (depends on the branch, previous success)
  # - email them
  def build_email(build_id)

    @build = Build.find(build_id)
    @users = @build.the_project.users
    #    @emails = @users.map { |u| u.email }.find_all { |e| e.include? "@" }
    @emails = "<EMAIL>"
    @project = @build.the_project

    if @build.failed?
      @logs = @build.logs
      @failing_log = @logs.last
      @other_logs = @logs[0..-1]
      raise if @failing_log.success?
      mail(:to => @emails, :subject => "[#{@project.github_project_name}] Test #{@build.build_num} failed", :template_name => "fail").deliver
    else
      mail(:to => @emails, :subject => "[Circle] Tests succeeded (#{@project.github_project_name} #{@build.build_num})", :template_name => "success").deliver
    end

    email.deliver
  end

  def build_error_email(build_id, error)
#    @build = Build.find(build_id)
    mail(:to => "<EMAIL>",
         :subject => "#{Rails.env}: build exception").deliver
  end

  def test(address="<EMAIL>")
    mail(:to => address,
         :subject => "#{Rails.env}: test email").deliver
  end
end

{'fraction_non_alphanumeric': 0.15200909780136468, 'fraction_numerical': 0.001516300227445034, 'mean_word_length': 3.4056761268781304, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, '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': '6246502', 'n_tokens_mistral': 887, 'n_tokens_neox': 875, 'n_words': 219}