<commit_before>set_default(:postgresql_host, "localhost")
set_default(:postgresql_user) { application }
set_default(:postgresql_password) { Capistrano::CLI.password_prompt "PostgreSQL Password: " }
set_default(:postgresql_database) { "#{application}_production" }

namespace :postgresql do
  desc "Install the latest stable release of PostgreSQL."
  task :install, roles: :db, only: {primary: true} do
    if os_type == 'debian'
      run "#{sudo} add-apt-repository -y ppa:pitti/postgresql"
      run "#{sudo} apt-get -y update"
      run "#{sudo} apt-get -y install postgresql libpq-dev"
    elsif os_type == 'redhat'
      # Install postgresql
      run "#{sudo} yum -y install postgresql-server postgresql-devel"

      # Enable password authorization
      run "#{sudo} sed '/^[^#]/ s/ident/md5/' /var/lib/pgsql/data/pg_hba.conf >/tmp/pg_hba.conf"
      run "#{sudo} chown postgres.postgres /tmp/pg_hba.conf"
      run "#{sudo} chmod 600 /tmp/pg_hba.conf"
      run "#{sudo} mv /tmp/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf"

      # Initialize and start the service, and make it start on reboot
      run "#{sudo} service postgresql initdb"
      run "#{sudo} service postgresql start"
      run "#{sudo} chkconfig --add postgresql"
      run "#{sudo} chkconfig postgresql on"
    end
  end
  after "deploy:install", "postgresql:install"

  desc "Create a database for this application."
  task :create_database, roles: :db, only: {primary: true} do
    run %Q{#{sudo} sudo -u postgres psql -c "create user #{postgresql_user} with password '#{postgresql_password}';"}
    run %Q{#{sudo} sudo -u postgres psql -c "create database #{postgresql_database} owner #{postgresql_user};"}
  end
  after "deploy:setup", "postgresql:create_database"

  desc "Generate the database.yml configuration file."
  task :setup, roles: :app do
    run "mkdir -p #{shared_path}/config"
    template "postgresql.yml.erb", "#{shared_path}/config/database.yml"
  end
  after "deploy:setup", "postgresql:setup"

  desc "Symlink the database.yml file into latest release"
  task :symlink, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "postgresql:symlink"
end<commit_msg>Fixed anothe small postgres glitch<commit_after>set_default(:postgresql_host, "localhost")
set_default(:postgresql_user) { application }
set_default(:postgresql_password) { Capistrano::CLI.password_prompt "PostgreSQL Password: " }
set_default(:postgresql_database) { "#{application}_production" }

namespace :postgresql do
  desc "Install the latest stable release of PostgreSQL."
  task :install, roles: :db, only: {primary: true} do
    if os_type == 'debian'
      run "#{sudo} add-apt-repository -y ppa:pitti/postgresql"
      run "#{sudo} apt-get -y update"
      run "#{sudo} apt-get -y install postgresql libpq-dev"
    elsif os_type == 'redhat'
      # Install and initialize PostgreSQL
      run "#{sudo} yum -y install postgresql-server postgresql-devel"
      run "#{sudo} service postgresql initdb"

      # Enable password authorization
      run "#{sudo} sed '/^[^#]/ s/ident/md5/' /var/lib/pgsql/data/pg_hba.conf >/tmp/pg_hba.conf"
      run "#{sudo} chown postgres.postgres /tmp/pg_hba.conf"
      run "#{sudo} chmod 600 /tmp/pg_hba.conf"
      run "#{sudo} mv /tmp/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf"

      # Initialize and start the postgresql service, and make it start on reboot
      run "#{sudo} service postgresql start"
      run "#{sudo} chkconfig --add postgresql"
      run "#{sudo} chkconfig postgresql on"
    end
  end
  after "deploy:install", "postgresql:install"

  desc "Create a database for this application."
  task :create_database, roles: :db, only: {primary: true} do
    run %Q{#{sudo} sudo -u postgres psql -c "create user #{postgresql_user} with password '#{<PASSWORD>}';"}
    run %Q{#{sudo} sudo -u postgres psql -c "create database #{postgresql_database} owner #{postgresql_user};"}
  end
  after "deploy:setup", "postgresql:create_database"

  desc "Generate the database.yml configuration file."
  task :setup, roles: :app do
    run "mkdir -p #{shared_path}/config"
    template "postgresql.yml.erb", "#{shared_path}/config/database.yml"
  end
  after "deploy:setup", "postgresql:setup"

  desc "Symlink the database.yml file into latest release"
  task :symlink, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "postgresql:symlink"
end
{'fraction_non_alphanumeric': 0.13204225352112675, 'fraction_numerical': 0.0017605633802816902, 'mean_word_length': 4.005506607929515, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, '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': '7631458', 'n_tokens_mistral': 1594, 'n_tokens_neox': 1519, 'n_words': 426}