<commit_before>package :passenger, :provides => :appserver do
  description 'Phusion Passenger (aka mod_rails)'
  gem 'passenger' do
    post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module'
  end
  
  # configure apache module
  config do 
    put "/etc/apache2/mods-available/passenger.load", open("#{File.dirname(__FILE__)}/../templates/passenger.load").read
    put "/etc/apache2/mods-available/passenger.conf", open("#{File.dirname(__FILE__)}/../templates/passenger.conf").read
    
    # enable passenger module
    post :install, "sudo a2enmod passenger"
    
    # Restart apache to note changes
    post :install, '/etc/init.d/apache2 restart'

  end
  
  # add rails user
  config do 
    pre :install, "groupadd -f rails"
    pre :install, "useradd -g rails -m rails"
    run 'echo "" && echo "-----------------------------------" && echo "PLEASE SET A PASSWORD FOR THE NEW RAILS USER:" && passwd rails'
    post :install, 'mkdir /var/www/apps'
    post :install, 'chown rails:rails /var/www/apps'
  end
  
  
  verify do
    has_gem 'passenger'
    has_file '/etc/apache2/mods-available/passenger.load'
    has_file '/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so'
    has_directory '/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6'
  end
  
  requires :apache, :ruby_enterprise
end<commit_msg>hackish copy gemspec from root to rails user<commit_after>package :passenger, :provides => :appserver do
  description 'Phusion Passenger (aka mod_rails)'
  gem 'passenger' do
    post :install, 'echo -en "\n\n\n\n" | sudo passenger-install-apache2-module'
  end
  
  # configure apache module
  config do 
    put "/etc/apache2/mods-available/passenger.load", open("#{File.dirname(__FILE__)}/../templates/passenger.load").read
    put "/etc/apache2/mods-available/passenger.conf", open("#{File.dirname(__FILE__)}/../templates/passenger.conf").read
    
    # enable passenger module
    post :install, "sudo a2enmod passenger"
    
    # Restart apache to note changes
    post :install, '/etc/init.d/apache2 restart'

  end
  
  # add rails user
  config do 
    pre :install, "groupadd -f rails"
    pre :install, "useradd -g rails -m rails"
    # seems a bit hackish here
    new_password = ""
    password_confirmation = "!"
    while new_password != password_confirmation
      new_password = enter("Enter a new password for the rails user: ")
      password_confirmation = enter("Confirm password: ")
    end
    
    run "echo 'rails:#{new_password}' | chpasswd"
    post :install, 'mkdir /var/www/apps'
    post :install, 'chown rails:rails /var/www/apps'
    post :install, "cp /root/.gemrc /home/rails/.gemrc"
  end
  
  
  verify do
    has_gem 'passenger'
    has_file '/etc/apache2/mods-available/passenger.load'
    has_file '/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so'
    has_directory '/usr/local/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6'
  end
  
  requires :apache, :ruby_enterprise
end
{'fraction_non_alphanumeric': 0.14281056406912293, 'fraction_numerical': 0.011085751548744702, 'mean_word_length': 3.0689655172413794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '347549', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1028, 'n_words': 237}