<commit_before># config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'capi'
set :repo_url, 'https://github.com/riseshia/capistrano_example.git'
set :release_path, '/home/vagrant/www'

framework_tasks = [:starting, :started, :updating, :updated, :publishing, :published, :finishing, :finished]
 
framework_tasks.each do |t|
  Rake::Task["deploy:#{t}"].clear
end
 
Rake::Task[:deploy].clear

task :clone do
  release_path = fetch(:release_path)
  repo_url = fetch(:repo_url)

  on roles(:web) do
    info "clone repository from github"
    unless test "[ -d #{release_path} ]"
      execute "mkdir -p #{release_path}"
    end

    execute "git clone #{repo_url} #{release_path}"
  end
end

task :deploy => :clone do
  release_path = fetch(:release_path)

  on roles(:web) do
    begin
      if test "[ -d #{release_path} ]"
        running_pid = capture("cd #{release_path}; cat RUNNING_PID")
        execute "kill #{running_pid}"
      end
    rescue => e
      info "No previous release directory exists"
    end

    execute "cd #{release_path}; ( ( nohup ruby server.rb ENV=production &>/dev/null ) & echo $! > RUNNING_PID)"
  end<commit_msg>fix to use production mode<commit_after># config valid only for current version of Capistrano
lock '3.4.0'

set :application, 'capi'
set :repo_url, 'https://github.com/riseshia/capistrano_example.git'
set :release_path, '/home/vagrant/www'

framework_tasks = [:starting, :started, :updating, :updated, :publishing, :published, :finishing, :finished]
 
framework_tasks.each do |t|
  Rake::Task["deploy:#{t}"].clear
end
 
Rake::Task[:deploy].clear

task :clone do
  release_path = fetch(:release_path)
  repo_url = fetch(:repo_url)

  on roles(:web) do
    info "clone repository from github"
    unless test "[ -d #{release_path} ]"
      execute "mkdir -p #{release_path}"
    end

    execute "git clone #{repo_url} #{release_path}"
  end
end

task :deploy => :clone do
  release_path = fetch(:release_path)

  on roles(:web) do
    begin
      if test "[ -d #{release_path} ]"
        running_pid = capture("cd #{release_path}; cat RUNNING_PID")
        execute "kill #{running_pid}"
      end
    rescue => e
      info "No previous release directory exists"
    end

    execute "cd #{release_path}; ( ( nohup RACK_ENV=production ruby server.rb &>/dev/null ) & echo $! > RUNNING_PID)"
  end
{'fraction_non_alphanumeric': 0.1358649789029536, 'fraction_numerical': 0.002531645569620253, 'mean_word_length': 3.78989898989899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6091628', 'n_tokens_mistral': 817, 'n_tokens_neox': 784, 'n_words': 221}