<commit_before>require "bundler/capistrano"
require "rvm/capistrano"
require 'jammit'

server "172.16.17.32", :web, :app, :db, primary: true

set :application, "healersconnect"
set :user, "healer"
set :port, 1979
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "<EMAIL>:BoTreeConsultingTeam/HealersConnnect.git"
set :branch, "master"


default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy", "deploy:migrate"

namespace :deploy do
  # Reference: https://www.ruby-forum.com/topic/85305
  task :symlink_assets, :roles => [:app, :db, :web] do
    run "ln -nfs #{shared_path}/assets #{deploy_to}/assets"
  end
  after "deploy", "deploy:symlink_assets"

  # Reference: http://stackoverflow.com/a/11462003/936494
  task :cold do
    transaction do
      update
      setup_db  #replacing migrate in original
      start
    end
  end

  task :setup_db, :roles => :app do
    raise RuntimeError.new('db:setup aborted!') unless Capistrano::CLI.ui.ask("About to `rake db:setup`. Are you sure to wipe the entire database (anything other than 'yes' aborts):") == 'yes'
    run "cd #{current_path}; bundle exec rake db:setup RAILS_ENV=#{rails_env}"
  end

  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

  task :setup_config, roles: :app do
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
    run "mkdir -p #{shared_path}/config"
    put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
    puts "Now edit the config files in #{shared_path}."
  end
  after "deploy:setup", "deploy:setup_config"

  task :symlink_config, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "deploy:symlink_config"

  task :generate_assets, :roles => :web do
    run "cd #{deploy_to}/current && bundle exec jammit"
  end
  # Added task generate_assets to prepare assets for 'jammit' gem
  # It's necessary to do this after deploy
  # Otherwise cleanup would delete all assets generated by this
  # http://stackoverflow.com/questions/14834218/capistrano-deleting-assets
  after "deploy", "deploy:generate_assets"
  after "deploy", "assets:precompile"
end<commit_msg>Change  after "deploy", "assets:precompile" to  after "deploy", "deploy:assets:precompile"<commit_after>require "bundler/capistrano"
require "rvm/capistrano"
require 'jammit'

server "172.16.17.32", :web, :app, :db, primary: true

set :application, "healersconnect"
set :user, "healer"
set :port, 1979
set :deploy_to, "/home/#{user}/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
set :repository, "<EMAIL>:BoTreeConsultingTeam/HealersConnnect.git"
set :branch, "master"


default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases
after "deploy", "deploy:migrate"

namespace :deploy do
  # Reference: https://www.ruby-forum.com/topic/85305
  task :symlink_assets, :roles => [:app, :db, :web] do
    run "ln -nfs #{shared_path}/assets #{deploy_to}/assets"
  end
  after "deploy", "deploy:symlink_assets"

  # Reference: http://stackoverflow.com/a/11462003/936494
  task :cold do
    transaction do
      update
      setup_db  #replacing migrate in original
      start
    end
  end

  task :setup_db, :roles => :app do
    raise RuntimeError.new('db:setup aborted!') unless Capistrano::CLI.ui.ask("About to `rake db:setup`. Are you sure to wipe the entire database (anything other than 'yes' aborts):") == 'yes'
    run "cd #{current_path}; bundle exec rake db:setup RAILS_ENV=#{rails_env}"
  end

  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

  task :setup_config, roles: :app do
    sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
    sudo "ln -nfs #{current_path}/config/unicorn_init.sh /etc/init.d/unicorn_#{application}"
    run "mkdir -p #{shared_path}/config"
    put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
    puts "Now edit the config files in #{shared_path}."
  end
  after "deploy:setup", "deploy:setup_config"

  task :symlink_config, roles: :app do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
  after "deploy:finalize_update", "deploy:symlink_config"

  task :generate_assets, :roles => :web do
    run "cd #{deploy_to}/current && bundle exec jammit"
  end
  # Added task generate_assets to prepare assets for 'jammit' gem
  # It's necessary to do this after deploy
  # Otherwise cleanup would delete all assets generated by this
  # http://stackoverflow.com/questions/14834218/capistrano-deleting-assets
  after "deploy", "deploy:generate_assets"
  after "deploy", "deploy:assets:precompile"
end
{'fraction_non_alphanumeric': 0.13651622528907123, 'fraction_numerical': 0.015292801193584483, 'mean_word_length': 4.494877049180328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '3550321', 'n_tokens_mistral': 1934, 'n_tokens_neox': 1791, 'n_words': 494}