Use StructuredWarning to disable builtin and deprecations used with it

pull/8327/head
Oliver Günther 4 years ago
parent 3ab94fde79
commit f63d0c981d
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 3
      Gemfile
  2. 1
      Gemfile.lock
  3. 18
      config/boot.rb

@ -135,6 +135,9 @@ gem 'gon', '~> 6.3.2'
# Lograge to provide sane and non-verbose logging
gem 'lograge', '~> 0.11.0'
# Structured warnings to selectively disable them in production
gem 'structured_warnings', '~> 0.4.0'
# catch exceptions and send them to any airbrake compatible backend
# don't require by default, instead load on-demand when actually configured
gem 'airbrake', '~> 11.0.0', require: false

@ -1125,6 +1125,7 @@ DEPENDENCIES
sprockets (~> 3.7.0)
stackprof
stringex (~> 2.8.5)
structured_warnings (~> 0.4.0)
svg-graph (~> 2.2.0)
sys-filesystem (~> 1.3.3)
table_print (~> 1.5.6)

@ -37,12 +37,18 @@ end
require 'bundler/setup' # Set up gems listed in the Gemfile.
case ENV['RAILS_ENV']
when 'production'
# Disable deprecation warnings early on (before loading gems), which behaves as RUBYOPT="-w0"
# to disable the Ruby 2.7 warnings in production
Warning[:deprecated] = ENV['OPENPROJECT_PROD_DEPRECATIONS'] == 'true'
when 'development'
env = ENV['RAILS_ENV']
# Disable deprecation warnings early on (before loading gems), which behaves as RUBYOPT="-w0"
# to disable the Ruby 2.7 warnings in production.
# Set OPENPROJECT_PROD_DEPRECATIONS=true if you want to see them for debugging purposes
if env == 'production' && ENV['OPENPROJECT_PROD_DEPRECATIONS'] != 'true'
require 'structured_warnings'
Warning[:deprecated] = false
StructuredWarnings::BuiltInWarning.disable
StructuredWarnings::DeprecationWarning.disable
end
if env == 'development'
$stderr.puts "Starting with bootsnap."
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
end

Loading…
Cancel
Save