<commit_before># Passenger.
namespace :passenger do
  desc "install (or upgrade) passenger gem and apache module"
  task :install, roles: :web  do
    run <<-CMD.compact
    gem install passenger --no-ri --no-rdoc &&
    rbenv rehash &&
    passenger-install-apache2-module --auto
    CMD
    passenger.update_config
  end

  desc "Update passenger conf file"
  task :update_config, roles: :web do
    version = 'ERROR' # default

    # passenger (2.X.X, 1.X.X)
    run("gem list | grep passenger") do |ch, stream, data|
      version = data.sub(/passenger \(([^,]+).*?\)/,"\\1").strip
    end

    puts "  passenger version #{version} configured"

    passenger_config =<<-EOF
        # This is created by capistrano. Refer to passenger:update_config
        LoadModule passenger_module #{rbenv_path}/versions/#{rbenv_ruby_version}/lib/ruby/gems/2.0.0/gems/passenger-#{version}/buildout/apache2/mod_passenger.so
        PassengerRoot #{rbenv_path}/versions/#{rbenv_ruby_version}/lib/ruby/gems/2.0.0/gems/passenger-#{version}
        PassengerDefaultRuby #{rbenv_path}/versions/#{rbenv_ruby_version}/bin/ruby

        PassengerSpawnMethod smart
        PassengerPoolIdleTime 1000
        RailsAppSpawnerIdleTime 0
        PassengerMaxRequests 5000
        PassengerMinInstances 3

        #PassengerLogLevel 3
        #PassengerDebugLogFile /var/log/httpd/passenger_debug.log

        PassengerTempDir /opt/heracles/deploy/passenger
        EOF

        put passenger_config, "/opt/heracles/deploy/.passenger.tmp"
        run <<-CMD.compact
        mkdir -p #{shared_path}/passenger &&
        sudo /bin/mv /opt/heracles/deploy/.passenger.tmp /etc/httpd/conf.d/passenger.conf &&
        sudo /sbin/service httpd restart
        CMD
        passenger.warmup
  end

  desc "warm up passenger"
  task :warmup, roles: :web  do
    run "curl -s -k -o /dev/null --head https://$(hostname -f)"
  end
end

# end<commit_msg>Modified passenger module load to be dynamic using snippet flag refs #9258<commit_after># Passenger.
namespace :passenger do
  desc "install (or upgrade) passenger gem and apache module"
  task :install, roles: :web  do
    run <<-CMD.compact
    gem install passenger --no-ri --no-rdoc &&
    rbenv rehash &&
    passenger-install-apache2-module --auto
    CMD
    passenger.update_config
  end

  desc "Update passenger conf file"
  task :update_config, roles: :web do
    version = 'ERROR' # default

    # passenger (2.X.X, 1.X.X)
    run("gem list | grep passenger") do |ch, stream, data|
      version = data.sub(/passenger \(([^,]+).*?\)/,"\\1").strip
    end

    puts "  passenger version #{version} configured"

    passenger_config =<<-EOF
        # This is created by capistrano. Refer to passenger:update_config

        PassengerSpawnMethod smart
        PassengerPoolIdleTime 1000
        RailsAppSpawnerIdleTime 0
        PassengerMaxRequests 5000
        PassengerMinInstances 3

        #PassengerLogLevel 3
        #PassengerDebugLogFile /var/log/httpd/passenger_debug.log

        PassengerTempDir /opt/heracles/deploy/passenger
        EOF

        put passenger_config, "/opt/heracles/deploy/.passenger.tmp"
        run ("passenger-install-apache2-module --snippet >>  /opt/heracles/deploy/.passenger.tmp")
        run <<-CMD.compact
        mkdir -p #{shared_path}/passenger &&
        sudo /bin/mv /opt/heracles/deploy/.passenger.tmp /etc/httpd/conf.d/passenger.conf &&
        sudo /sbin/service httpd restart
        CMD
        passenger.warmup
  end

  desc "warm up passenger"
  task :warmup, roles: :web  do
    run "curl -s -k -o /dev/null --head https://$(hostname -f)"
  end
end

# end
{'fraction_non_alphanumeric': 0.11450591797412607, 'fraction_numerical': 0.011560693641618497, 'mean_word_length': 2.6781376518218623, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '7528193', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1154, 'n_words': 287}