<commit_before>
require 'standarized_deploy/common'

configuration = Capistrano::Configuration.respond_to?(:instance) ?
  Capistrano::Configuration.instance(:must_exist) :
  Capistrano.configuration(:must_exist)

configuration.load do
  _cset(:app_name) do
    abort "Please specify :app_name corresponding to your server, set :app_name, 'foo'"
  end

  _cset(:app_domain) do
    abort "Please specify :app_domain corresponding to your server, set :app_domain, 'foo.bar.com'"
  end

  _cset(:staging_restart_workers)   { false }
  _cset(:staging_clear_redis_cache) { false }

  ssh_options[:forward_agent] = true
  set :rvm_ruby_string, 'default'
  set :scm, :git
  set :scm_verbose, true
  set :git_enable_submodules, 1
  set :deploy_via, :remote_cache
  set :use_sudo, false
  set :application, app_domain
  role :app, app_domain
  role :web, app_domain
  role :db, app_domain, :primary => true
  default_environment['LANG']     = 'en_US.UTF-8'
  default_environment['LANGUAGE'] = 'en_US'
  default_environment['LC_ALL']   = 'en_US.UTF-8'

  set :rvm_ruby_string, 'default'
  set :rvm_type, :system

  set :user, app_name
  set :deploy_to,  "/home/#{user}"

  set :branch do
    current_branch = %x[ git branch | grep ^* | awk {'print $2'} ].chomp

    branch = Capistrano::CLI.ui.ask "Branch to deploy (make sure to push the branch first): [#{current_branch}] "
    branch = current_branch if branch.empty?
    branch
  end

  namespace :deploy do
    task :start do
      run "#{deploy_to}/bin/start"
    end

    task :restart do
      run "#{deploy_to}/bin/restart"
    end
  end

  %w(start stop restart).each do |action|
    task "#{action}_workers" do
      run "cd #{current_path}; #{deploy_to}/bin/workers #{action}"
    end
  end

  desc "Symlinks the database.yml"
  task :symlink_db, :roles => :app do
    run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
  end

  if staging_restart_workers
    after 'deploy', 'restart_workers'
  end

  if staging_clear_redis_cache
    after 'deploy', 'redis_cache:clear'
  end

  after 'bundle:install', 'symlink_db'

end
<commit_msg>remove staging_ prefix<commit_after>
require 'standarized_deploy/common'

configuration = Capistrano::Configuration.respond_to?(:instance) ?
  Capistrano::Configuration.instance(:must_exist) :
  Capistrano.configuration(:must_exist)

configuration.load do
  _cset(:app_name) do
    abort "Please specify :app_name corresponding to your server, set :app_name, 'foo'"
  end

  _cset(:app_domain) do
    abort "Please specify :app_domain corresponding to your server, set :app_domain, 'foo.bar.com'"
  end

  _cset(:restart_workers)   { false }
  _cset(:clear_redis_cache) { false }

  ssh_options[:forward_agent] = true
  set :rvm_ruby_string, 'default'
  set :scm, :git
  set :scm_verbose, true
  set :git_enable_submodules, 1
  set :deploy_via, :remote_cache
  set :use_sudo, false
  set :application, app_domain
  role :app, app_domain
  role :web, app_domain
  role :db, app_domain, :primary => true
  default_environment['LANG']     = 'en_US.UTF-8'
  default_environment['LANGUAGE'] = 'en_US'
  default_environment['LC_ALL']   = 'en_US.UTF-8'

  set :rvm_ruby_string, 'default'
  set :rvm_type, :system

  set :user, app_name
  set :deploy_to,  "/home/#{user}"

  set :branch do
    current_branch = %x[ git branch | grep ^* | awk {'print $2'} ].chomp

    branch = Capistrano::CLI.ui.ask "Branch to deploy (make sure to push the branch first): [#{current_branch}] "
    branch = current_branch if branch.empty?
    branch
  end

  namespace :deploy do
    task :start do
      run "#{deploy_to}/bin/start"
    end

    task :restart do
      run "#{deploy_to}/bin/restart"
    end
  end

  %w(start stop restart).each do |action|
    task "#{action}_workers" do
      run "cd #{current_path}; #{deploy_to}/bin/workers #{action}"
    end
  end

  desc "Symlinks the database.yml"
  task :symlink_db, :roles => :app do
    run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
  end

  if restart_workers
    after 'deploy', 'restart_workers'
  end

  if clear_redis_cache
    after 'deploy', 'redis_cache:clear'
  end

  after 'bundle:install', 'symlink_db'

end

{'fraction_non_alphanumeric': 0.11970664774071446, 'fraction_numerical': 0.0018925952211970665, 'mean_word_length': 3.9799764428739692, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1766299', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1460, 'n_words': 374}