Module: PgReports::Compatibility
- Defined in:
- lib/pg_reports/compatibility.rb
Overview
Checks runtime environment and warns about outdated or unsupported versions. Called once at boot (Ruby/Rails) and lazily on first DB access (PostgreSQL).
Constant Summary collapse
- MINIMUM_RUBY_VERSION =
Keep in sync with gemspec constraints
"2.7"- MINIMUM_RAILS_VERSION =
"5.0"- MINIMUM_PG_VERSION =
server_version_num format
12_00_00- MINIMUM_PG_VERSION_LABEL =
"12"
Class Method Summary collapse
Class Method Details
.check_all! ⇒ Object
40 41 42 43 44 |
# File 'lib/pg_reports/compatibility.rb', line 40 def check_all! check_ruby! check_rails! check_postgresql! end |
.check_postgresql! ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pg_reports/compatibility.rb', line 29 def check_postgresql! version_num = pg_version_num return if version_num.nil? # no connection yet — skip silently return if version_num >= MINIMUM_PG_VERSION label = pg_version_label(version_num) warn "[pg_reports] PostgreSQL #{label} is not supported. " \ "Minimum required version is PostgreSQL #{MINIMUM_PG_VERSION_LABEL}. " \ "Some reports may return errors or incomplete data." end |
.check_rails! ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/pg_reports/compatibility.rb', line 21 def check_rails! return unless defined?(Rails::VERSION::STRING) return if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new(MINIMUM_RAILS_VERSION) warn "[pg_reports] Rails #{Rails::VERSION::STRING} is not supported. " \ "Minimum required version is Rails #{MINIMUM_RAILS_VERSION}." end |
.check_ruby! ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pg_reports/compatibility.rb', line 14 def check_ruby! return if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new(MINIMUM_RUBY_VERSION) warn "[pg_reports] Ruby #{RUBY_VERSION} is not supported. " \ "Minimum required version is Ruby #{MINIMUM_RUBY_VERSION}." end |