<commit_before># Copyright 2006-2008 by <NAME>. All rights reserved.
Capistrano::Configuration.instance(:must_exist).load do 
  namespace :deprec do
    namespace :users do

      set(:users_target_user) { Capistrano::CLI.ui.ask "Enter userid for new user" do |q| q.default = current_user; end }
      set(:users_target_group) { Capistrano::CLI.ui.ask "Enter group name for new user" do |q| q.default = 'deploy'; end }
      set(:users_make_admin) { Capistrano::CLI.ui.ask "Should this be an admin account?" do |q| q.default = 'no'; end }
      
      desc "Create account"
      task :add do
        [users_target_user, users_target_group, users_make_admin] # get input
       
        while true do
          new_password = Capistrano::CLI.ui.ask("Enter new password for #{users_target_user}") { |q| q.echo = false }
          password_conf = Capistrano::CLI.ui.ask("Re-enter new password for #{users_target_user}") { |q| q.echo = false }
          if new_password != password_conf
            puts "Fail. Passwords do not match.\n\n"
          elsif new_password.chomp == ""
            puts "Fail. Passwords cannot be empty.\n\n"
          else
            break
          end
        end 

        # Grab a list of all users with keys
        if users_target_user == 'all'
          users_target_user = Dir.entries('config/ssh/authorized_keys').reject{|f| ['.','..'].include? f}
        end

        Array(users_target_user).each do |user| 
        
          deprec2.useradd(user, :shell => '/bin/bash')
          deprec2.invoke_with_input("passwd #{user}", /UNIX password/, new_password)
        
          if users_make_admin.match(/y/i)
            deprec2.groupadd('admin')
            deprec2.add_user_to_group(user, 'admin')
            deprec2.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
          end
        
          set :target_user, user
          top.deprec.ssh.setup_keys
        end
        
      end
  
      desc "Change user password"
      task :passwd do<commit_msg>For some reason users_target_user was being unset<commit_after># Copyright 2006-2008 by <NAME>. All rights reserved.
Capistrano::Configuration.instance(:must_exist).load do 
  namespace :deprec do
    namespace :users do

      set(:users_target_user) { Capistrano::CLI.ui.ask "Enter userid for new user" do |q| q.default = current_user; end }
      set(:users_target_group) { Capistrano::CLI.ui.ask "Enter group name for new user" do |q| q.default = 'deploy'; end }
      set(:users_make_admin) { Capistrano::CLI.ui.ask "Should this be an admin account?" do |q| q.default = 'no'; end }
      
      desc "Create account"
      task :add do
        [users_target_user, users_target_group, users_make_admin] # get input
       
        while true do
          new_password = Capistrano::CLI.ui.ask("Enter new password for #{users_target_user}") { |q| q.echo = false }
          password_conf = Capistrano::CLI.ui.ask("Re-enter new password for #{users_target_user}") { |q| q.echo = false }
          if new_password != password_conf
            puts "Fail. Passwords do not match.\n\n"
          elsif new_password.chomp == ""
            puts "Fail. Passwords cannot be empty.\n\n"
          else
            break
          end
        end 

        # Grab a list of all users with keys
        if users_target_user == 'all'
          set :users_target_user, Dir.entries('config/ssh/authorized_keys').reject{|f| ['.','..'].include? f}
        end

        Array(users_target_user).each do |user| 
        
          deprec2.useradd(user, :shell => '/bin/bash')
          deprec2.invoke_with_input("passwd #{user}", /UNIX password/, new_password)
        
          if users_make_admin.match(/y/i)
            deprec2.groupadd('admin')
            deprec2.add_user_to_group(user, 'admin')
            deprec2.append_to_file_if_missing('/etc/sudoers', '%admin ALL=(ALL) ALL')
          end
        
          set :target_user, user
          top.deprec.ssh.setup_keys
        end
        
      end
  
      desc "Change user password"
      task :passwd do
{'fraction_non_alphanumeric': 0.1137033398821218, 'fraction_numerical': 0.0063850687622789785, 'mean_word_length': 2.282030620467365, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3191632', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1249, 'n_words': 322}