<commit_before>namespace :dev do
  # Just run development env
  # This code run insert seed and agency data
  # A simple trick to over migration problem
  task :setup => [:environment] do
    raise 'Nah, You are at production' if Rails.env.production?
    Rake::Task['dev:kill_postgres_connections'].execute
    Rake::Task['db:drop'].execute
    Rake::Task['db:create'].execute
    Rake::Task['db:migrate'].execute
    Rake::Task['db:seed'].execute
    Rake::Task['dev:user'].execute
    Rake::Task['dev:admin'].execute
  end

  task :user => [:environment] do
    User.create!(email: '<EMAIL>',     password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')
    User.create!(email: '<EMAIL>',   password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')
    User.create!(email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: 'T<NAME>')
    User.create!(email: '<EMAIL>',   password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')
  end

  task :admin => [:environment] do
    Admin.create!(email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>')
  end

  task :kill_postgres_connections => [:environment] do
    db_name = "#{File.basename(Rails.root)}_#{Rails.env}"
    sh = <<EOF
ps xa \
  | grep postgres: \
  | grep #{db_name} \
  | grep -v grep \
  | awk '{print $1}' \
  | xargs kill
EOF
    puts `#{sh}`
  end

end<commit_msg>#40 seed data added for development<commit_after>namespace :dev do
  # Just run development env
  # This code run insert seed and agency data
  # A simple trick to over migration problem
  task :setup => [:environment] do
    raise 'Nah, You are at production' if Rails.env.production?
    Rake::Task['dev:kill_postgres_connections'].execute
    Rake::Task['db:drop'].execute
    Rake::Task['db:create'].execute
    Rake::Task['db:migrate'].execute
    Rake::Task['db:seed'].execute
    Rake::Task['dev:user'].execute
    Rake::Task['dev:admin'].execute
  end

  task :user => [:environment] do
    guest = User.find_by_email('<EMAIL>')
    muhammet  = User.create!(email: '<EMAIL>',     password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')
    onur      = User.create!(email: '<EMAIL>',   password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')
    tayfun    = User.create!(email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: 'T<NAME>')
    hamit     = User.create!(email: '<EMAIL>',   password: '<PASSWORD>', password_confirmation: '<PASSWORD>', name: '<NAME>')

    project = guest.own_projects.create(name: 'Blog', description: 'My personel website', owner_id: guest.id)
    project.users << guest
    project.users << onur
    project.users << tayfun
    project.users << hamit
    project.users << muhammet

    list_1 = project.lists.create(name: 'To Do')
    list_1.cards.create(title: 'Create Project With Cybele', owner_id: guest.id)
    list_1.cards.create(title: 'Setup Mandril', owner_id: muhammet.id)
    list_1.cards.create(title: 'Setup Bulutfon', owner_id: muhammet.id, assignment_id: onur.id)
    list_2 = project.lists.create(name: 'In Progress')
    list_2.cards.create(title: 'Setup Capistrano', owner_id: muhammet.id)

    list_3 =project.lists.create(name: 'Done')
    list_3.cards.create(title: 'Get Domain', owner_id: tayfun.id, assignment_id: hamit.id)
  end

  task :admin => [:environment] do
    Admin.create!(email: '<EMAIL>', password: '<PASSWORD>', password_confirmation: '<PASSWORD>')
  end


  task :kill_postgres_connections => [:environment] do
    db_name = "#{File.basename(Rails.root)}_#{Rails.env}"
    sh = <<EOF
ps xa \
  | grep postgres: \
  | grep #{db_name} \
  | grep -v grep \
  | awk '{print $1}' \
  | xargs kill
EOF
    puts `#{sh}`
  end

end
{'fraction_non_alphanumeric': 0.17068694284216046, 'fraction_numerical': 0.003146303093864709, 'mean_word_length': 4.247592847317744, 'pattern_counts': {'":': 0, '<': 56, '<?xml version=': 0, '>': 50, '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': '1830293', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1294, 'n_words': 305}