<commit_before>#
# Cookbook Name:: passenger
# Recipe:: apache2

# Derives from the opsware passenger_apache2

include_recipe "passenger::install"
include_recipe "apache2"


if platform?("centos","redhat")
  if dist_only?
    # just the gem, we'll install the apache module within apache2
    package "rubygem-passenger"
    return
  else
    package "httpd-devel"
  end
else
  %w{ apache2-prefork-dev libapr1-dev }.each do |pkg|
    package pkg do
      action :upgrade
    end
  end
end


rvm_exec_prefix = system("test -e /usr/local/rvm") ? "/usr/local/bin/rvm default exec" : ""


bash "install passenger/apache2" do
  user "root"
  code '#{rvm_exec_prefix} passenger-install-apache2-module --auto'
  not_if "test -e #{node[:passenger][:module_path]}"
end



if platform?("centos","redhat") and dist_only?
  package "mod_passenger" do
    notifies :run, resources(:execute => "generate-module-list"), :immediately
  end

  file "#{node[:apache][:dir]}/conf.d/mod_passenger.conf" do
    action :delete
    backup false
  end
else
  template "#{node[:apache][:dir]}/mods-available/passenger.load" do
    cookbook "passenger"
    source "apache.load.erb"
    owner "root"
    group "root"
    mode 0644
  end
end

template "#{node[:apache][:dir]}/mods-available/passenger.conf" do
  cookbook "passenger"
  source "apache.conf.erb"
  owner "root"
  group "root"
  mode 0644
end

apache_module "passenger"


#log_path = node[:passenger][:production][:log_path]
#
#directory log_path do
#  mode 0755
#  action :create
#end

<commit_msg>Try changing the order a bit. We don't want apache until after the passenger templates<commit_after>#
# Cookbook Name:: passenger
# Recipe:: apache2

# Derives from the opsware passenger_apache2

include_recipe "passenger::install"

if platform?("centos","redhat")
  if dist_only?
    # just the gem, we'll install the apache module within apache2
    package "rubygem-passenger"
    return
  else
    package "httpd-devel"
  end
else
  %w{ apache2-prefork-dev libapr1-dev }.each do |pkg|
    package pkg do
      action :upgrade
    end
  end
end


rvm_exec_prefix = system("test -e /usr/local/rvm") ? "/usr/local/bin/rvm default exec" : ""


bash "install passenger/apache2" do
  user "root"
  code '#{rvm_exec_prefix} passenger-install-apache2-module --auto'
  not_if "test -e #{node[:passenger][:module_path]}"
end



if platform?("centos","redhat") and dist_only?
  package "mod_passenger" do
    notifies :run, resources(:execute => "generate-module-list"), :immediately
  end

  file "#{node[:apache][:dir]}/conf.d/mod_passenger.conf" do
    action :delete
    backup false
  end
else
  template "#{node[:apache][:dir]}/mods-available/passenger.load" do
    cookbook "passenger"
    source "apache.load.erb"
    owner "root"
    group "root"
    mode 0644
  end
end

template "#{node[:apache][:dir]}/mods-available/passenger.conf" do
  cookbook "passenger"
  source "apache.conf.erb"
  owner "root"
  group "root"
  mode 0644
end

include_recipe "apache2"
apache_module "passenger"


#log_path = node[:passenger][:production][:log_path]
#
#directory log_path do
#  mode 0755
#  action :create
#end


{'fraction_non_alphanumeric': 0.12802547770700637, 'fraction_numerical': 0.012738853503184714, 'mean_word_length': 3.9936406995230525, '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': '1978489', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1091, 'n_words': 286}