diff --git a/Gemfile b/Gemfile index c1aa25fe3..51657b5fd 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,7 @@ gem 'sass-rails' gem 'bootstrap-sass' # Compass stylesheets -gem 'compass-rails', '~> 4.0.0' +gem 'compass-rails' # Prevent deprecation warning coming from Compass in Sass 3.4.20 gem 'sass', '3.4.19' @@ -222,8 +222,8 @@ group :development, :test do gem 'codecov', require: false # Speedup and run specs when files change - #gem 'spring' - #gem 'spring-commands-rspec' + gem 'spring' + gem 'spring-commands-rspec' gem 'guard-rspec' gem 'guard-livereload', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 0d71b88cc..280b54119 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -754,6 +754,9 @@ GEM snaky_hash (2.0.1) hashie version_gem (~> 1.1, >= 1.1.1) + spring (4.2.1) + spring-commands-rspec (1.0.4) + spring (>= 0.9.1) sprockets (3.7.5) base64 concurrent-ruby (~> 1.0) @@ -833,7 +836,7 @@ DEPENDENCIES chronic codecov coffee-rails - compass-rails (~> 4.0.0) + compass-rails database_cleaner db-query-matchers delayed_job_active_record @@ -911,6 +914,8 @@ DEPENDENCIES sentry-ruby shoulda-matchers smarter_csv + spring + spring-commands-rspec timecop uglifier vcr diff --git a/config/puma.rb b/config/puma.rb index 2c952da1a..2e447bc7d 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -17,27 +17,6 @@ true ) if ActiveModel::Type::Boolean.new.cast(ENV.fetch('REDIRECT_STDOUT', false)) -before_fork do - require 'puma_worker_killer' - - PumaWorkerKiller.config do |config| - # Restart workers when they start consuming too much of the RAM - config.ram = ENV.fetch('MAX_MEMORY') do - ENV.fetch('MAX_WORKER_MEMORY', 1024).to_i * NUM_WORKERS - end.to_i - - config.frequency = 10 - - config.percent_usage = 0.75 - - config.rolling_restart_frequency = false - - config.reaper_status_logs = false - end - - PumaWorkerKiller.start -end - # https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt # Puma can serve each request in a thread from an internal thread pool. @@ -84,6 +63,27 @@ # preload_app! if ActiveModel::Type::Boolean.new.cast(ENV.fetch('PRELOAD_APP', false)) +before_fork do + require 'puma_worker_killer' + + PumaWorkerKiller.config do |config| + # Restart workers when they start consuming too much of the RAM + config.ram = ENV.fetch('MAX_MEMORY') do + ENV.fetch('MAX_WORKER_MEMORY', 1024).to_i * NUM_WORKERS + end.to_i + + config.frequency = 10 + + config.percent_usage = 0.75 + + config.rolling_restart_frequency = false + + config.reaper_status_logs = false + end + + PumaWorkerKiller.start +end + # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart