<commit_before>require File.join(Rails.root, 'lib/extra/certificate_factory.rb')
ENV['REDIS_URL'] = ENV['ODC_REDIS_SERVER_URL']

task :certificate do
  ENV['JURISDICTION'] ||= "gb"
  if ENV['URL'] && ENV['USER_ID']
    cert = CertificateFactory::Certificate.new(ENV['URL'], ENV['USER_ID'], jurisdiction: ENV['JURISDICTION'])
    gen = cert.generate
  else
    puts "You must specifiy the Certificate URL and User ID"
  end
end

task :certificates do
  url = ENV['URL']
  csv = ENV['CSV']
  user = User.find(ENV.fetch('USER_ID'))
  options = {
    user_id: user.id,
    limit: ENV['LIMIT'],
    jurisdiction: ENV['JURISDICTION'] || 'gb'
  }
  if campaign_name = ENV['CAMPAIGN']
    campaign = user.certification_campaigns.where(name: campaign_name).first_or_create(url: url)<commit_msg>Use fetch to set default<commit_after>require File.join(Rails.root, 'lib/extra/certificate_factory.rb')
ENV['REDIS_URL'] = ENV['ODC_REDIS_SERVER_URL']

task :certificate do
  ENV['JURISDICTION'] ||= "gb"
  if ENV['URL'] && ENV['USER_ID']
    cert = CertificateFactory::Certificate.new(ENV['URL'], ENV['USER_ID'], jurisdiction: ENV['JURISDICTION'])
    gen = cert.generate
  else
    puts "You must specifiy the Certificate URL and User ID"
  end
end

task :certificates do
  url = ENV['URL']
  csv = ENV['CSV']
  user = User.find(ENV.fetch('USER_ID'))
  options = {
    user_id: user.id,
    limit: ENV['LIMIT'],
    jurisdiction: ENV.fetch('JURISDICTION'], 'gb')
  }
  if campaign_name = ENV['CAMPAIGN']
    campaign = user.certification_campaigns.where(name: campaign_name).first_or_create(url: url)
{'fraction_non_alphanumeric': 0.1557377049180328, 'fraction_numerical': 0.0, 'mean_word_length': 4.856088560885609, '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': '7640082', 'n_tokens_mistral': 590, 'n_tokens_neox': 578, 'n_words': 117}