<commit_before>namespace :admin do
  task :create_admin, [:email] => :environment do |_t, args|
    email = args[:email]
    puts "Creating Administration for #{email}"
    a = Administration.new(email: email, password: Devise.friendly_token[0, 20])
    if a.save
      puts "#{a.email} created"
    else
      puts "An error occured : #{a.errors.full_messages}"
    end
  end

  task list: :environment do
    puts "All Administrations :"
    Administration.all.pluck(:email).each do |a|
      puts a
    end
  end

  task :delete_admin, [:email] => :environment do |_t, args|
    email = args[:email]
    puts "Deleting Administration for #{email}"
    a = Administration.find_by(email: email)
    a.destroy
    puts "#{a.email} deleted"
  end
end<commit_msg>Improve the admin tasks<commit_after>namespace :admin do
  desc <<~EOD
    List all super-admins
  EOD
  task list: :environment do
    puts "All Administrations:"
    Administration.all.pluck(:email).each do |a|
      puts a
    end
  end

  desc <<~EOD
    Create a new super-admin account with the #EMAIL email address.
  EOD
  task :create_admin, [:email] => :environment do |_t, args|
    email = args[:email]

    puts "Creating Administration for #{email}"
    a = Administration.new(email: email, password: Devise.friendly_token[0, 20])

    if a.save
      puts "#{a.email} created"
    else
      puts "An error occured: #{a.errors.full_messages}"
    end
  end

  desc <<~EOD
    Delete the #EMAIL super-admin account
  EOD
  task :delete_admin, [:email] => :environment do |_t, args|
    email = args[:email]
    puts "Deleting Administration for #{email}"
    a = Administration.find_by(email: email)
    a.destroy
    puts "#{a.email} deleted"
  end
end
{'fraction_non_alphanumeric': 0.11863425925925926, 'fraction_numerical': 0.003472222222222222, 'mean_word_length': 3.126491646778043, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '73309', 'n_tokens_mistral': 569, 'n_tokens_neox': 570, 'n_words': 175}