Sha256: 3318a4731e397db86316262965cda3b4d0ec03ea7a857a7904cca8d1c8c16113

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

file '.bundle/config', <<-CODE
---
BUNDLE_PATH: #{File.expand_path '../../vendor/bundle', __FILE__}
CODE

gem 'rspec-rails'
gem 'spring-commands-rspec'
gem 'database_cleaner'
gem 'simplecov', '~> 0.7.1', require: false
gem 'pry-debugger', require: false
gem 'pry-stack_explorer', require: false
gem 'unicorn', group: :production

append_to_file 'Gemfile' do
  <<-CODE

    if File.exists?(File.expand_path('../../../lurker.rb', __FILE__))
      # run within specs
      gem 'lurker', path: "#{File.expand_path('../../..', __FILE__)}"
    else
      # run at heroku
      gem 'lurker', github: 'razum2um/lurker', branch: 'master'
    end
  CODE
end

file 'config/unicorn.rb' do
  <<-CODE
    worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
    timeout 15
    preload_app true

    before_fork do |server, worker|
      Signal.trap 'TERM' do
        puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
        Process.kill 'QUIT', Process.pid
      end

      defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
    end

    after_fork do |server, worker|
      Signal.trap 'TERM' do
        puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
      end

      defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
    end
  CODE
end

file 'Procfile' do
  <<-CODE
    web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
  CODE
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lurker-0.5.1 templates/lurker_app.rb