Class: RailsAdmin::Version
- Inherits:
-
Object
- Object
- RailsAdmin::Version
- Defined in:
- lib/rails_admin/version.rb
Constant Summary collapse
- MAJOR =
3
- MINOR =
2
- PATCH =
0
- PRE =
nil
Class Method Summary collapse
Class Method Details
.actual_js_version ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/rails_admin/version.rb', line 20 def actual_js_version case RailsAdmin.config.asset_source when :webpacker, :webpack js_version_from_node_modules else js end end |
.js ⇒ Object
16 17 18 |
# File 'lib/rails_admin/version.rb', line 16 def js JSON.parse(File.read("#{__dir__}/../../package.json"))['version'] end |
.to_s ⇒ String
12 13 14 |
# File 'lib/rails_admin/version.rb', line 12 def to_s [MAJOR, MINOR, PATCH, PRE].compact.join('.') end |
.warn_with_js_version ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/rails_admin/version.rb', line 29 def warn_with_js_version return unless Rails.env.development? || Rails.env.test? case actual_js_version when js # Good when nil warn "[Warning] Failed to detect RailsAdmin npm package, did you run 'yarn install'?" else warn <<~MSG [Warning] RailsAdmin npm package version inconsistency detected, expected #{js} but actually used is #{actual_js_version}. This may cause partial or total malfunction of RailsAdmin frontend features. MSG end end |