<commit_before>require 'recipes'

namespace :nginx do

  desc "Install the latest stable release of nginx"
  task :install do
    on roles(:web) do
      as :root do
        aptitude %w{install -y nginx}
        execute 'update-rc.d', %w{nginx defaults}
      end
    end
  end
  after "recipes:install", "nginx:install"

  desc "Setup nginx configuration for this application"
  task :setup do
    temp_file       = "#{fetch :tmp_dir}/#{fetch :application}"
    sites_available = "/etc/nginx/sites-available/#{fetch :application}"
    sites_enabled   = "/etc/nginx/sites-enabled/#{fetch :application}"

    on roles(:web) do
      as :root do
        erb = File.read(File.expand_path("../../templates/nginx_unicorn.erb", __FILE__))
        upload! StringIO.new(ERB.new(erb).result(binding)), temp_file
        execute :chown, 'root:', temp_file
        execute :mv, temp_file, sites_available

        # link creation from sites-available ~> sites-enabled
        if test("[ -f #{sites_enabled} ]")
          execute :rm, sites_enabled
        end
        execute :ln, '--symbolic', sites_available, sites_enabled

        info "Generated nginx site configuration at /etc/nginx/sites-available/#{fetch(:application)}"
      end
    end
  end
  after "recipes:setup", "nginx:setup"

  %w{start stop restart}.each do |command|
    desc "#{command.capitalize} nginx"
    task command do
      on roles(:web) do
        as :root do
          service 'nginx', command
        end
      end
    end
  end

end
<commit_msg>Forgot to keep this file readable for all<commit_after>require 'recipes'

namespace :nginx do

  desc "Install the latest stable release of nginx"
  task :install do
    on roles(:web) do
      as :root do
        aptitude %w{install -y nginx}
        execute 'update-rc.d', %w{nginx defaults}
      end
    end
  end
  after "recipes:install", "nginx:install"

  desc "Setup nginx configuration for this application"
  task :setup do
    temp_file       = "#{fetch :tmp_dir}/#{fetch :application}"
    sites_available = "/etc/nginx/sites-available/#{fetch :application}"
    sites_enabled   = "/etc/nginx/sites-enabled/#{fetch :application}"

    on roles(:web) do
      as :root do
        erb = File.read(File.expand_path("../../templates/nginx_unicorn.erb", __FILE__))
        upload! StringIO.new(ERB.new(erb).result(binding)), temp_file
        execute :chown, 'root:', temp_file
        execute :chmod, 'a+r', temp_file
        execute :mv, temp_file, sites_available

        # link creation from sites-available ~> sites-enabled
        if test("[ -f #{sites_enabled} ]")
          execute :rm, sites_enabled
        end
        execute :ln, '--symbolic', sites_available, sites_enabled

        info "Generated nginx site configuration at /etc/nginx/sites-available/#{fetch(:application)}"
      end
    end
  end
  after "recipes:setup", "nginx:setup"

  %w{start stop restart}.each do |command|
    desc "#{command.capitalize} nginx"
    task command do
      on roles(:web) do
        as :root do
          service 'nginx', command
        end
      end
    end
  end

end

{'fraction_non_alphanumeric': 0.11601675797615212, 'fraction_numerical': 0.0, 'mean_word_length': 2.660377358490566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3058171', 'n_tokens_mistral': 982, 'n_tokens_neox': 953, 'n_words': 275}