<commit_before># Add gems
gem 'resque', '~> 1.25.2'
gem 'omniauth-github', '~> 1.1.2'
gem 'foreman', '~> 0.77.0'
gem 'unicorn-rails', '~> 2.2.0'
gem 's3deploy', :git => 'https://github.com/ryanmark/s3deploy-ruby.git'
gem 'autotune', git: 'https://github.com/voxmedia/autotune', branch: 'master'

# Setup foreman
file 'Procfile', <<-CODE
redis: redis-server
resque_worker: bundle exec rake environment resque:work QUEUE=default TERM_CHILD=1
rails: bundle exec unicorn_rails -p 3000 -c config/unicorn.rb
CODE

# Setup resque
append_file 'Rakefile', "require 'resque/tasks'"

application 'config.active_job.queue_adapter = :resque'

initializer 'resque.rb', <<-CODE
Resque.redis = ENV['REDIS_SERVER'] || 'localhost:6379'
Resque.redis.namespace =  ENV['REDIS_NAMESPACE'] || 'resque:AutoTune'
CODE

# Setup omniauth initializer
initializer 'omniauth.rb', <<-CODE
OmniAuth.config.logger = Rails.logger
Rails.configuration.omniauth_preferred_provider = Rails.env.production? ? :github : :developer
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :developer unless Rails.env.production?
  provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end
CODE

initializer 'autotune.rb', "require 'autotune'"

# add engine routes<commit_msg>Add unicorn config<commit_after># Add gems
gem 'resque', '~> 1.25.2'
gem 'omniauth-github', '~> 1.1.2'
gem 'foreman', '~> 0.77.0'
gem 'unicorn-rails', '~> 2.2.0'
gem 's3deploy', :git => 'https://github.com/ryanmark/s3deploy-ruby.git'
gem 'autotune', git: 'https://github.com/voxmedia/autotune', branch: 'master'

# Setup foreman
file 'Procfile', <<-CODE
redis: redis-server
resque_worker: bundle exec rake environment resque:work QUEUE=default TERM_CHILD=1
rails: bundle exec unicorn_rails -p 3000 -c config/unicorn.rb
CODE

# Setup resque
append_file 'Rakefile', "require 'resque/tasks'"

application 'config.active_job.queue_adapter = :resque'

initializer 'resque.rb', <<-CODE
Resque.redis = ENV['REDIS_SERVER'] || 'localhost:6379'
Resque.redis.namespace =  ENV['REDIS_NAMESPACE'] || 'resque:AutoTune'
CODE

# Setup omniauth initializer
initializer 'omniauth.rb', <<-CODE
OmniAuth.config.logger = Rails.logger
Rails.configuration.omniauth_preferred_provider = Rails.env.production? ? :github : :developer
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :developer unless Rails.env.production?
  provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end
CODE

initializer 'autotune.rb', "require 'autotune'"

file 'config/unicorn.rb', <<-CODE
  worker_processes 6
  timeout 90
CODE

# add engine routes
{'fraction_non_alphanumeric': 0.1493230174081238, 'fraction_numerical': 0.020502901353965184, 'mean_word_length': 5.78740157480315, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 4, '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': '2082479', 'n_tokens_mistral': 1001, 'n_tokens_neox': 934, 'n_words': 209}